Introduce the monitor code for using blockdev-reopen. For now we'll use
x-blockdev-reopen so that the interactions between qemu and libvirt
can be tested with the existing code.
Since the usage will be guarded by the for-now unasserted capability
we'll be able to change the called command when the command will be
stabilized.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_monitor.c | 13 +++++++++++++
src/qemu/qemu_monitor.h | 3 +++
src/qemu/qemu_monitor_json.c | 21 +++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 4 ++++
4 files changed, 41 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index c2a61ec587..3fab31aa38 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4378,6 +4378,19 @@ qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
}
+int
+qemuMonitorBlockdevReopen(qemuMonitorPtr mon,
+ virJSONValuePtr *props)
+{
+ VIR_DEBUG("props=%p (node-name=%s)", *props,
+ NULLSTR(virJSONValueObjectGetString(*props, "node-name")));
+
+ QEMU_CHECK_MONITOR(mon);
+
+ return qemuMonitorJSONBlockdevReopen(mon, props);
+}
+
+
int
qemuMonitorBlockdevDel(qemuMonitorPtr mon,
const char *nodename)
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 4e06447ffa..23b8d0a650 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1324,6 +1324,9 @@ int qemuMonitorBlockdevCreate(qemuMonitorPtr mon,
int qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
virJSONValuePtr *props);
+int qemuMonitorBlockdevReopen(qemuMonitorPtr mon,
+ virJSONValuePtr *props);
+
int qemuMonitorBlockdevDel(qemuMonitorPtr mon,
const char *nodename);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 451e1afef5..0f968b7d36 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -8837,6 +8837,27 @@ qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
}
+int
+qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
+ virJSONValuePtr *props)
+{
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
+ virJSONValuePtr pr = g_steal_pointer(props);
+
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("x-blockdev-reopen", pr)))
+ return -1;
+
+ if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
+ return -1;
+
+ if (qemuMonitorJSONCheckError(cmd, reply) < 0)
+ return -1;
+
+ return 0;
+}
+
+
int
qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
const char *nodename)
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index ed48600b82..5b3bb295eb 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -602,6 +602,10 @@ int qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
virJSONValuePtr *props)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+int qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
+ virJSONValuePtr *props)
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+
int qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
const char *nodename)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
--
2.24.1