mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
qemu: monitor: Add new fields for 'blockdev-mirror' command
Allow using the delayed dismiss of the job so that we can reap the state even if libvirtd was not running when qemu emitted the job completion event. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
ac6c579af3
commit
e53adccebd
@ -840,7 +840,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
|
||||
mon_ret = qemuBlockStorageSourceAttachApply(qemuDomainGetMonitor(vm), data);
|
||||
|
||||
if (mon_ret == 0)
|
||||
mon_ret = qemuMonitorBlockdevMirror(qemuDomainGetMonitor(vm), NULL,
|
||||
mon_ret = qemuMonitorBlockdevMirror(qemuDomainGetMonitor(vm), NULL, false,
|
||||
diskAlias, copysrc->nodeformat,
|
||||
mirror_speed, 0, 0, mirror_shallow);
|
||||
|
||||
|
@ -3224,6 +3224,7 @@ qemuMonitorDriveMirror(qemuMonitorPtr mon,
|
||||
int
|
||||
qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
|
||||
const char *jobname,
|
||||
bool persistjob,
|
||||
const char *device,
|
||||
const char *target,
|
||||
unsigned long long bandwidth,
|
||||
@ -3231,15 +3232,15 @@ qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
|
||||
unsigned long long buf_size,
|
||||
bool shallow)
|
||||
{
|
||||
VIR_DEBUG("jobname=%s, device=%s, target=%s, bandwidth=%lld, "
|
||||
VIR_DEBUG("jobname=%s, persistjob=%d, device=%s, target=%s, bandwidth=%lld, "
|
||||
"granularity=%#x, buf_size=%lld, shallow=%d",
|
||||
NULLSTR(jobname), device, target, bandwidth, granularity,
|
||||
NULLSTR(jobname), persistjob, device, target, bandwidth, granularity,
|
||||
buf_size, shallow);
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
return qemuMonitorJSONBlockdevMirror(mon, jobname, device, target, bandwidth,
|
||||
granularity, buf_size, shallow);
|
||||
return qemuMonitorJSONBlockdevMirror(mon, jobname, persistjob, device, target,
|
||||
bandwidth, granularity, buf_size, shallow);
|
||||
}
|
||||
|
||||
|
||||
|
@ -905,13 +905,14 @@ int qemuMonitorDriveMirror(qemuMonitorPtr mon,
|
||||
ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
int qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
|
||||
const char *jobname,
|
||||
bool persistjob,
|
||||
const char *device,
|
||||
const char *target,
|
||||
unsigned long long bandwidth,
|
||||
unsigned int granularity,
|
||||
unsigned long long buf_size,
|
||||
bool shallow)
|
||||
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
|
||||
ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
|
||||
int qemuMonitorDrivePivot(qemuMonitorPtr mon,
|
||||
const char *jobname)
|
||||
ATTRIBUTE_NONNULL(2);
|
||||
|
@ -4415,6 +4415,7 @@ qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
|
||||
int
|
||||
qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
|
||||
const char *jobname,
|
||||
bool persistjob,
|
||||
const char *device,
|
||||
const char *target,
|
||||
unsigned long long speed,
|
||||
@ -4424,6 +4425,13 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
|
||||
{
|
||||
VIR_AUTOPTR(virJSONValue) cmd = NULL;
|
||||
VIR_AUTOPTR(virJSONValue) reply = NULL;
|
||||
virTristateBool autofinalize = VIR_TRISTATE_BOOL_ABSENT;
|
||||
virTristateBool autodismiss = VIR_TRISTATE_BOOL_ABSENT;
|
||||
|
||||
if (persistjob) {
|
||||
autofinalize = VIR_TRISTATE_BOOL_YES;
|
||||
autodismiss = VIR_TRISTATE_BOOL_NO;
|
||||
}
|
||||
|
||||
cmd = qemuMonitorJSONMakeCommand("blockdev-mirror",
|
||||
"S:job-id", jobname,
|
||||
@ -4433,6 +4441,8 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
|
||||
"z:granularity", granularity,
|
||||
"P:buf-size", buf_size,
|
||||
"s:sync", shallow ? "top" : "full",
|
||||
"T:auto-finalize", autofinalize,
|
||||
"T:auto-dismiss", autodismiss,
|
||||
NULL);
|
||||
if (!cmd)
|
||||
return -1;
|
||||
|
@ -254,13 +254,14 @@ int qemuMonitorJSONDriveMirror(qemuMonitorPtr mon,
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
|
||||
int qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
|
||||
const char *jobname,
|
||||
bool persistjob,
|
||||
const char *device,
|
||||
const char *target,
|
||||
unsigned long long speed,
|
||||
unsigned int granularity,
|
||||
unsigned long long buf_size,
|
||||
bool shallow)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5);
|
||||
int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
|
||||
const char *jobname)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
||||
|
@ -1325,7 +1325,7 @@ GEN_TEST_FUNC(qemuMonitorJSONRemoveNetdev, "net0")
|
||||
GEN_TEST_FUNC(qemuMonitorJSONDelDevice, "ide0")
|
||||
GEN_TEST_FUNC(qemuMonitorJSONAddDevice, "some_dummy_devicestr")
|
||||
GEN_TEST_FUNC(qemuMonitorJSONDriveMirror, "vdb", "/foo/bar", "formatstr", 1024, 1234, 31234, true, true)
|
||||
GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", "vdb", "targetnode", 1024, 1234, 31234, true)
|
||||
GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", true, "vdb", "targetnode", 1024, 1234, 31234, true)
|
||||
GEN_TEST_FUNC(qemuMonitorJSONBlockStream, "vdb", "jobname", true, "/foo/bar1", "backingnode", "backingfilename", 1024)
|
||||
GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "jobname", true, "/foo/bar1", "topnode", "/foo/bar2", "basenode", "backingfilename", 1024)
|
||||
GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb")
|
||||
|
Loading…
x
Reference in New Issue
Block a user