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(a)redhat.com>
---
src/qemu/qemu_migration.c | 6 +-----
src/qemu/qemu_monitor.c | 8 ++++----
src/qemu/qemu_monitor.h | 2 +-
src/qemu/qemu_monitor_json.c | 3 +--
src/qemu/qemu_monitor_json.h | 2 +-
tests/qemumonitorjsontest.c | 3 +--
6 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 7b1e392f73..832f98346d 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -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);
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index e1fcbac13f..9a796db3cb 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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);
}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 9242d37407..438c3c38ed 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -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)
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 5e3df5e759..a75e660d07 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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,
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 746b7072ca..174db7a2e9 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -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)
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 923f6d7d9c..c2bb3a6c4f 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -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")
--
2.21.0