mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
cpu_x86: Introduce x86FeatureIsMigratable
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
73b647d418
commit
dbb14bb0f1
@ -767,6 +767,22 @@ x86FeatureFindInternal(const char *name)
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
x86FeatureIsMigratable(const char *name,
|
||||
void *cpu_map)
|
||||
{
|
||||
virCPUx86MapPtr map = cpu_map;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < map->nblockers; i++) {
|
||||
if (STREQ(name, map->migrate_blockers[i]->name))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
x86FeatureNames(virCPUx86MapPtr map,
|
||||
const char *separator,
|
||||
@ -1801,17 +1817,13 @@ x86Decode(virCPUDefPtr cpu,
|
||||
* features directly */
|
||||
if (flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) {
|
||||
for (i = 0; i < cpuModel->nfeatures; i++) {
|
||||
size_t j;
|
||||
for (j = 0; j < map->nblockers; j++) {
|
||||
if (STREQ(map->migrate_blockers[j]->name,
|
||||
cpuModel->features[i].name)) {
|
||||
if (!x86FeatureIsMigratable(cpuModel->features[i].name, map)) {
|
||||
VIR_FREE(cpuModel->features[i].name);
|
||||
VIR_DELETE_ELEMENT_INPLACE(cpuModel->features, i,
|
||||
cpuModel->nfeatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES) {
|
||||
if (x86DataCopy(©, &model->data) < 0 ||
|
||||
@ -2531,14 +2543,11 @@ x86UpdateHostModel(virCPUDefPtr guest,
|
||||
* Note: this only works as long as no CPU model contains non-migratable
|
||||
* features directly */
|
||||
for (i = 0; i < guest->nfeatures; i++) {
|
||||
size_t j;
|
||||
for (j = 0; j < map->nblockers; j++) {
|
||||
if (STREQ(map->migrate_blockers[j]->name, guest->features[i].name)) {
|
||||
if (!x86FeatureIsMigratable(guest->features[i].name, map)) {
|
||||
VIR_FREE(guest->features[i].name);
|
||||
VIR_DELETE_ELEMENT_INPLACE(guest->features, i, guest->nfeatures);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; !passthrough && i < oldguest->nfeatures; i++) {
|
||||
if (virCPUDefUpdateFeature(guest,
|
||||
oldguest->features[i].name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user