forked from rpms/libvirt
import OL libvirt-8.0.0-23.4.0.1.module+el8.10.0+90638+6d8ade84
This commit is contained in:
parent
0c3db8e72e
commit
a32f3c4f37
135
SOURCES/libvirt-conf-add-deprecated_features-attribute.patch
Normal file
135
SOURCES/libvirt-conf-add-deprecated_features-attribute.patch
Normal file
@ -0,0 +1,135 @@
|
||||
From 7a412cc71a4764f7e80bf475c39d999a584f41aa Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <7a412cc71a4764f7e80bf475c39d999a584f41aa.1749113304.git.jdenemar@redhat.com>
|
||||
From: Collin Walling <walling@linux.ibm.com>
|
||||
Date: Mon, 16 Dec 2024 18:03:58 -0500
|
||||
Subject: [PATCH] conf: add deprecated_features attribute
|
||||
|
||||
Add a new a attribute, deprecated_features='on|off' to the <cpu>
|
||||
element. This is used to toggle features flagged as deprecated on the
|
||||
CPU model on or off. When this attribute is paired with 'on',
|
||||
deprecated features will not be filtered. When paired with 'off', any
|
||||
CPU features that are flagged as deprecated will be listed under the
|
||||
CPU model with the 'disable' policy.
|
||||
|
||||
Example:
|
||||
|
||||
<cpu mode='host-model' check='partial' deprecated_features='off'/>
|
||||
|
||||
The absence of this attribute is equivalent to the 'on' option.
|
||||
|
||||
The deprecated features that will populate the domain XML are the same
|
||||
features that result in the virsh domcapabilities command with the
|
||||
--disable-deprecated-features argument present.
|
||||
|
||||
It is recommended to define a domain XML with this attribute set to
|
||||
'off' to ensure migration to machines that may outright drop these
|
||||
features in the future.
|
||||
|
||||
Signed-off-by: Collin Walling <walling@linux.ibm.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 62658bbf060784c757f96c9de3935f27885834aa)
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
||||
Conflicts:
|
||||
src/qemu/qemu_process.c
|
||||
(contextual conflict)
|
||||
tests/*
|
||||
(dropped the changes to these files since they are of no use in
|
||||
downstream - upstream testing code changed too much, so it's
|
||||
not possible to get the related tests to work in downstream)
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
docs/schemas/cputypes.rng | 5 +++++
|
||||
src/conf/cpu_conf.c | 11 +++++++++++
|
||||
src/conf/cpu_conf.h | 1 +
|
||||
src/qemu/qemu_process.c | 11 +++++++++++
|
||||
4 files changed, 28 insertions(+)
|
||||
|
||||
diff --git a/docs/schemas/cputypes.rng b/docs/schemas/cputypes.rng
|
||||
index 056e66e1b4..2d831b423c 100644
|
||||
--- a/docs/schemas/cputypes.rng
|
||||
+++ b/docs/schemas/cputypes.rng
|
||||
@@ -395,6 +395,11 @@
|
||||
<optional>
|
||||
<ref name="cpuCheck"/>
|
||||
</optional>
|
||||
+ <optional>
|
||||
+ <attribute name="deprecated_features">
|
||||
+ <ref name="virOnOff"/>
|
||||
+ </attribute>
|
||||
+ </optional>
|
||||
<optional>
|
||||
<attribute name="migratable">
|
||||
<ref name="virOnOff"/>
|
||||
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
|
||||
index fbceac1657..1db0c978e2 100644
|
||||
--- a/src/conf/cpu_conf.c
|
||||
+++ b/src/conf/cpu_conf.c
|
||||
@@ -238,6 +238,7 @@ virCPUDefCopyWithoutModel(const virCPUDef *cpu)
|
||||
copy->mode = cpu->mode;
|
||||
copy->match = cpu->match;
|
||||
copy->check = cpu->check;
|
||||
+ copy->deprecated_feats = cpu->deprecated_feats;
|
||||
copy->fallback = cpu->fallback;
|
||||
copy->sockets = cpu->sockets;
|
||||
copy->dies = cpu->dies;
|
||||
@@ -431,6 +432,11 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
|
||||
if (virXMLPropEnum(ctxt->node, "check", virCPUCheckTypeFromString,
|
||||
VIR_XML_PROP_NONE, &def->check) < 0)
|
||||
return -1;
|
||||
+
|
||||
+ if (virXMLPropTristateSwitch(ctxt->node, "deprecated_features",
|
||||
+ VIR_XML_PROP_NONE,
|
||||
+ &def->deprecated_feats) < 0)
|
||||
+ return -1;
|
||||
}
|
||||
|
||||
if (def->type == VIR_CPU_TYPE_HOST) {
|
||||
@@ -707,6 +713,11 @@ virCPUDefFormatBufFull(virBuffer *buf,
|
||||
virBufferAsprintf(&attributeBuf, " migratable='%s'",
|
||||
virTristateSwitchTypeToString(def->migratable));
|
||||
}
|
||||
+
|
||||
+ if (def->deprecated_feats) {
|
||||
+ virBufferAsprintf(&attributeBuf, " deprecated_features='%s'",
|
||||
+ virTristateSwitchTypeToString(def->deprecated_feats));
|
||||
+ }
|
||||
}
|
||||
|
||||
/* Format children */
|
||||
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
|
||||
index b0a81895be..a69ff724ca 100644
|
||||
--- a/src/conf/cpu_conf.h
|
||||
+++ b/src/conf/cpu_conf.h
|
||||
@@ -140,6 +140,7 @@ struct _virCPUDef {
|
||||
virCPUCacheDef *cache;
|
||||
virHostCPUTscInfo *tsc;
|
||||
virTristateSwitch migratable; /* for host-passthrough mode */
|
||||
+ virTristateSwitch deprecated_feats;
|
||||
};
|
||||
|
||||
virCPUDef *virCPUDefNew(void);
|
||||
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
||||
index 73d54f01cd..54afcbe53e 100644
|
||||
--- a/src/qemu/qemu_process.c
|
||||
+++ b/src/qemu/qemu_process.c
|
||||
@@ -6143,6 +6143,17 @@ qemuProcessUpdateGuestCPU(virDomainDef *def,
|
||||
return -1;
|
||||
}
|
||||
|
||||
+ if (def->cpu->deprecated_feats &&
|
||||
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS)) {
|
||||
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
+ _("toggling deprecated features for CPU model is unsupported"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ if (def->cpu->deprecated_feats == VIR_TRISTATE_SWITCH_OFF) {
|
||||
+ virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, def->virtType, def->cpu);
|
||||
+ }
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.49.0
|
@ -0,0 +1,58 @@
|
||||
From a47232facc446039ed509100f80ebb7de621fffa Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <a47232facc446039ed509100f80ebb7de621fffa.1749113303.git.jdenemar@redhat.com>
|
||||
From: Collin Walling <walling@linux.ibm.com>
|
||||
Date: Mon, 16 Dec 2024 18:03:55 -0500
|
||||
Subject: [PATCH] libvirt-domain: introduce
|
||||
VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES
|
||||
|
||||
Introduce domain flag used to filter deprecated features from the
|
||||
domain's CPU model.
|
||||
|
||||
Signed-off-by: Collin Walling <walling@linux.ibm.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 4e2c8de2047e21d98443944a2bfe94529b269efa)
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
include/libvirt/libvirt-domain.h | 12 ++++++++++++
|
||||
src/libvirt-domain.c | 2 +-
|
||||
2 files changed, 13 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
|
||||
index 792973ce2d..d3101b112b 100644
|
||||
--- a/include/libvirt/libvirt-domain.h
|
||||
+++ b/include/libvirt/libvirt-domain.h
|
||||
@@ -1160,6 +1160,18 @@ int virDomainMigrateGetMaxSpeed(virDomainPtr domain,
|
||||
int virDomainMigrateStartPostCopy(virDomainPtr domain,
|
||||
unsigned int flags);
|
||||
|
||||
+/**
|
||||
+ * virConnectGetDomainCapabilitiesFlags:
|
||||
+ *
|
||||
+ * Domain capabilities flags.
|
||||
+ *
|
||||
+ * Since: 11.0.0
|
||||
+ */
|
||||
+typedef enum {
|
||||
+ /* Report host model with deprecated features disabled. (Since: 11.0.0) */
|
||||
+ VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES = (1 << 0),
|
||||
+} virConnectGetDomainCapabilitiesFlags;
|
||||
+
|
||||
char * virConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
const char *emulatorbin,
|
||||
const char *arch,
|
||||
diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
|
||||
index 5912551a49..7083f10f04 100644
|
||||
--- a/src/libvirt-domain.c
|
||||
+++ b/src/libvirt-domain.c
|
||||
@@ -11573,7 +11573,7 @@ virDomainSetUserPassword(virDomainPtr dom,
|
||||
* @arch: domain architecture
|
||||
* @machine: machine type
|
||||
* @virttype: virtualization type
|
||||
- * @flags: extra flags; not used yet, so callers should always pass 0
|
||||
+ * @flags: extra flags; bitwise-OR of virConnectGetDomainCapabilitiesFlags
|
||||
*
|
||||
* Prior creating a domain (for instance via virDomainCreateXML
|
||||
* or virDomainDefineXML) it may be suitable to know what the
|
||||
--
|
||||
2.49.0
|
@ -0,0 +1,214 @@
|
||||
From 5289208127468cd34b5cb6ea7bb45bbeff45d537 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <5289208127468cd34b5cb6ea7bb45bbeff45d537.1749113303.git.jdenemar@redhat.com>
|
||||
From: Collin Walling <walling@linux.ibm.com>
|
||||
Date: Mon, 16 Dec 2024 18:03:53 -0500
|
||||
Subject: [PATCH] qemu: parse deprecated-props from query-cpu-model-expansion
|
||||
response
|
||||
|
||||
query-cpu-model-expansion may report an array of deprecated properties.
|
||||
This array is optional, and may not be supported for a particular
|
||||
architecture or reported for a particular CPU model. If the output is
|
||||
present, then capture it and store in a qemuMonitorCPUModelInfo struct
|
||||
for later use.
|
||||
|
||||
The deprecated features will be retained in qemuCaps->kvm->hostCPU.info
|
||||
and will be stored in the capabilities cache file under the <hostCPU>
|
||||
element using the following format:
|
||||
|
||||
<deprecatedFeatures>
|
||||
<property name='bpb'/>
|
||||
<property name='csske'/>
|
||||
<property name='cte'/>
|
||||
<property name='te'/>
|
||||
</deprecatedFeatures>
|
||||
|
||||
At this time the data is only queried, parsed, and cached. The data
|
||||
will be utilized in a subsequent patch.
|
||||
|
||||
Signed-off-by: Collin Walling <walling@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 45140d293007c1b29f7563bf6ee9640e27769b96)
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
||||
Conflicts:
|
||||
tests/qemucapabilitiesdata/caps_9.1.0.s390x.xml
|
||||
tests/qemucapabilitiesdata/caps_9.2.0.s390x.xml
|
||||
(dropped the changes to these files since they are of no use in
|
||||
downstream - upstream testing code changed too much, so it's
|
||||
not possible to get the related tests to work in downstream)
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 31 +++++++++++++++++++++++++++++++
|
||||
src/qemu/qemu_monitor.c | 3 +++
|
||||
src/qemu/qemu_monitor.h | 1 +
|
||||
src/qemu/qemu_monitor_json.c | 18 ++++++++++++++++++
|
||||
4 files changed, 53 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index c4f7db55c8..d616273406 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -3766,6 +3766,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps,
|
||||
{
|
||||
g_autofree char *migratability = NULL;
|
||||
xmlNodePtr hostCPUNode;
|
||||
+ xmlNodePtr deprecated_props;
|
||||
g_autofree xmlNodePtr *nodes = NULL;
|
||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||
g_autoptr(qemuMonitorCPUModelInfo) hostCPU = NULL;
|
||||
@@ -3870,6 +3871,24 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps,
|
||||
}
|
||||
}
|
||||
|
||||
+ ctxt->node = hostCPUNode;
|
||||
+
|
||||
+ if ((deprecated_props = virXPathNode("./deprecatedFeatures", ctxt))) {
|
||||
+ g_autoptr(GPtrArray) props = virXMLNodeGetSubelementList(deprecated_props, NULL);
|
||||
+
|
||||
+ hostCPU->deprecated_props = g_new0(char *, props->len + 1);
|
||||
+
|
||||
+ for (i = 0; i < props->len; i++) {
|
||||
+ xmlNodePtr prop = g_ptr_array_index(props, i);
|
||||
+
|
||||
+ if (!(hostCPU->deprecated_props[i] = virXMLPropString(prop, "name"))) {
|
||||
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
+ _("missing 'name' attribute for a host CPU model deprecated property in QEMU capabilities cache"));
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
caps->hostCPU.info = g_steal_pointer(&hostCPU);
|
||||
return 0;
|
||||
}
|
||||
@@ -4500,6 +4519,18 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccel *caps,
|
||||
virBufferAddLit(buf, "/>\n");
|
||||
}
|
||||
|
||||
+ if (model->deprecated_props) {
|
||||
+ virBufferAddLit(buf, "<deprecatedFeatures>\n");
|
||||
+ virBufferAdjustIndent(buf, 2);
|
||||
+
|
||||
+ for (i = 0; i < g_strv_length(model->deprecated_props); i++)
|
||||
+ virBufferAsprintf(buf, "<property name='%s'/>\n",
|
||||
+ model->deprecated_props[i]);
|
||||
+
|
||||
+ virBufferAdjustIndent(buf, -2);
|
||||
+ virBufferAddLit(buf, "</deprecatedFeatures>\n");
|
||||
+ }
|
||||
+
|
||||
virBufferAdjustIndent(buf, -2);
|
||||
virBufferAddLit(buf, "</hostCPU>\n");
|
||||
}
|
||||
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
|
||||
index 99667fdf2f..8f72fc5bd9 100644
|
||||
--- a/src/qemu/qemu_monitor.c
|
||||
+++ b/src/qemu/qemu_monitor.c
|
||||
@@ -3487,6 +3487,7 @@ qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfo *model_info)
|
||||
g_free(model_info->props[i].value.string);
|
||||
}
|
||||
|
||||
+ g_strfreev(model_info->deprecated_props);
|
||||
g_free(model_info->props);
|
||||
g_free(model_info->name);
|
||||
g_free(model_info);
|
||||
@@ -3531,6 +3532,8 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig)
|
||||
}
|
||||
}
|
||||
|
||||
+ copy->deprecated_props = g_strdupv(orig->deprecated_props);
|
||||
+
|
||||
return copy;
|
||||
}
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
|
||||
index d00967d84f..5b9ea336ec 100644
|
||||
--- a/src/qemu/qemu_monitor.h
|
||||
+++ b/src/qemu/qemu_monitor.h
|
||||
@@ -1238,6 +1238,7 @@ struct _qemuMonitorCPUModelInfo {
|
||||
char *name;
|
||||
size_t nprops;
|
||||
qemuMonitorCPUProperty *props;
|
||||
+ GStrv deprecated_props;
|
||||
bool migratability;
|
||||
};
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
||||
index 487f8028d9..9a3ca3d186 100644
|
||||
--- a/src/qemu/qemu_monitor_json.c
|
||||
+++ b/src/qemu/qemu_monitor_json.c
|
||||
@@ -5500,6 +5500,7 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data,
|
||||
bool fail_no_props,
|
||||
virJSONValue **cpu_model,
|
||||
virJSONValue **cpu_props,
|
||||
+ virJSONValue **cpu_deprecated_props,
|
||||
const char **cpu_name)
|
||||
{
|
||||
if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion",
|
||||
@@ -5507,6 +5508,12 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data,
|
||||
cpu_name) < 0)
|
||||
return -1;
|
||||
|
||||
+ /*
|
||||
+ * Unconditionally check for the deprecated-props array, as
|
||||
+ * it is not a guarantee response even if QEMU supports it.
|
||||
+ */
|
||||
+ *cpu_deprecated_props = virJSONValueObjectGetArray(data, "deprecated-props");
|
||||
+
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5514,6 +5521,7 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data,
|
||||
static int
|
||||
qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name,
|
||||
virJSONValue *cpu_props,
|
||||
+ virJSONValue *cpu_deprecated_props,
|
||||
qemuMonitorCPUModelInfo **model_info)
|
||||
{
|
||||
g_autoptr(qemuMonitorCPUModelInfo) expanded_model = NULL;
|
||||
@@ -5521,6 +5529,12 @@ qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name,
|
||||
if (qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, &expanded_model) < 0)
|
||||
return -1;
|
||||
|
||||
+ if (cpu_deprecated_props &&
|
||||
+ virJSONValueArraySize(cpu_deprecated_props) &&
|
||||
+ (!(expanded_model->deprecated_props = virJSONValueArrayToStringList(cpu_deprecated_props)))) {
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
*model_info = g_steal_pointer(&expanded_model);
|
||||
return 0;
|
||||
}
|
||||
@@ -5584,6 +5598,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
||||
g_autoptr(virJSONValue) fullData = NULL;
|
||||
virJSONValue *cpu_model;
|
||||
virJSONValue *cpu_props = NULL;
|
||||
+ virJSONValue *cpu_deprecated_props = NULL;
|
||||
const char *cpu_name = "";
|
||||
int rc;
|
||||
|
||||
@@ -5597,6 +5612,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
||||
|
||||
if (qemuMonitorJSONParseCPUModelExpansionData(data, fail_no_props,
|
||||
&cpu_model, &cpu_props,
|
||||
+ &cpu_deprecated_props,
|
||||
&cpu_name) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -5615,11 +5631,13 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
||||
|
||||
if (qemuMonitorJSONParseCPUModelExpansionData(fullData, fail_no_props,
|
||||
&cpu_model, &cpu_props,
|
||||
+ &cpu_deprecated_props,
|
||||
&cpu_name) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return qemuMonitorJSONParseCPUModelExpansion(cpu_name, cpu_props,
|
||||
+ cpu_deprecated_props,
|
||||
model_info);
|
||||
}
|
||||
|
||||
--
|
||||
2.49.0
|
@ -0,0 +1,100 @@
|
||||
From ed03cdb563ee30bff2f4f8a66f7778b5e55a4683 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <ed03cdb563ee30bff2f4f8a66f7778b5e55a4683.1749113303.git.jdenemar@redhat.com>
|
||||
From: Collin Walling <walling@linux.ibm.com>
|
||||
Date: Mon, 16 Dec 2024 18:03:52 -0500
|
||||
Subject: [PATCH] qemuMonitorJSONGetCPUModelExpansion: refactor parsing
|
||||
functions
|
||||
|
||||
Refactor the CPU Model parsing functions within
|
||||
qemuMonitorJSONGetCPUModelExpansion. The new functions,
|
||||
qemuMonitorJSONParseCPUModelExpansionData and
|
||||
qemuMonitorJSONParseCPUModelExpansion invoke the functions they
|
||||
replace and leave room for a subsequent patch to handle parsing the
|
||||
(optional) deprecated_props field resulting from the command.
|
||||
|
||||
Signed-off-by: Collin Walling <walling@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 60e407deb5cd88e5f1564d1c9145e374001cf34f)
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_monitor_json.c | 46 ++++++++++++++++++++++++++++++------
|
||||
1 file changed, 39 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
|
||||
index 789554e225..487f8028d9 100644
|
||||
--- a/src/qemu/qemu_monitor_json.c
|
||||
+++ b/src/qemu/qemu_monitor_json.c
|
||||
@@ -5495,6 +5495,37 @@ qemuMonitorJSONParseCPUModel(const char *cpu_name,
|
||||
}
|
||||
|
||||
|
||||
+static int
|
||||
+qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data,
|
||||
+ bool fail_no_props,
|
||||
+ virJSONValue **cpu_model,
|
||||
+ virJSONValue **cpu_props,
|
||||
+ const char **cpu_name)
|
||||
+{
|
||||
+ if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion",
|
||||
+ fail_no_props, cpu_model, cpu_props,
|
||||
+ cpu_name) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
+static int
|
||||
+qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name,
|
||||
+ virJSONValue *cpu_props,
|
||||
+ qemuMonitorCPUModelInfo **model_info)
|
||||
+{
|
||||
+ g_autoptr(qemuMonitorCPUModelInfo) expanded_model = NULL;
|
||||
+
|
||||
+ if (qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, &expanded_model) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ *model_info = g_steal_pointer(&expanded_model);
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
qemuMonitorJSONQueryCPUModelExpansionOne(qemuMonitor *mon,
|
||||
qemuMonitorCPUModelExpansionType type,
|
||||
@@ -5564,9 +5595,9 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
||||
if ((rc = qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &model, &data)) <= 0)
|
||||
return rc;
|
||||
|
||||
- if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion",
|
||||
- fail_no_props, &cpu_model, &cpu_props,
|
||||
- &cpu_name) < 0)
|
||||
+ if (qemuMonitorJSONParseCPUModelExpansionData(data, fail_no_props,
|
||||
+ &cpu_model, &cpu_props,
|
||||
+ &cpu_name) < 0)
|
||||
return -1;
|
||||
|
||||
/* QEMU_MONITOR_CPU_MODEL_EXPANSION_STATIC_FULL requests "full" expansion
|
||||
@@ -5582,13 +5613,14 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
||||
if ((rc = qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &fullModel, &fullData)) <= 0)
|
||||
return rc;
|
||||
|
||||
- if (qemuMonitorJSONParseCPUModelData(fullData, "query-cpu-model-expansion",
|
||||
- fail_no_props, &cpu_model, &cpu_props,
|
||||
- &cpu_name) < 0)
|
||||
+ if (qemuMonitorJSONParseCPUModelExpansionData(fullData, fail_no_props,
|
||||
+ &cpu_model, &cpu_props,
|
||||
+ &cpu_name) < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
- return qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, model_info);
|
||||
+ return qemuMonitorJSONParseCPUModelExpansion(cpu_name, cpu_props,
|
||||
+ model_info);
|
||||
}
|
||||
|
||||
|
||||
--
|
||||
2.49.0
|
@ -0,0 +1,95 @@
|
||||
From 59ec9c201e8849f7231557c6019e1fabd0893240 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <59ec9c201e8849f7231557c6019e1fabd0893240.1749113303.git.jdenemar@redhat.com>
|
||||
From: Collin Walling <walling@linux.ibm.com>
|
||||
Date: Mon, 16 Dec 2024 18:03:56 -0500
|
||||
Subject: [PATCH] qemu_capabilities: filter deprecated features if requested
|
||||
|
||||
If flag VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES
|
||||
is passed to qemuConnectGetDomainCapabilities, then the domain's CPU
|
||||
model features will be updated to set any deprecated features to the
|
||||
'disabled' policy.
|
||||
|
||||
Signed-off-by: Collin Walling <walling@linux.ibm.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit cd1e837c22182dcadfe17b469c931f9fc9745a46)
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 20 ++++++++++++++++++++
|
||||
src/qemu/qemu_capabilities.h | 3 +++
|
||||
src/qemu/qemu_driver.c | 8 +++++++-
|
||||
3 files changed, 30 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index 98773d2a0a..389b43ab3d 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -3152,6 +3152,26 @@ virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps,
|
||||
}
|
||||
|
||||
|
||||
+void
|
||||
+virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps,
|
||||
+ virDomainVirtType virtType,
|
||||
+ virCPUDef *cpu)
|
||||
+{
|
||||
+ qemuMonitorCPUModelInfo *modelInfo;
|
||||
+ size_t i;
|
||||
+
|
||||
+ modelInfo = virQEMUCapsGetCPUModelInfo(qemuCaps, virtType);
|
||||
+
|
||||
+ if (!modelInfo || !modelInfo->deprecated_props)
|
||||
+ return;
|
||||
+
|
||||
+ for (i = 0; i < g_strv_length(modelInfo->deprecated_props); i++) {
|
||||
+ virCPUDefUpdateFeature(cpu, modelInfo->deprecated_props[i],
|
||||
+ VIR_CPU_FEATURE_DISABLE);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+
|
||||
struct tpmTypeToCaps {
|
||||
int type;
|
||||
virQEMUCapsFlags caps;
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index 4a7fb2c726..249adf66fa 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -702,6 +702,9 @@ int virQEMUCapsGetCPUFeatures(virQEMUCaps *qemuCaps,
|
||||
virDomainVirtType virtType,
|
||||
bool migratable,
|
||||
char ***features);
|
||||
+void virQEMUCapsUpdateCPUDeprecatedFeatures(virQEMUCaps *qemuCaps,
|
||||
+ virDomainVirtType virtType,
|
||||
+ virCPUDef *cpu);
|
||||
|
||||
virDomainVirtType virQEMUCapsGetVirtType(virQEMUCaps *qemuCaps);
|
||||
|
||||
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
||||
index d3d76c003f..315abe57b0 100644
|
||||
--- a/src/qemu/qemu_driver.c
|
||||
+++ b/src/qemu/qemu_driver.c
|
||||
@@ -17383,7 +17383,8 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
virDomainVirtType virttype;
|
||||
g_autoptr(virDomainCaps) domCaps = NULL;
|
||||
|
||||
- virCheckFlags(0, NULL);
|
||||
+ virCheckFlags(VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES,
|
||||
+ NULL);
|
||||
|
||||
if (virConnectGetDomainCapabilitiesEnsureACL(conn) < 0)
|
||||
return NULL;
|
||||
@@ -17402,6 +17403,11 @@ qemuConnectGetDomainCapabilities(virConnectPtr conn,
|
||||
arch, virttype)))
|
||||
return NULL;
|
||||
|
||||
+ if (flags & VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES) {
|
||||
+ virQEMUCapsUpdateCPUDeprecatedFeatures(qemuCaps, virttype,
|
||||
+ domCaps->cpu.hostModel);
|
||||
+ }
|
||||
+
|
||||
return virDomainCapsFormat(domCaps);
|
||||
}
|
||||
|
||||
--
|
||||
2.49.0
|
@ -0,0 +1,128 @@
|
||||
From 4ad452d843406b9bb8423a47987f4180d565f11a Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <4ad452d843406b9bb8423a47987f4180d565f11a.1749113303.git.jdenemar@redhat.com>
|
||||
From: Collin Walling <walling@linux.ibm.com>
|
||||
Date: Mon, 16 Dec 2024 18:03:54 -0500
|
||||
Subject: [PATCH] qemu_capabilities: query deprecated features for host-model
|
||||
|
||||
Add QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS for detecting
|
||||
if query-cpu-model-expansion can report deprecated CPU model properties.
|
||||
QEMU introduced this capability in 9.1 release. Add flag and deprecated
|
||||
features to the capabilities test data for QEMU 9.1 and 9.2 replies/XML
|
||||
since it can now be accounted for.
|
||||
|
||||
When probing for the host CPU, perform a full CPU model expansion to
|
||||
retrieve the list of features deprecated across the entire architecture.
|
||||
The list and count are stored in the host's CPU model info within the
|
||||
QEMU capabilities. Other info resulting from this query (e.g. model
|
||||
name, etc) is ignored.
|
||||
|
||||
The new capabilities flag is used to fence off the extra query for
|
||||
architectures/QEMU binaries that do not report deprecated CPU model
|
||||
features.
|
||||
|
||||
Signed-off-by: Collin Walling <walling@linux.ibm.com>
|
||||
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
|
||||
(cherry picked from commit 51c098347d7f2af9b4386ac0adc4431997d06f3d)
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
||||
Conflicts:
|
||||
src/qemu/qemu_capabilities.c
|
||||
src/qemu/qemu_capabilities.h
|
||||
(Contextual conflicts due to missing other patches in downstream
|
||||
and qemuMonitorGetCPUModelExpansion() having one parameter less
|
||||
in downstream)
|
||||
tests/qemucapabilitiesdata/caps_9.*
|
||||
(dropped the changes to these files since they are of no use in
|
||||
downstream - upstream testing code changed too much, so it's
|
||||
not possible to get the related tests to work in downstream)
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/qemu/qemu_capabilities.c | 38 ++++++++++++++++++++++++++++++++++++
|
||||
src/qemu/qemu_capabilities.h | 1 +
|
||||
2 files changed, 39 insertions(+)
|
||||
|
||||
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
|
||||
index d616273406..98773d2a0a 100644
|
||||
--- a/src/qemu/qemu_capabilities.c
|
||||
+++ b/src/qemu/qemu_capabilities.c
|
||||
@@ -658,6 +658,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
|
||||
/* 420 */
|
||||
"blockdev-reopen.__com.redhat_rhel-av-8_2_0-api", /* QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API */
|
||||
"memory-backend-file.prealloc-threads", /* QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS */
|
||||
+ "query-cpu-model-expansion.deprecated-props", /* QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS */
|
||||
);
|
||||
|
||||
|
||||
@@ -1579,6 +1580,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
|
||||
{ "screendump/arg-type/device", QEMU_CAPS_SCREENDUMP_DEVICE },
|
||||
{ "set-numa-node/arg-type/+hmat-lb", QEMU_CAPS_NUMA_HMAT },
|
||||
{ "object-add/arg-type/+sev-guest/kernel-hashes", QEMU_CAPS_SEV_GUEST_KERNEL_HASHES },
|
||||
+ { "query-cpu-model-expansion/ret-type/deprecated-props", QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS },
|
||||
};
|
||||
|
||||
typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps;
|
||||
@@ -2982,6 +2984,38 @@ virQEMUCapsProbeCPUDefinitionsTest(virQEMUCaps *qemuCaps,
|
||||
}
|
||||
|
||||
|
||||
+/**
|
||||
+ * virQEMUCapsProbeFullDeprecatedProperties
|
||||
+ * @mon: QEMU monitor
|
||||
+ * @cpu: CPU definition to be expanded
|
||||
+ * @props: the array to be filled with deprecated features
|
||||
+ *
|
||||
+ * Performs a full CPU model expansion to retrieve an array of deprecated
|
||||
+ * properties. If the expansion succeeds, then data previously stored in
|
||||
+ * @props is freed.
|
||||
+ *
|
||||
+ * Returns: -1 if the expansion failed; otherwise 0.
|
||||
+ */
|
||||
+static int
|
||||
+virQEMUCapsProbeFullDeprecatedProperties(qemuMonitor *mon,
|
||||
+ virCPUDef *cpu,
|
||||
+ GStrv *props)
|
||||
+{
|
||||
+ g_autoptr(qemuMonitorCPUModelInfo) propsInfo = NULL;
|
||||
+
|
||||
+ if (qemuMonitorGetCPUModelExpansion(mon, QEMU_MONITOR_CPU_MODEL_EXPANSION_FULL,
|
||||
+ cpu, true, false, &propsInfo) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
+ if (propsInfo && propsInfo->deprecated_props) {
|
||||
+ g_free(*props);
|
||||
+ *props = g_steal_pointer(&propsInfo->deprecated_props);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static int
|
||||
virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps,
|
||||
virQEMUCapsAccel *accel,
|
||||
@@ -3065,6 +3099,10 @@ virQEMUCapsProbeQMPHostCPU(virQEMUCaps *qemuCaps,
|
||||
modelInfo->migratability = true;
|
||||
}
|
||||
|
||||
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS) &&
|
||||
+ virQEMUCapsProbeFullDeprecatedProperties(mon, cpu, &modelInfo->deprecated_props) < 0)
|
||||
+ return -1;
|
||||
+
|
||||
accel->hostCPU.info = g_steal_pointer(&modelInfo);
|
||||
return 0;
|
||||
}
|
||||
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
|
||||
index 8e65635e0d..4a7fb2c726 100644
|
||||
--- a/src/qemu/qemu_capabilities.h
|
||||
+++ b/src/qemu/qemu_capabilities.h
|
||||
@@ -637,6 +637,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
|
||||
/* 420 */
|
||||
QEMU_CAPS_BLOCKDEV_REOPEN_COM_REDHAT_AV_8_2_0_API, /* downstream support for blockdev reopen in rhel-av-8.2.0 */
|
||||
QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS, /* -object memory-backend-*.prealloc-threads */
|
||||
+ QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION_DEPRECATED_PROPS, /* query-cpu-model-expansion may report deprecated CPU properties */
|
||||
|
||||
QEMU_CAPS_LAST /* this must always be the last item */
|
||||
} virQEMUCapsFlags;
|
||||
--
|
||||
2.49.0
|
@ -0,0 +1,104 @@
|
||||
From 534bb6a049e7ad227d143457ddcfe828238cea18 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <534bb6a049e7ad227d143457ddcfe828238cea18.1749113303.git.jdenemar@redhat.com>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Mon, 13 Feb 2023 15:53:23 +0100
|
||||
Subject: [PATCH] util: xml: Introduce virXMLNodeGetSubelementList
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The new helper is similar to virXPathNodeSet list but for cases where we
|
||||
want to get subelements directly rather than using XPath.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit dcd49d2cd65c9fe58d3df536fa258fc70c633d7e)
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
||||
Conflicts:
|
||||
Trivial contextual conflicts in all files
|
||||
(due to missing other patches in downstream)
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/libvirt_private.syms | 1 +
|
||||
src/util/virxml.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
src/util/virxml.h | 6 ++++++
|
||||
3 files changed, 42 insertions(+)
|
||||
|
||||
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
||||
index 7c558ad364..3af1b33a6c 100644
|
||||
--- a/src/libvirt_private.syms
|
||||
+++ b/src/libvirt_private.syms
|
||||
@@ -3619,6 +3619,7 @@ virXMLFormatElementEmpty;
|
||||
virXMLFormatMetadata;
|
||||
virXMLNewNode;
|
||||
virXMLNodeContentString;
|
||||
+virXMLNodeGetSubelementList;
|
||||
virXMLNodeNameEqual;
|
||||
virXMLNodeSanitizeNamespaces;
|
||||
virXMLNodeToString;
|
||||
diff --git a/src/util/virxml.c b/src/util/virxml.c
|
||||
index 4b09374107..b57462e2d0 100644
|
||||
--- a/src/util/virxml.c
|
||||
+++ b/src/util/virxml.c
|
||||
@@ -838,6 +838,41 @@ virXPathBoolean(const char *xpath,
|
||||
return obj->boolval;
|
||||
}
|
||||
|
||||
+
|
||||
+/**
|
||||
+ * virXMLNodeGetSubelementList:
|
||||
+ * @node: node to get subelement of
|
||||
+ * @name: name of subelement to fetch (NULL to fetch all sub-elements)
|
||||
+ * @list: If non-NULL, filled with a list of pointers to the nodes. Caller is
|
||||
+ * responsible for freeing the list but not the members.
|
||||
+ *
|
||||
+ * Find and return a sub-elements node of @node named @name in a list.
|
||||
+ * Returns the number of subelements with @name
|
||||
+ */
|
||||
+size_t
|
||||
+virXMLNodeGetSubelementList(xmlNodePtr node,
|
||||
+ const char *name,
|
||||
+ xmlNodePtr **list)
|
||||
+{
|
||||
+ xmlNodePtr n;
|
||||
+ size_t nelems = 0;
|
||||
+
|
||||
+ for (n = node->children; n; n = n->next) {
|
||||
+ if (n->type == XML_ELEMENT_NODE) {
|
||||
+ if (name && !virXMLNodeNameEqual(n, name))
|
||||
+ continue;
|
||||
+
|
||||
+ if (list)
|
||||
+ VIR_APPEND_ELEMENT_COPY(*list, nelems, n);
|
||||
+ else
|
||||
+ nelems++;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return nelems;
|
||||
+}
|
||||
+
|
||||
+
|
||||
/**
|
||||
* virXPathNode:
|
||||
* @xpath: the XPath string to evaluate
|
||||
diff --git a/src/util/virxml.h b/src/util/virxml.h
|
||||
index c39eae6282..7b60551898 100644
|
||||
--- a/src/util/virxml.h
|
||||
+++ b/src/util/virxml.h
|
||||
@@ -83,6 +83,12 @@ int
|
||||
virXPathULongHex(const char *xpath,
|
||||
xmlXPathContextPtr ctxt,
|
||||
unsigned long *value);
|
||||
+
|
||||
+size_t
|
||||
+virXMLNodeGetSubelementList(xmlNodePtr node,
|
||||
+ const char *name,
|
||||
+ xmlNodePtr **list);
|
||||
+
|
||||
xmlNodePtr
|
||||
virXPathNode(const char *xpath,
|
||||
xmlXPathContextPtr ctxt);
|
||||
--
|
||||
2.49.0
|
@ -0,0 +1,92 @@
|
||||
From f3c75e44ad85fb01473c78adfc2a6d2c53f4f358 Mon Sep 17 00:00:00 2001
|
||||
Message-ID: <f3c75e44ad85fb01473c78adfc2a6d2c53f4f358.1749113303.git.jdenemar@redhat.com>
|
||||
From: Peter Krempa <pkrempa@redhat.com>
|
||||
Date: Mon, 13 Feb 2023 15:53:23 +0100
|
||||
Subject: [PATCH] util: xml: Return GPtrArray from virXMLNodeGetSubelement
|
||||
[partial]
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Rework the helper to use a GPtrArray structure to simplify callers.
|
||||
|
||||
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
|
||||
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
||||
(cherry picked from commit 08a7fc834c7c505e73bfcfa11c4a841a972d4f5d)
|
||||
|
||||
JIRA: https://issues.redhat.com/browse/RHEL-88716
|
||||
Conflicts:
|
||||
src/conf/*.c
|
||||
Dropped the hunks that modify the callers
|
||||
(since these are not available in downstream yet)
|
||||
Signed-off-by: Thomas Huth <thuth@redhat.com>
|
||||
---
|
||||
src/util/virxml.c | 21 ++++++++-------------
|
||||
src/util/virxml.h | 5 ++---
|
||||
2 files changed, 10 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/src/util/virxml.c b/src/util/virxml.c
|
||||
index b57462e2d0..46afcf2146 100644
|
||||
--- a/src/util/virxml.c
|
||||
+++ b/src/util/virxml.c
|
||||
@@ -843,33 +843,28 @@ virXPathBoolean(const char *xpath,
|
||||
* virXMLNodeGetSubelementList:
|
||||
* @node: node to get subelement of
|
||||
* @name: name of subelement to fetch (NULL to fetch all sub-elements)
|
||||
- * @list: If non-NULL, filled with a list of pointers to the nodes. Caller is
|
||||
- * responsible for freeing the list but not the members.
|
||||
*
|
||||
- * Find and return a sub-elements node of @node named @name in a list.
|
||||
- * Returns the number of subelements with @name
|
||||
+ * Find and return a sub-elements node of @node named @name in a GPtrArray
|
||||
+ * populated with the xmlNodePtr objects. Caller is responsible for freeing the
|
||||
+ * array but not the contained xmlNode objects.
|
||||
*/
|
||||
-size_t
|
||||
+GPtrArray *
|
||||
virXMLNodeGetSubelementList(xmlNodePtr node,
|
||||
- const char *name,
|
||||
- xmlNodePtr **list)
|
||||
+ const char *name)
|
||||
{
|
||||
+ GPtrArray *ret = g_ptr_array_new();
|
||||
xmlNodePtr n;
|
||||
- size_t nelems = 0;
|
||||
|
||||
for (n = node->children; n; n = n->next) {
|
||||
if (n->type == XML_ELEMENT_NODE) {
|
||||
if (name && !virXMLNodeNameEqual(n, name))
|
||||
continue;
|
||||
|
||||
- if (list)
|
||||
- VIR_APPEND_ELEMENT_COPY(*list, nelems, n);
|
||||
- else
|
||||
- nelems++;
|
||||
+ g_ptr_array_add(ret, n);
|
||||
}
|
||||
}
|
||||
|
||||
- return nelems;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
|
||||
diff --git a/src/util/virxml.h b/src/util/virxml.h
|
||||
index 7b60551898..03677afc33 100644
|
||||
--- a/src/util/virxml.h
|
||||
+++ b/src/util/virxml.h
|
||||
@@ -84,10 +84,9 @@ virXPathULongHex(const char *xpath,
|
||||
xmlXPathContextPtr ctxt,
|
||||
unsigned long *value);
|
||||
|
||||
-size_t
|
||||
+GPtrArray *
|
||||
virXMLNodeGetSubelementList(xmlNodePtr node,
|
||||
- const char *name,
|
||||
- xmlNodePtr **list);
|
||||
+ const char *name);
|
||||
|
||||
xmlNodePtr
|
||||
virXPathNode(const char *xpath,
|
||||
--
|
||||
2.49.0
|
@ -0,0 +1,83 @@
|
||||
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
|
@ -210,7 +210,7 @@
|
||||
Summary: Library providing a simple virtualization API
|
||||
Name: libvirt
|
||||
Version: 8.0.0
|
||||
Release: 23.3%{?dist}%{?extra_release}
|
||||
Release: 23.4.0.1%{?dist}%{?extra_release}
|
||||
License: LGPLv2+
|
||||
URL: https://libvirt.org/
|
||||
|
||||
@ -322,6 +322,15 @@ Patch99: libvirt-remote-check-for-negative-array-lengths-before-allocation.patch
|
||||
Patch100: libvirt-util-Fix-error-return-for-virProcessKillPainfullyDelay.patch
|
||||
Patch101: libvirt-rpc-ensure-temporary-GSource-is-removed-from-client-event-loop.patch
|
||||
Patch102: libvirt-virStorageBackendLogicalCheckPool-Properly-mark-empty-logical-pools-as-active.patch
|
||||
Patch103: libvirt-util-xml-Introduce-virXMLNodeGetSubelementList.patch
|
||||
Patch104: libvirt-util-xml-Return-GPtrArray-from-virXMLNodeGetSubelement-partial.patch
|
||||
Patch105: libvirt-qemuMonitorJSONGetCPUModelExpansion-refactor-parsing-functions.patch
|
||||
Patch106: libvirt-qemu-parse-deprecated-props-from-query-cpu-model-expansion-response.patch
|
||||
Patch107: libvirt-qemu_capabilities-query-deprecated-features-for-host-model.patch
|
||||
Patch108: libvirt-libvirt-domain-introduce-VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES.patch
|
||||
Patch109: libvirt-qemu_capabilities-filter-deprecated-features-if-requested.patch
|
||||
Patch110: libvirt-virsh-add-disable-deprecated-features-flag-to-domcapabilities.patch
|
||||
Patch111: libvirt-conf-add-deprecated_features-attribute.patch
|
||||
|
||||
Requires: libvirt-daemon = %{version}-%{release}
|
||||
Requires: libvirt-daemon-config-network = %{version}-%{release}
|
||||
@ -740,6 +749,7 @@ volumes using libgfapi.
|
||||
Summary: Storage driver plugin for rbd
|
||||
Requires: libvirt-daemon-driver-storage-core = %{version}-%{release}
|
||||
Requires: libvirt-libs = %{version}-%{release}
|
||||
Requires: librbd1 >= 1:10.2.5
|
||||
|
||||
%description daemon-driver-storage-rbd
|
||||
The storage driver backend adding implementation of the storage APIs for rbd
|
||||
@ -1224,9 +1234,10 @@ exit 1
|
||||
|
||||
%define arg_selinux_mount -Dselinux_mount="/sys/fs/selinux"
|
||||
|
||||
# place macros above and build commands below this comment
|
||||
# Set SOURCE_DATE_EPOCH from changelog
|
||||
%define source_date_epoch_from_changelog 1
|
||||
|
||||
export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec)
|
||||
# place macros above and build commands below this comment
|
||||
|
||||
%meson \
|
||||
-Drunstatedir=%{_rundir} \
|
||||
@ -1305,8 +1316,6 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec)
|
||||
%install
|
||||
rm -fr %{buildroot}
|
||||
|
||||
export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec)
|
||||
|
||||
%meson_install
|
||||
|
||||
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
|
||||
@ -2201,6 +2210,21 @@ exit 0
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Aug 04 2025 EL Errata <el-errata_ww@oracle.com> - 8.0.0-23.4.0.1
|
||||
- Set SOURCE_DATE_EPOCH from changelog [Orabug: 32019554]
|
||||
- Add runtime deps for pkg librbd1 >= 1:10.2.5 (Keshav Sharma)
|
||||
|
||||
* Thu Jun 5 2025 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-23.4.el8
|
||||
- util: xml: Introduce virXMLNodeGetSubelementList (RHEL-88716)
|
||||
- util: xml: Return GPtrArray from virXMLNodeGetSubelement [partial] (RHEL-88716)
|
||||
- qemuMonitorJSONGetCPUModelExpansion: refactor parsing functions (RHEL-88716)
|
||||
- qemu: parse deprecated-props from query-cpu-model-expansion response (RHEL-88716)
|
||||
- qemu_capabilities: query deprecated features for host-model (RHEL-88716)
|
||||
- libvirt-domain: introduce VIR_CONNECT_GET_DOMAIN_CAPABILITIES_DISABLE_DEPRECATED_FEATURES (RHEL-88716)
|
||||
- qemu_capabilities: filter deprecated features if requested (RHEL-88716)
|
||||
- virsh: add --disable-deprecated-features flag to domcapabilities (RHEL-88716)
|
||||
- conf: add deprecated_features attribute (RHEL-88716)
|
||||
|
||||
* Wed Nov 6 2024 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-23.3.el8
|
||||
- virStorageBackendLogicalCheckPool: Properly mark empty logical pools as active (RHEL-65771)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user