On Mon, Nov 25, 2024 at 14:46:39 -0500, Collin Walling wrote:
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.
In addition to the comments from Boris...
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index dcc164d165..a9910e2195 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;
@@ -450,6 +451,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) {
@@ -748,6 +754,10 @@ virCPUDefFormatBufFull(virBuffer *buf,
virBufferAsprintf(&attributeBuf, " migratable='%s'",
virTristateSwitchTypeToString(def->migratable));
}
+
+ if (def->deprecated_feats == VIR_TRISTATE_SWITCH_OFF) {
the attribute should be formatted even if it is on and ignored only when
it's absent.
+ virBufferAddLit(&attributeBuf, "
deprecated_features='off'");
+ }
}
/* Format children */
Jirka