The upcoming virDomainBackup() API needs to take advantage of the
ability to expose a bitmap as part of nbd-server-add for a pull-mode
backup (this is the recently-added QEMU_CAPS_NBD_BITMAP capability).
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
src/qemu/qemu_monitor.h | 4 +++-
src/qemu/qemu_monitor_json.h | 4 +++-
src/qemu/qemu_migration.c | 2 +-
src/qemu/qemu_monitor.c | 10 +++++++---
src/qemu/qemu_monitor_json.c | 7 ++++++-
tests/qemumonitorjsontest.c | 2 +-
6 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 30474c325d..482d51c41d 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1118,7 +1118,9 @@ int qemuMonitorNBDServerStart(qemuMonitorPtr mon,
ATTRIBUTE_NONNULL(2);
int qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
const char *deviceID,
- bool writable);
+ const char *export,
+ bool writable,
+ const char *bitmap);
int qemuMonitorNBDServerStop(qemuMonitorPtr);
int qemuMonitorGetTPMModels(qemuMonitorPtr mon,
char ***tpmmodels);
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index 8f92e6de35..85d8f00fc0 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -463,7 +463,9 @@ int qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
const char *tls_alias);
int qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
const char *deviceID,
- bool writable);
+ const char *export,
+ bool writable,
+ const char *bitmap);
int qemuMonitorJSONNBDServerStop(qemuMonitorPtr mon);
int qemuMonitorJSONGetTPMModels(qemuMonitorPtr mon,
char ***tpmmodels)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 267a729c6f..a62cb668fe 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -424,7 +424,7 @@ qemuMigrationDstStartNBDServer(virQEMUDriverPtr driver,
goto exit_monitor;
}
- if (qemuMonitorNBDServerAdd(priv->mon, diskAlias, true) < 0)
+ if (qemuMonitorNBDServerAdd(priv->mon, diskAlias, NULL, true, NULL) < 0)
goto exit_monitor;
if (qemuDomainObjExitMonitor(driver, vm) < 0)
goto cleanup;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index a371f7d425..39df201eca 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3945,13 +3945,17 @@ qemuMonitorNBDServerStart(qemuMonitorPtr mon,
int
qemuMonitorNBDServerAdd(qemuMonitorPtr mon,
const char *deviceID,
- bool writable)
+ const char *export,
+ bool writable,
+ const char *bitmap)
{
- VIR_DEBUG("deviceID=%s", deviceID);
+ VIR_DEBUG("deviceID=%s, export=%s, bitmap=%s", deviceID, NULLSTR(export),
+ NULLSTR(bitmap));
QEMU_CHECK_MONITOR(mon);
- return qemuMonitorJSONNBDServerAdd(mon, deviceID, writable);
+ return qemuMonitorJSONNBDServerAdd(mon, deviceID, export, writable,
+ bitmap);
}
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 41eef0c38c..6b66f6ef55 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -6736,15 +6736,20 @@ qemuMonitorJSONNBDServerStart(qemuMonitorPtr mon,
int
qemuMonitorJSONNBDServerAdd(qemuMonitorPtr mon,
const char *deviceID,
- bool writable)
+ const char *export,
+ bool writable,
+ const char *bitmap)
{
int ret = -1;
virJSONValuePtr cmd;
virJSONValuePtr reply = NULL;
+ /* Note: bitmap must be NULL if QEMU_CAPS_NBD_BITMAP is lacking */
if (!(cmd = qemuMonitorJSONMakeCommand("nbd-server-add",
"s:device", deviceID,
+ "S:name", export,
"b:writable", writable,
+ "S:bitmap", bitmap,
NULL)))
return ret;
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 9d707fcc7c..2a9e6cc75f 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1348,7 +1348,7 @@ GEN_TEST_FUNC(qemuMonitorJSONBlockCommit, "vdb",
"/foo/bar1", "/foo/bar2", "back
GEN_TEST_FUNC(qemuMonitorJSONDrivePivot, "vdb")
GEN_TEST_FUNC(qemuMonitorJSONScreendump, "devicename", 1,
"/foo/bar")
GEN_TEST_FUNC(qemuMonitorJSONOpenGraphics, "spice", "spicefd",
false)
-GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", true)
+GEN_TEST_FUNC(qemuMonitorJSONNBDServerAdd, "vda", NULL, true, NULL)
GEN_TEST_FUNC(qemuMonitorJSONDetachCharDev, "serial1")
GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayOpen, "foodev", true)
GEN_TEST_FUNC(qemuMonitorJSONBlockdevTrayClose, "foodev")
--
2.20.1