|
|
d76c62 |
From 0ca4a633af46f2e06d3ef831919ca75387f42103 Mon Sep 17 00:00:00 2001
|
|
|
d76c62 |
Message-Id: <0ca4a633af46f2e06d3ef831919ca75387f42103@dist-git>
|
|
|
d76c62 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
d76c62 |
Date: Mon, 16 Mar 2020 22:12:34 +0100
|
|
|
d76c62 |
Subject: [PATCH] rhel: Enable usage of x-blockdev-reopen
|
|
|
d76c62 |
MIME-Version: 1.0
|
|
|
d76c62 |
Content-Type: text/plain; charset=UTF-8
|
|
|
d76c62 |
Content-Transfer-Encoding: 8bit
|
|
|
d76c62 |
|
|
|
d76c62 |
RHEL-only
|
|
|
d76c62 |
|
|
|
d76c62 |
Introduce a new capability QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API
|
|
|
d76c62 |
based on the presence of '__com.redhat_rhel-av-8_2_0-api' feature for
|
|
|
d76c62 |
'x-blockdev-reopen' which states that reopen works for what libvirt
|
|
|
d76c62 |
is going to use it and wire up code to call the x- prefixed command.
|
|
|
d76c62 |
|
|
|
d76c62 |
This implementation will become dormant once qemu starts supporting
|
|
|
d76c62 |
upstream-stable blockdev-reopen.
|
|
|
d76c62 |
|
|
|
d76c62 |
https://bugzilla.redhat.com/show_bug.cgi?id=1799013
|
|
|
d76c62 |
Message-Id: <098dc0e73e1b561af991f2a9ecf13436dde3b33d.1584391727.git.pkrempa@redhat.com>
|
|
|
d76c62 |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
d76c62 |
---
|
|
|
d76c62 |
src/qemu/qemu_block.c | 3 ++-
|
|
|
d76c62 |
src/qemu/qemu_capabilities.c | 13 +++++++++++++
|
|
|
d76c62 |
src/qemu/qemu_capabilities.h | 3 +++
|
|
|
d76c62 |
src/qemu/qemu_monitor.c | 5 +++--
|
|
|
d76c62 |
src/qemu/qemu_monitor.h | 3 ++-
|
|
|
d76c62 |
src/qemu/qemu_monitor_json.c | 12 +++++++++---
|
|
|
d76c62 |
src/qemu/qemu_monitor_json.h | 3 ++-
|
|
|
d76c62 |
7 files changed, 34 insertions(+), 8 deletions(-)
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c
|
|
|
d76c62 |
index 21c1ad9618..099ceeb802 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_block.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_block.c
|
|
|
d76c62 |
@@ -3225,6 +3225,7 @@ qemuBlockReopenFormat(virDomainObjPtr vm,
|
|
|
d76c62 |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
d76c62 |
virQEMUDriverPtr driver = priv->driver;
|
|
|
d76c62 |
g_autoptr(virJSONValue) reopenprops = NULL;
|
|
|
d76c62 |
+ bool downstream = virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API);
|
|
|
d76c62 |
int rc;
|
|
|
d76c62 |
|
|
|
d76c62 |
/* If we are lacking the object here, qemu might have opened an image with
|
|
|
d76c62 |
@@ -3241,7 +3242,7 @@ qemuBlockReopenFormat(virDomainObjPtr vm,
|
|
|
d76c62 |
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
|
|
|
d76c62 |
- rc = qemuMonitorBlockdevReopen(priv->mon, &reopenprops);
|
|
|
d76c62 |
+ rc = qemuMonitorBlockdevReopen(priv->mon, &reopenprops, downstream);
|
|
|
d76c62 |
|
|
|
d76c62 |
if (qemuDomainObjExitMonitor(driver, vm) < 0 || rc < 0)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
|
|
d76c62 |
index a4046b09d6..0b4ed4253c 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_capabilities.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_capabilities.c
|
|
|
d76c62 |
@@ -561,6 +561,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
|
|
|
d76c62 |
"vhost-user-fs",
|
|
|
d76c62 |
"blockdev-snapshot.allow-write-only-overlay",
|
|
|
d76c62 |
"blockdev-reopen",
|
|
|
d76c62 |
+
|
|
|
d76c62 |
+ /* 355 */
|
|
|
d76c62 |
+ "blockdev-reopen.__com.redhat_rhel-av-8_2_0-api"
|
|
|
d76c62 |
);
|
|
|
d76c62 |
|
|
|
d76c62 |
|
|
|
d76c62 |
@@ -1419,6 +1422,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsNVDIMM[] = {
|
|
|
d76c62 |
|
|
|
d76c62 |
/* see documentation for virQEMUQAPISchemaPathGet for the query format */
|
|
|
d76c62 |
static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
|
|
|
d76c62 |
+ { "x-blockdev-reopen/$__com.redhat_rhel-av-8_2_0-api", QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API },
|
|
|
d76c62 |
{ "blockdev-add/arg-type/options/+gluster/debug-level", QEMU_CAPS_GLUSTER_DEBUG_LEVEL},
|
|
|
d76c62 |
{ "blockdev-add/arg-type/+gluster/debug", QEMU_CAPS_GLUSTER_DEBUG_LEVEL},
|
|
|
d76c62 |
{ "blockdev-add/arg-type/+vxhs", QEMU_CAPS_VXHS},
|
|
|
d76c62 |
@@ -4861,6 +4865,15 @@ virQEMUCapsInitProcessCaps(virQEMUCapsPtr qemuCaps)
|
|
|
d76c62 |
virQEMUCapsGet(qemuCaps, QEMU_CAPS_SAVEVM_MONITOR_NODES))
|
|
|
d76c62 |
virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV);
|
|
|
d76c62 |
|
|
|
d76c62 |
+ /* RHEL-only:
|
|
|
d76c62 |
+ * - if upstream blockdev-reopen is enabled, clear the downstream flag
|
|
|
d76c62 |
+ * - if the downstream flag is present but not the upstream, assert the upstream flag too
|
|
|
d76c62 |
+ */
|
|
|
d76c62 |
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN))
|
|
|
d76c62 |
+ virQEMUCapsClear(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API);
|
|
|
d76c62 |
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API))
|
|
|
d76c62 |
+ virQEMUCapsSet(qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN);
|
|
|
d76c62 |
+
|
|
|
d76c62 |
virQEMUCapsInitProcessCapsInterlock(qemuCaps);
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
|
|
d76c62 |
index 8fdbe05638..0f7c586703 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_capabilities.h
|
|
|
d76c62 |
+++ b/src/qemu/qemu_capabilities.h
|
|
|
d76c62 |
@@ -543,6 +543,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
|
|
|
d76c62 |
QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY, /* blockdev-snapshot has the 'allow-write-only-overlay' feature */
|
|
|
d76c62 |
QEMU_CAPS_BLOCKDEV_REOPEN, /* 'blockdev-reopen' qmp command is supported */
|
|
|
d76c62 |
|
|
|
d76c62 |
+ /* 355 */
|
|
|
d76c62 |
+ QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API, /* downstream support for blockdev reopen in rhel-av-8.2.0 */
|
|
|
d76c62 |
+
|
|
|
d76c62 |
QEMU_CAPS_LAST /* this must always be the last item */
|
|
|
d76c62 |
} virQEMUCapsFlags;
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
|
|
d76c62 |
index c4202d59af..5915035589 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_monitor.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_monitor.c
|
|
|
d76c62 |
@@ -4409,14 +4409,15 @@ qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
|
|
|
d76c62 |
|
|
|
d76c62 |
int
|
|
|
d76c62 |
qemuMonitorBlockdevReopen(qemuMonitorPtr mon,
|
|
|
d76c62 |
- virJSONValuePtr *props)
|
|
|
d76c62 |
+ virJSONValuePtr *props,
|
|
|
d76c62 |
+ bool downstream)
|
|
|
d76c62 |
{
|
|
|
d76c62 |
VIR_DEBUG("props=%p (node-name=%s)", *props,
|
|
|
d76c62 |
NULLSTR(virJSONValueObjectGetString(*props, "node-name")));
|
|
|
d76c62 |
|
|
|
d76c62 |
QEMU_CHECK_MONITOR(mon);
|
|
|
d76c62 |
|
|
|
d76c62 |
- return qemuMonitorJSONBlockdevReopen(mon, props);
|
|
|
d76c62 |
+ return qemuMonitorJSONBlockdevReopen(mon, props, downstream);
|
|
|
d76c62 |
}
|
|
|
d76c62 |
|
|
|
d76c62 |
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
|
|
d76c62 |
index 481fc8e12e..ca975d084c 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_monitor.h
|
|
|
d76c62 |
+++ b/src/qemu/qemu_monitor.h
|
|
|
d76c62 |
@@ -1326,7 +1326,8 @@ int qemuMonitorBlockdevAdd(qemuMonitorPtr mon,
|
|
|
d76c62 |
virJSONValuePtr *props);
|
|
|
d76c62 |
|
|
|
d76c62 |
int qemuMonitorBlockdevReopen(qemuMonitorPtr mon,
|
|
|
d76c62 |
- virJSONValuePtr *props);
|
|
|
d76c62 |
+ virJSONValuePtr *props,
|
|
|
d76c62 |
+ bool downstream);
|
|
|
d76c62 |
|
|
|
d76c62 |
int qemuMonitorBlockdevDel(qemuMonitorPtr mon,
|
|
|
d76c62 |
const char *nodename);
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
|
|
d76c62 |
index 0122b77259..92d7317a82 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_monitor_json.c
|
|
|
d76c62 |
+++ b/src/qemu/qemu_monitor_json.c
|
|
|
d76c62 |
@@ -8832,14 +8832,20 @@ qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
|
|
|
d76c62 |
|
|
|
d76c62 |
int
|
|
|
d76c62 |
qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
|
|
|
d76c62 |
- virJSONValuePtr *props)
|
|
|
d76c62 |
+ virJSONValuePtr *props,
|
|
|
d76c62 |
+ bool downstream)
|
|
|
d76c62 |
{
|
|
|
d76c62 |
g_autoptr(virJSONValue) cmd = NULL;
|
|
|
d76c62 |
g_autoptr(virJSONValue) reply = NULL;
|
|
|
d76c62 |
virJSONValuePtr pr = g_steal_pointer(props);
|
|
|
d76c62 |
|
|
|
d76c62 |
- if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", pr)))
|
|
|
d76c62 |
- return -1;
|
|
|
d76c62 |
+ if (downstream) {
|
|
|
d76c62 |
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("x-blockdev-reopen", pr)))
|
|
|
d76c62 |
+ return -1;
|
|
|
d76c62 |
+ } else {
|
|
|
d76c62 |
+ if (!(cmd = qemuMonitorJSONMakeCommandInternal("blockdev-reopen", pr)))
|
|
|
d76c62 |
+ return -1;
|
|
|
d76c62 |
+ }
|
|
|
d76c62 |
|
|
|
d76c62 |
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
|
|
d76c62 |
return -1;
|
|
|
d76c62 |
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
|
|
|
d76c62 |
index 801babef97..38c61a5661 100644
|
|
|
d76c62 |
--- a/src/qemu/qemu_monitor_json.h
|
|
|
d76c62 |
+++ b/src/qemu/qemu_monitor_json.h
|
|
|
d76c62 |
@@ -601,7 +601,8 @@ int qemuMonitorJSONBlockdevAdd(qemuMonitorPtr mon,
|
|
|
d76c62 |
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
d76c62 |
|
|
|
d76c62 |
int qemuMonitorJSONBlockdevReopen(qemuMonitorPtr mon,
|
|
|
d76c62 |
- virJSONValuePtr *props)
|
|
|
d76c62 |
+ virJSONValuePtr *props,
|
|
|
d76c62 |
+ bool downstream)
|
|
|
d76c62 |
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
|
|
|
d76c62 |
|
|
|
d76c62 |
int qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
|
|
|
d76c62 |
--
|
|
|
d76c62 |
2.25.1
|
|
|
d76c62 |
|