mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
cpu_x86: Change the flow in virCPUx86Update
This is just a preparation for adding new functionality to virCPUx86Update. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> Reviewed-by: Tim Wiederhake <twiederh@redhat.com>
This commit is contained in:
parent
8a04e76610
commit
eefc839f0a
@ -2943,38 +2943,39 @@ virCPUx86Update(virCPUDefPtr guest,
|
|||||||
virCPUx86MapPtr map;
|
virCPUx86MapPtr map;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!relative)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (!host) {
|
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
|
||||||
_("unknown host CPU model"));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(map = virCPUx86GetMap()))
|
if (!(map = virCPUx86GetMap()))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!(model = x86ModelFromCPU(host, map, -1)))
|
if (relative) {
|
||||||
return -1;
|
if (!host) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("unknown host CPU model"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < guest->nfeatures; i++) {
|
if (!(model = x86ModelFromCPU(host, map, -1)))
|
||||||
if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
|
return -1;
|
||||||
int supported = x86FeatureInData(guest->features[i].name,
|
|
||||||
&model->data, map);
|
for (i = 0; i < guest->nfeatures; i++) {
|
||||||
if (supported < 0)
|
if (guest->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
|
||||||
|
int supported = x86FeatureInData(guest->features[i].name,
|
||||||
|
&model->data, map);
|
||||||
|
if (supported < 0)
|
||||||
|
return -1;
|
||||||
|
else if (supported)
|
||||||
|
guest->features[i].policy = VIR_CPU_FEATURE_REQUIRE;
|
||||||
|
else
|
||||||
|
guest->features[i].policy = VIR_CPU_FEATURE_DISABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (guest->mode == VIR_CPU_MODE_HOST_MODEL ||
|
||||||
|
guest->match == VIR_CPU_MATCH_MINIMUM) {
|
||||||
|
if (x86UpdateHostModel(guest, host) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
else if (supported)
|
|
||||||
guest->features[i].policy = VIR_CPU_FEATURE_REQUIRE;
|
|
||||||
else
|
|
||||||
guest->features[i].policy = VIR_CPU_FEATURE_DISABLE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (guest->mode == VIR_CPU_MODE_HOST_MODEL ||
|
|
||||||
guest->match == VIR_CPU_MATCH_MINIMUM)
|
|
||||||
return x86UpdateHostModel(guest, host);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user