mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-21 05:29:18 +00:00
Simplify condition for formatting CPU features
Commit adff345
added support for features to MODE_HOSTPASSTHROUGH
as well. Since we support all modes now, the condition can be
eliminated.
This commit is contained in:
parent
bc378060f7
commit
bd1bbd4710
@ -660,32 +660,30 @@ virCPUDefFormatBuf(virBufferPtr buf,
|
|||||||
virBufferAddLit(buf, "/>\n");
|
virBufferAddLit(buf, "/>\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formatModel || def->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
|
for (i = 0; i < def->nfeatures; i++) {
|
||||||
for (i = 0; i < def->nfeatures; i++) {
|
virCPUFeatureDefPtr feature = def->features + i;
|
||||||
virCPUFeatureDefPtr feature = def->features + i;
|
|
||||||
|
|
||||||
if (!feature->name) {
|
if (!feature->name) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||||
_("Missing CPU feature name"));
|
_("Missing CPU feature name"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (def->type == VIR_CPU_TYPE_GUEST) {
|
||||||
|
const char *policy;
|
||||||
|
|
||||||
|
policy = virCPUFeaturePolicyTypeToString(feature->policy);
|
||||||
|
if (!policy) {
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Unexpected CPU feature policy %d"),
|
||||||
|
feature->policy);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
virBufferAsprintf(buf, "<feature policy='%s' name='%s'/>\n",
|
||||||
if (def->type == VIR_CPU_TYPE_GUEST) {
|
policy, feature->name);
|
||||||
const char *policy;
|
} else {
|
||||||
|
virBufferAsprintf(buf, "<feature name='%s'/>\n",
|
||||||
policy = virCPUFeaturePolicyTypeToString(feature->policy);
|
feature->name);
|
||||||
if (!policy) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("Unexpected CPU feature policy %d"),
|
|
||||||
feature->policy);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
virBufferAsprintf(buf, "<feature policy='%s' name='%s'/>\n",
|
|
||||||
policy, feature->name);
|
|
||||||
} else {
|
|
||||||
virBufferAsprintf(buf, "<feature name='%s'/>\n",
|
|
||||||
feature->name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user