mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
qemu: monitor: Add support for blockdev-backup via 'transaction'
Implement the transaction actions generator for blockdev-backup. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
08b810053a
commit
e87120307a
@ -4615,3 +4615,16 @@ qemuMonitorTransactionSnapshotBlockdev(virJSONValuePtr actions,
|
||||
{
|
||||
return qemuMonitorJSONTransactionSnapshotBlockdev(actions, node, overlay);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuMonitorTransactionBackup(virJSONValuePtr actions,
|
||||
const char *device,
|
||||
const char *jobname,
|
||||
const char *target,
|
||||
const char *bitmap,
|
||||
qemuMonitorTransactionBackupSyncMode syncmode)
|
||||
{
|
||||
return qemuMonitorJSONTransactionBackup(actions, device, jobname, target,
|
||||
bitmap, syncmode);
|
||||
}
|
||||
|
@ -1392,3 +1392,18 @@ int
|
||||
qemuMonitorTransactionSnapshotBlockdev(virJSONValuePtr actions,
|
||||
const char *node,
|
||||
const char *overlay);
|
||||
|
||||
typedef enum {
|
||||
QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_NONE = 0,
|
||||
QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_INCREMENTAL,
|
||||
QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_FULL,
|
||||
QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_LAST,
|
||||
} qemuMonitorTransactionBackupSyncMode;
|
||||
|
||||
int
|
||||
qemuMonitorTransactionBackup(virJSONValuePtr actions,
|
||||
const char *device,
|
||||
const char *jobname,
|
||||
const char *target,
|
||||
const char *bitmap,
|
||||
qemuMonitorTransactionBackupSyncMode syncmode);
|
||||
|
@ -9198,6 +9198,35 @@ qemuMonitorJSONTransactionSnapshotBlockdev(virJSONValuePtr actions,
|
||||
NULL);
|
||||
}
|
||||
|
||||
VIR_ENUM_DECL(qemuMonitorTransactionBackupSyncMode);
|
||||
VIR_ENUM_IMPL(qemuMonitorTransactionBackupSyncMode,
|
||||
QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_LAST,
|
||||
"none",
|
||||
"incremental",
|
||||
"full");
|
||||
|
||||
int
|
||||
qemuMonitorJSONTransactionBackup(virJSONValuePtr actions,
|
||||
const char *device,
|
||||
const char *jobname,
|
||||
const char *target,
|
||||
const char *bitmap,
|
||||
qemuMonitorTransactionBackupSyncMode syncmode)
|
||||
{
|
||||
const char *syncmodestr = qemuMonitorTransactionBackupSyncModeTypeToString(syncmode);
|
||||
|
||||
return qemuMonitorJSONTransactionAdd(actions,
|
||||
"blockdev-backup",
|
||||
"s:device", device,
|
||||
"s:job-id", jobname,
|
||||
"s:target", target,
|
||||
"s:sync", syncmodestr,
|
||||
"S:bitmap", bitmap,
|
||||
"T:auto-finalize", VIR_TRISTATE_BOOL_YES,
|
||||
"T:auto-dismiss", VIR_TRISTATE_BOOL_NO,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
static qemuMonitorJobInfoPtr
|
||||
qemuMonitorJSONGetJobInfoOne(virJSONValuePtr data)
|
||||
|
@ -667,3 +667,11 @@ int
|
||||
qemuMonitorJSONTransactionSnapshotBlockdev(virJSONValuePtr actions,
|
||||
const char *node,
|
||||
const char *overlay);
|
||||
|
||||
int
|
||||
qemuMonitorJSONTransactionBackup(virJSONValuePtr actions,
|
||||
const char *device,
|
||||
const char *jobname,
|
||||
const char *target,
|
||||
const char *bitmap,
|
||||
qemuMonitorTransactionBackupSyncMode syncmode);
|
||||
|
@ -2962,7 +2962,13 @@ testQemuMonitorJSONTransaction(const void *opaque)
|
||||
qemuMonitorTransactionBitmapDisable(actions, "node4", "bitmap4") < 0 ||
|
||||
qemuMonitorTransactionBitmapMerge(actions, "node5", "bitmap5", &mergebitmaps) < 0 ||
|
||||
qemuMonitorTransactionSnapshotLegacy(actions, "dev6", "path", "qcow2", true) < 0 ||
|
||||
qemuMonitorTransactionSnapshotBlockdev(actions, "node7", "overlay7") < 0)
|
||||
qemuMonitorTransactionSnapshotBlockdev(actions, "node7", "overlay7") < 0 ||
|
||||
qemuMonitorTransactionBackup(actions, "dev8", "job8", "target8", "bitmap8",
|
||||
QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_NONE) < 0 ||
|
||||
qemuMonitorTransactionBackup(actions, "dev9", "job9", "target9", "bitmap9",
|
||||
QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_INCREMENTAL) < 0 ||
|
||||
qemuMonitorTransactionBackup(actions, "devA", "jobA", "targetA", "bitmapA",
|
||||
QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_FULL) < 0)
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorTestAddItem(test, "transaction", "{\"return\":{}}") < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user