提交 e8712030 编写于 作者: P Peter Krempa

qemu: monitor: Add support for blockdev-backup via 'transaction'

Implement the transaction actions generator for blockdev-backup.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Reviewed-by: NDaniel P. Berrangé <berrange@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 08b81005
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册