qemu: monitor: Don't pass full flags to qemuMonitorJSONBlockdevMirror

Split out the 'shallow' flag as a boolean argument rather than passing
in flags and constructing them in irrelevant APIs.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2019-05-17 18:13:53 +02:00
parent c4043d1d6e
commit 6b155c41e9
6 changed files with 9 additions and 15 deletions

View File

@ -793,10 +793,6 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
int mon_ret = 0;
int ret = -1;
VIR_AUTOUNREF(virStorageSourcePtr) copysrc = NULL;
unsigned int mirror_flags = 0;
if (mirror_shallow)
mirror_flags |= VIR_DOMAIN_BLOCK_REBASE_SHALLOW;
VIR_DEBUG("starting blockdev mirror for disk=%s to host=%s", diskAlias, host);
@ -841,7 +837,7 @@ qemuMigrationSrcNBDStorageCopyBlockdev(virQEMUDriverPtr driver,
if (mon_ret == 0)
mon_ret = qemuMonitorBlockdevMirror(qemuDomainGetMonitor(vm), NULL,
diskAlias, copysrc->nodeformat,
mirror_speed, 0, 0, mirror_flags);
mirror_speed, 0, 0, mirror_shallow);
if (mon_ret != 0)
qemuBlockStorageSourceAttachRollback(qemuDomainGetMonitor(vm), data);

View File

@ -3266,17 +3266,17 @@ qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
unsigned long long bandwidth,
unsigned int granularity,
unsigned long long buf_size,
unsigned int flags)
bool shallow)
{
VIR_DEBUG("jobname=%s, device=%s, target=%s, bandwidth=%lld, "
"granularity=%#x, buf_size=%lld, flags=0x%x",
"granularity=%#x, buf_size=%lld, shallow=%d",
NULLSTR(jobname), device, target, bandwidth, granularity,
buf_size, flags);
buf_size, shallow);
QEMU_CHECK_MONITOR(mon);
return qemuMonitorJSONBlockdevMirror(mon, jobname, device, target, bandwidth,
granularity, buf_size, flags);
granularity, buf_size, shallow);
}

View File

@ -893,7 +893,7 @@ int qemuMonitorBlockdevMirror(qemuMonitorPtr mon,
unsigned long long bandwidth,
unsigned int granularity,
unsigned long long buf_size,
unsigned int flags)
bool shallow)
ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
int qemuMonitorDrivePivot(qemuMonitorPtr mon,
const char *jobname)

View File

@ -4320,12 +4320,11 @@ qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
unsigned long long speed,
unsigned int granularity,
unsigned long long buf_size,
unsigned int flags)
bool shallow)
{
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,

View File

@ -259,7 +259,7 @@ int qemuMonitorJSONBlockdevMirror(qemuMonitorPtr mon,
unsigned long long speed,
unsigned int granularity,
unsigned long long buf_size,
unsigned int flags)
bool shallow)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
int qemuMonitorJSONDrivePivot(qemuMonitorPtr mon,
const char *jobname)

View File

@ -1343,8 +1343,7 @@ GEN_TEST_FUNC(qemuMonitorJSONDelDevice, "ide0")
GEN_TEST_FUNC(qemuMonitorJSONAddDevice, "some_dummy_devicestr")
GEN_TEST_FUNC(qemuMonitorJSONDriveMirror, "vdb", "/foo/bar", "formatstr", 1024, 1234, 31234,
VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)
GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", "vdb", "targetnode", 1024, 1234, 31234,
VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT)
GEN_TEST_FUNC(qemuMonitorJSONBlockdevMirror, "jobname", "vdb", "targetnode", 1024, 1234, 31234, true)
GEN_TEST_FUNC(qemuMonitorJSONBlockStream, "vdb", "/foo/bar1", "backingfilename", 1024)
GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb", "/foo/bar1", "/foo/bar2", "backingfilename", 1024)
GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb")