mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 13:17:58 +03:00
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: Peter Krempa <pkrempa@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
c7b66f2a59
commit
d30fd1fc54
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user