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

qemu: monitor: Introduce support for blockdev-mirror

drive-mirror allows only file targets. Introduce support for
blockdev-mirror that is able to copy to any BDS described by a node name
in qemu.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 c7b66f2a
......@@ -3362,6 +3362,28 @@ qemuMonitorDriveMirror(qemuMonitorPtr mon,
}
int
qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
const char *jobname,
const char *device,
const char *target,
unsigned long long bandwidth,
unsigned int granularity,
unsigned long long buf_size,
unsigned int flags)
{
VIR_DEBUG("jobname=%s, device=%s, target=%s, bandwidth=%lld, "
"granularity=%#x, buf_size=%lld, flags=0x%x",
NULLSTR(jobname), device, target, bandwidth, granularity,
buf_size, flags);
QEMU_CHECK_MONITOR_JSON(mon);
return qemuMonitorJSONBlockdevMirror(mon, jobname, device, target, bandwidth,
granularity, buf_size, flags);
}
/* Use the transaction QMP command to run atomic snapshot commands. */
int
qemuMonitorTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
......
......@@ -860,6 +860,15 @@ int qemuMonitorDriveMirror(qemuMonitorPtr mon,
unsigned long long buf_size,
unsigned int flags)
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
const char *jobname,
const char *device,
const char *target,
unsigned long long bandwidth,
unsigned int granularity,
unsigned long long buf_size,
unsigned int flags)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
int qemuMonitorDrivePivot(qemuMonitorPtr mon,
const char *device)
ATTRIBUTE_NONNULL(2);
......
......@@ -4189,6 +4189,45 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
return ret;
}
int
qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
const char *jobname,
const char *device,
const char *target,
unsigned long long speed,
unsigned int granularity,
unsigned long long buf_size,
unsigned int flags)
{
int ret = -1;
virJSONValuePtr cmd;
virJSONValuePtr reply = NULL;
bool shallow = (flags & VIR_DOMAIN_BLOCK_REBASE_SHALLOW) != 0;
cmd = qemuMonitorJSONMakeCommand("blockdev-mirror",
"S:job-id", jobname,
"s:device", device,
"s:target", target,
"Y:speed", speed,
"z:granularity", granularity,
"P:buf-size", buf_size,
"s:sync", shallow ? "top" : "full",
NULL);
if (!cmd)
return -1;
if ((ret = qemuMonitorJSONCommand(mon, cmd, &reply)) < 0)
goto cleanup;
ret = qemuMonitorJSONCheckError(cmd, reply);
cleanup:
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
}
int
qemuMonitorJSONTransaction(qemuMonitorPtr mon, virJSONValuePtr *actions)
{
......
......@@ -264,6 +264,15 @@ int qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
unsigned long long buf_size,
unsigned int flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
int qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
const char *jobname,
const char *device,
const char *target,
unsigned long long speed,
unsigned int granularity,
unsigned long long buf_size,
unsigned int flags)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
const char *device)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册