On Mon, Dec 20, 2021 at 7:42 PM Tommaso - Shellrent via Users
<users(a)ovirt.org> wrote:
Hi, someone can give to use us an exemple of the command
vdsm-client VM delete_checkpoints
?
we have tried a lot of combinations like:
vdsm-client VM delete_checkpoints vmID="ce5d0251-e971-4d89-be1b-4bc28283614c"
checkpoint_ids=["e0c56289-bfb3-4a91-9d33-737881972116"]
Why do you need to use this with vdsm?
You should use the ovirt engine API or SDK. We have example script here:
https://github.com/oVirt/python-ovirt-engine-sdk4/blob/main/examples/remo...
$ ./remove_checkpoint.py -h
usage: remove_checkpoint.py [-h] -c CONFIG [--debug] [--logfile
LOGFILE] vm_uuid checkpoint_uuid
Remove VM checkpoint
positional arguments:
vm_uuid VM UUID for removing checkpoint.
checkpoint_uuid The removed checkpoint UUID.
options:
-h, --help show this help message and exit
-c CONFIG, --config CONFIG
Use engine connection details from [CONFIG]
section in ~/.config/ovirt.conf.
--debug Log debug level messages to logfile.
--logfile LOGFILE Log file name (default example.log).
Regardless, if you really need to use vdsm client, here is how to use
the client correctly.
$ vdsm-client VM delete_checkpoints -h
usage: vdsm-client VM delete_checkpoints [-h] [arg=value [arg=value ...]]
positional arguments:
arg=value vmID: A UUID of the VM
checkpoint_ids: List of checkpoints ids to delete,
ordered from oldest to newest.
JSON representation:
{
"vmID": {
"UUID": "UUID"
},
"checkpoint_ids": [
"string",
{}
]
}
optional arguments:
-h, --help show this help message and exit
The vdsm-client is a tool for developers and support, not for users, so we did
not invest in creating an easy to use command line interface. Instead we made
sure that this tool will need zero maintenance - we never have to change it when
we add or change new APIs, because is simply get a json from the user, and
pass it to vdsm as is.
So when you see the JSON representation, you can build the json request
like this:
$ cat args.json
{
"vmID": "6e95d38f-d9b8-4955-878c-da6d631d0ab2",
"checkpoint_ids": ["b8f3f8e0-660e-49e5-bbb0-58a87ed15b13"]
}
You need to run the command with the -f flag:
$ sudo vdsm-client -f args.json VM delete_checkpoints
{
"checkpoint_ids": [
"b8f3f8e0-660e-49e5-bbb0-58a87ed15b13"
]
}
If you need to automate this, it will be easier to write a python script using
the vdsm client library directly:
$ sudo python3
Python 3.6.8 (default, Oct 15 2021, 10:57:33)
[GCC 8.5.0 20210514 (Red Hat 8.5.0-3)] on linux
Type "help", "copyright", "credits" or "license"
for more information.
>> from vdsm import client
>> c = client.connect("localhost")
>> c.VM.delete_checkpoints(vmID="6e95d38f-d9b8-4955-878c-da6d631d0ab2",
checkpoint_ids=["b8f3f8e0-660e-49e5-bbb0-58a87ed15b13"])
{'checkpoint_ids': ['b8f3f8e0-660e-49e5-bbb0-58a87ed15b13']}
Like vdsm-client, the library is meant for oVirt developers, and vdsm
API is private
implementation detail of oVirt, so you should try to use the public
ovirt engine API
instead.
Nir