kvm.snapshot-redefine
Remove all snapshots of a KVM virtual machine and redefine them from a list of snapshot XML definitions.
This method can only run on the passive node of a cluster. RVC uses it when it synchronizes snapshots from the active node to the passive node (kvm.snapshot-sync) and when it restores a full backup. In most cases, run kvm.snapshot-sync on the active node instead of calling this method directly.
Important: Every existing snapshot definition of the virtual machine on the node is removed and replaced with the definitions you pass. An empty list removes all snapshot definitions. To restore them, run kvm.snapshot-sync on the active node.
JSON-RPC Request
{"jsonrpc":"2.0","id":1,"method":"kvm.snapshot_redefine","params":{"hostname":"kvm1","snapshot_definitions":["<domainsnapshot>...</domainsnapshot>"]}}
Request Parameters
| Argument | Type | Description | Required |
|---|---|---|---|
hostname | String | The name of the virtual machine. | Yes |
snapshot_definitions | String array | The snapshot XML definitions to apply, one string for each snapshot. On the command line, use --snapshot-definitions and separate the definitions with commas. | Yes |
JSON-RPC Response
{
"jsonrpc": "2.0",
"id": 1,
"result": []
}
Errors
| Code | Message | Cause |
|---|---|---|
-32063 | This operation can only be performed by the cluster passive node. | The method was run on the active cluster node. Run it on the passive node. |
-32086 | Virtual Machine <name> not found on host. | The virtual machine does not exist on the node. |
RVC CLI Example
Use --dry-run to see the JSON-RPC request that the CLI builds from a list of definitions without running it.
rvc kvm snapshot-redefine --hostname kvm1 --snapshot-definitions '<a/>,<b/>' --dry-run
Response
{"jsonrpc":"2.0","id":1,"method":"kvm.snapshot_redefine","params":{"hostname":"kvm1","snapshot_definitions":["<a/>", "<b/>"]}}