libvirt/SOURCES/libvirt-virsh-add-disable-deprecated-features-flag-to-domcapabilities.patch

84 lines
3.1 KiB
Diff

From 16a50b3a73f496be8cd2bb9b9c0b88ca9a84ed0e Mon Sep 17 00:00:00 2001
Message-ID: <16a50b3a73f496be8cd2bb9b9c0b88ca9a84ed0e.1749113304.git.jdenemar@redhat.com>
From: Collin Walling <walling@linux.ibm.com>
Date: Mon, 16 Dec 2024 18:03:57 -0500
Subject: [PATCH] virsh: add --disable-deprecated-features flag to
domcapabilities
Add a new flag, --disable-deprecated-features, to the domcapabilities
command. This will modify the output to show the 'host-model' CPU
with features flagged as deprecated paired with the 'disable' policy.
virsh domcapabilities --disable-deprecated-features
Signed-off-by: Collin Walling <walling@linux.ibm.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 15d45964e453e04f1761e527266af45554f58fcc)
JIRA: https://issues.redhat.com/browse/RHEL-88716
Conflicts:
docs/manpages/virsh.rst
tools/virsh-host.c
(Simple contextual conflicts due to other missing patches in downstream)
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
docs/manpages/virsh.rst | 6 ++++++
tools/virsh-host.c | 9 ++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst
index d24e7774a6..3adbf42280 100644
--- a/docs/manpages/virsh.rst
+++ b/docs/manpages/virsh.rst
@@ -562,6 +562,7 @@ domcapabilities
::
domcapabilities [virttype] [emulatorbin] [arch] [machine]
+ [--disable-deprecated-features]
Print an XML document describing the domain capabilities for the
@@ -596,6 +597,11 @@ supplied along with either the *emulatorbin* or *arch* in order to
generate output for the default *machine*. Supplying a *machine*
value will generate output for the specific machine.
+The **--disable-deprecated-features** argument will modify the contents
+of host-model CPU XML, updating the features list with any features
+flagged as deprecated for the CPU model by the hypervisor. These
+features will be paired with the "disable" policy.
+
pool-capabilities
-----------------
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 5ee3834de2..874875b378 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -91,6 +91,10 @@ static const vshCmdOptDef opts_domcapabilities[] = {
.type = VSH_OT_STRING,
.help = N_("machine type (/domain/os/type/@machine)"),
},
+ {.name = "disable-deprecated-features",
+ .type = VSH_OT_BOOL,
+ .help = N_("report host CPU model with deprecated features disabled"),
+ },
{.name = NULL}
};
@@ -102,9 +106,12 @@ cmdDomCapabilities(vshControl *ctl, const vshCmd *cmd)
const char *emulatorbin = NULL;
const char *arch = NULL;
const char *machine = NULL;
- const unsigned int flags = 0; /* No flags so far */
+ unsigned int flags = 0;
virshControl *priv = ctl->privData;
+ if (vshCommandOptBool(cmd, "disable-deprecated-features"))
+ flags |= VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES;
+
if (vshCommandOptStringReq(ctl, cmd, "virttype", &virttype) < 0 ||
vshCommandOptStringReq(ctl, cmd, "emulatorbin", &emulatorbin) < 0 ||
vshCommandOptStringReq(ctl, cmd, "arch", &arch) < 0 ||
--
2.49.0