mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
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>
This commit is contained in:
parent
60e407deb5
commit
45140d2930
@ -4019,6 +4019,7 @@ virQEMUCapsLoadHostCPUModelInfo(virQEMUCapsAccel *caps,
|
|||||||
const char *typeStr)
|
const char *typeStr)
|
||||||
{
|
{
|
||||||
xmlNodePtr hostCPUNode;
|
xmlNodePtr hostCPUNode;
|
||||||
|
xmlNodePtr deprecated_props;
|
||||||
g_autofree xmlNodePtr *nodes = NULL;
|
g_autofree xmlNodePtr *nodes = NULL;
|
||||||
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
VIR_XPATH_NODE_AUTORESTORE(ctxt)
|
||||||
g_autoptr(qemuMonitorCPUModelInfo) hostCPU = NULL;
|
g_autoptr(qemuMonitorCPUModelInfo) hostCPU = NULL;
|
||||||
@ -4111,6 +4112,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);
|
caps->hostCPU.info = g_steal_pointer(&hostCPU);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -4843,6 +4862,18 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccel *caps,
|
|||||||
virBufferAddLit(buf, "/>\n");
|
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);
|
virBufferAdjustIndent(buf, -2);
|
||||||
virBufferAddLit(buf, "</hostCPU>\n");
|
virBufferAddLit(buf, "</hostCPU>\n");
|
||||||
}
|
}
|
||||||
|
@ -3306,6 +3306,7 @@ qemuMonitorCPUModelInfoFree(qemuMonitorCPUModelInfo *model_info)
|
|||||||
g_free(model_info->props[i].value.string);
|
g_free(model_info->props[i].value.string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_strfreev(model_info->deprecated_props);
|
||||||
g_free(model_info->props);
|
g_free(model_info->props);
|
||||||
g_free(model_info->name);
|
g_free(model_info->name);
|
||||||
g_free(model_info);
|
g_free(model_info);
|
||||||
@ -3350,6 +3351,8 @@ qemuMonitorCPUModelInfoCopy(const qemuMonitorCPUModelInfo *orig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
copy->deprecated_props = g_strdupv(orig->deprecated_props);
|
||||||
|
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1150,6 +1150,7 @@ struct _qemuMonitorCPUModelInfo {
|
|||||||
char *name;
|
char *name;
|
||||||
size_t nprops;
|
size_t nprops;
|
||||||
qemuMonitorCPUProperty *props;
|
qemuMonitorCPUProperty *props;
|
||||||
|
GStrv deprecated_props;
|
||||||
bool migratability;
|
bool migratability;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5105,6 +5105,7 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data,
|
|||||||
bool fail_no_props,
|
bool fail_no_props,
|
||||||
virJSONValue **cpu_model,
|
virJSONValue **cpu_model,
|
||||||
virJSONValue **cpu_props,
|
virJSONValue **cpu_props,
|
||||||
|
virJSONValue **cpu_deprecated_props,
|
||||||
const char **cpu_name)
|
const char **cpu_name)
|
||||||
{
|
{
|
||||||
if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion",
|
if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion",
|
||||||
@ -5112,6 +5113,12 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data,
|
|||||||
cpu_name) < 0)
|
cpu_name) < 0)
|
||||||
return -1;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5119,6 +5126,7 @@ qemuMonitorJSONParseCPUModelExpansionData(virJSONValue *data,
|
|||||||
static int
|
static int
|
||||||
qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name,
|
qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name,
|
||||||
virJSONValue *cpu_props,
|
virJSONValue *cpu_props,
|
||||||
|
virJSONValue *cpu_deprecated_props,
|
||||||
qemuMonitorCPUModelInfo **model_info)
|
qemuMonitorCPUModelInfo **model_info)
|
||||||
{
|
{
|
||||||
g_autoptr(qemuMonitorCPUModelInfo) expanded_model = NULL;
|
g_autoptr(qemuMonitorCPUModelInfo) expanded_model = NULL;
|
||||||
@ -5126,6 +5134,12 @@ qemuMonitorJSONParseCPUModelExpansion(const char *cpu_name,
|
|||||||
if (qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, &expanded_model) < 0)
|
if (qemuMonitorJSONParseCPUModel(cpu_name, cpu_props, &expanded_model) < 0)
|
||||||
return -1;
|
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);
|
*model_info = g_steal_pointer(&expanded_model);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -5190,6 +5204,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
|||||||
g_autoptr(virJSONValue) fullData = NULL;
|
g_autoptr(virJSONValue) fullData = NULL;
|
||||||
virJSONValue *cpu_model;
|
virJSONValue *cpu_model;
|
||||||
virJSONValue *cpu_props = NULL;
|
virJSONValue *cpu_props = NULL;
|
||||||
|
virJSONValue *cpu_deprecated_props = NULL;
|
||||||
const char *cpu_name = "";
|
const char *cpu_name = "";
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
@ -5203,6 +5218,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
|||||||
|
|
||||||
if (qemuMonitorJSONParseCPUModelExpansionData(data, fail_no_props,
|
if (qemuMonitorJSONParseCPUModelExpansionData(data, fail_no_props,
|
||||||
&cpu_model, &cpu_props,
|
&cpu_model, &cpu_props,
|
||||||
|
&cpu_deprecated_props,
|
||||||
&cpu_name) < 0)
|
&cpu_name) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -5221,11 +5237,13 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitor *mon,
|
|||||||
|
|
||||||
if (qemuMonitorJSONParseCPUModelExpansionData(fullData, fail_no_props,
|
if (qemuMonitorJSONParseCPUModelExpansionData(fullData, fail_no_props,
|
||||||
&cpu_model, &cpu_props,
|
&cpu_model, &cpu_props,
|
||||||
|
&cpu_deprecated_props,
|
||||||
&cpu_name) < 0)
|
&cpu_name) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return qemuMonitorJSONParseCPUModelExpansion(cpu_name, cpu_props,
|
return qemuMonitorJSONParseCPUModelExpansion(cpu_name, cpu_props,
|
||||||
|
cpu_deprecated_props,
|
||||||
model_info);
|
model_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,6 +193,12 @@
|
|||||||
<property name='te' type='boolean' value='true'/>
|
<property name='te' type='boolean' value='true'/>
|
||||||
<property name='cmm' type='boolean' value='true'/>
|
<property name='cmm' type='boolean' value='true'/>
|
||||||
<property name='vxpdeh2' type='boolean' value='true'/>
|
<property name='vxpdeh2' type='boolean' value='true'/>
|
||||||
|
<deprecatedFeatures>
|
||||||
|
<property name='bpb'/>
|
||||||
|
<property name='te'/>
|
||||||
|
<property name='cte'/>
|
||||||
|
<property name='csske'/>
|
||||||
|
</deprecatedFeatures>
|
||||||
</hostCPU>
|
</hostCPU>
|
||||||
<cpu type='kvm' name='z13' typename='z13-s390x-cpu' usable='yes'/>
|
<cpu type='kvm' name='z13' typename='z13-s390x-cpu' usable='yes'/>
|
||||||
<cpu type='kvm' name='z990.3' typename='z990.3-s390x-cpu' usable='yes'/>
|
<cpu type='kvm' name='z990.3' typename='z990.3-s390x-cpu' usable='yes'/>
|
||||||
|
@ -196,6 +196,12 @@
|
|||||||
<property name='te' type='boolean' value='true'/>
|
<property name='te' type='boolean' value='true'/>
|
||||||
<property name='cmm' type='boolean' value='true'/>
|
<property name='cmm' type='boolean' value='true'/>
|
||||||
<property name='vxpdeh2' type='boolean' value='true'/>
|
<property name='vxpdeh2' type='boolean' value='true'/>
|
||||||
|
<deprecatedFeatures>
|
||||||
|
<property name='bpb'/>
|
||||||
|
<property name='te'/>
|
||||||
|
<property name='cte'/>
|
||||||
|
<property name='csske'/>
|
||||||
|
</deprecatedFeatures>
|
||||||
</hostCPU>
|
</hostCPU>
|
||||||
<cpu type='kvm' name='z13' typename='z13-s390x-cpu' usable='yes'/>
|
<cpu type='kvm' name='z13' typename='z13-s390x-cpu' usable='yes'/>
|
||||||
<cpu type='kvm' name='z990.3' typename='z990.3-s390x-cpu' usable='yes'/>
|
<cpu type='kvm' name='z990.3' typename='z990.3-s390x-cpu' usable='yes'/>
|
||||||
|
Loading…
Reference in New Issue
Block a user