|
|
fbe740 |
From 56a605626d81ee27ad220f3f949990cc46fca061 Mon Sep 17 00:00:00 2001
|
|
|
fbe740 |
Message-Id: <56a605626d81ee27ad220f3f949990cc46fca061@dist-git>
|
|
|
fbe740 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Date: Mon, 16 Mar 2020 22:12:15 +0100
|
|
|
fbe740 |
Subject: [PATCH] qemu: monitor: Add handler for blockdev-reopen
|
|
|
fbe740 |
MIME-Version: 1.0
|
|
|
fbe740 |
Content-Type: text/plain; charset=UTF-8
|
|
|
fbe740 |
Content-Transfer-Encoding: 8bit
|
|
|
fbe740 |
|
|
|
fbe740 |
Introduce the monitor code for using blockdev-reopen.
|
|
|
fbe740 |
|
|
|
fbe740 |
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
|
fbe740 |
(cherry picked from commit 9f436e067df2e4465228c8ba536dcf9f9445aabc)
|
|
|
fbe740 |
|
|
|
fbe740 |
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
|
|
|
fbe740 |
Message-Id: <e74e172e1c5e73fcaeafb7fb3a09414a2fcbe9ad.1584391727.git.pkrempa@redhat.com>
|
|
|
fbe740 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
fbe740 |
---
|
|
|
fbe740 |
src/qemu/qemu_monitor.c | 13 +++++++++++++
|
|
|
fbe740 |
src/qemu/qemu_monitor.h | 3 +++
|
|
|
fbe740 |
src/qemu/qemu_monitor_json.c | 21 +++++++++++++++++++++
|
|
|
fbe740 |
src/qemu/qemu_monitor_json.h | 4 ++++
|
|
|
fbe740 |
4 files changed, 41 insertions(+)
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
|
|
fbe740 |
index e3ee48613a..c4202d59af 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_monitor.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_monitor.c
|
|
|
fbe740 |
@@ -4407,6 +4407,19 @@ qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
+int
|
|
|
fbe740 |
+qemuMonitorBlockdevReopen(qemuMonitorPtr mon,
|
|
|
fbe740 |
+ virJSONValuePtr *props)
|
|
|
fbe740 |
+{
|
|
|
fbe740 |
+ VIR_DEBUG("props=%p (node-name=%s)", *props,
|
|
|
fbe740 |
+ NULLSTR(virJSONValueObjectGetString(*props, "node-name")));
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ QEMU_CHECK_MONITOR(mon);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ return qemuMonitorJSONBlockdevReopen(mon, props);
|
|
|
fbe740 |
+}
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+
|
|
|
fbe740 |
int
|
|
|
fbe740 |
qemuMonitorBlockdevDel(qemuMonitorPtr mon,
|
|
|
fbe740 |
const char *nodename)
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
|
|
fbe740 |
index 6a6b8efaee..481fc8e12e 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_monitor.h
|
|
|
fbe740 |
+++ b/src/qemu/qemu_monitor.h
|
|
|
fbe740 |
@@ -1325,6 +1325,9 @@ int qemuMonitorBlockdevCreate(qemuMonitorPtr mon,
|
|
|
fbe740 |
int qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
|
|
|
fbe740 |
virJSONValuePtr *props);
|
|
|
fbe740 |
|
|
|
fbe740 |
+int qemuMonitorBlockdevReopen(qemuMonitorPtr mon,
|
|
|
fbe740 |
+ virJSONValuePtr *props);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
int qemuMonitorBlockdevDel(qemuMonitorPtr mon,
|
|
|
fbe740 |
const char *nodename);
|
|
|
fbe740 |
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
|
|
fbe740 |
index 3827574ef6..0122b77259 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_monitor_json.c
|
|
|
fbe740 |
+++ b/src/qemu/qemu_monitor_json.c
|
|
|
fbe740 |
@@ -8830,6 +8830,27 @@ qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
|
|
|
fbe740 |
}
|
|
|
fbe740 |
|
|
|
fbe740 |
|
|
|
fbe740 |
+int
|
|
|
fbe740 |
+qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
|
|
|
fbe740 |
+ virJSONValuePtr *props)
|
|
|
fbe740 |
+{
|
|
|
fbe740 |
+ g_autoptr(virJSONValue) cmd = NULL;
|
|
|
fbe740 |
+ g_autoptr(virJSONValue) reply = NULL;
|
|
|
fbe740 |
+ virJSONValuePtr pr = g_steal_pointer(props);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", pr)))
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ if (qemuMonitorJSONCheckError(cmd, reply) < 0)
|
|
|
fbe740 |
+ return -1;
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+ return 0;
|
|
|
fbe740 |
+}
|
|
|
fbe740 |
+
|
|
|
fbe740 |
+
|
|
|
fbe740 |
int
|
|
|
fbe740 |
qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
|
|
|
fbe740 |
const char *nodename)
|
|
|
fbe740 |
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
|
|
|
fbe740 |
index fd2e09025e..801babef97 100644
|
|
|
fbe740 |
--- a/src/qemu/qemu_monitor_json.h
|
|
|
fbe740 |
+++ b/src/qemu/qemu_monitor_json.h
|
|
|
fbe740 |
@@ -600,6 +600,10 @@ int qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
|
|
|
fbe740 |
virJSONValuePtr *props)
|
|
|
fbe740 |
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
fbe740 |
|
|
|
fbe740 |
+int qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
|
|
|
fbe740 |
+ virJSONValuePtr *props)
|
|
|
fbe740 |
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
fbe740 |
+
|
|
|
fbe740 |
int qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
|
|
|
fbe740 |
const char *nodename)
|
|
|
fbe740 |
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
fbe740 |
--
|
|
|
fbe740 |
2.25.1
|
|
|
fbe740 |
|