|
|
6ae9ed |
From 50244446129418acbd9efd72ebbd5c166d62dc62 Mon Sep 17 00:00:00 2001
|
|
|
6ae9ed |
Message-Id: <50244446129418acbd9efd72ebbd5c166d62dc62@dist-git>
|
|
|
6ae9ed |
From: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
Date: Tue, 28 Jun 2016 11:12:41 +0200
|
|
|
6ae9ed |
Subject: [PATCH] cpu_x86: Properly drop non-migratable features
|
|
|
6ae9ed |
|
|
|
6ae9ed |
By removing a non-migratable feature in a for loop we would fail to drop
|
|
|
6ae9ed |
every second non-migratable feature if the features array contained
|
|
|
6ae9ed |
several of them in a row.
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
(cherry picked from commit 1ac897a15da11d1bfca2642bce3b0beaad32bcf1)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1365500
|
|
|
6ae9ed |
|
|
|
6ae9ed |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
6ae9ed |
---
|
|
|
6ae9ed |
src/cpu/cpu_x86.c | 14 ++++++++++----
|
|
|
6ae9ed |
1 file changed, 10 insertions(+), 4 deletions(-)
|
|
|
6ae9ed |
|
|
|
6ae9ed |
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
|
|
|
6ae9ed |
index 7bb2bb6..24ef76b 100644
|
|
|
6ae9ed |
--- a/src/cpu/cpu_x86.c
|
|
|
6ae9ed |
+++ b/src/cpu/cpu_x86.c
|
|
|
6ae9ed |
@@ -1816,8 +1816,11 @@ x86Decode(virCPUDefPtr cpu,
|
|
|
6ae9ed |
* Note: this only works as long as no CPU model contains non-migratable
|
|
|
6ae9ed |
* features directly */
|
|
|
6ae9ed |
if (flags & VIR_CONNECT_BASELINE_CPU_MIGRATABLE) {
|
|
|
6ae9ed |
- for (i = 0; i < cpuModel->nfeatures; i++) {
|
|
|
6ae9ed |
- if (!x86FeatureIsMigratable(cpuModel->features[i].name, map)) {
|
|
|
6ae9ed |
+ i = 0;
|
|
|
6ae9ed |
+ while (i < cpuModel->nfeatures) {
|
|
|
6ae9ed |
+ if (x86FeatureIsMigratable(cpuModel->features[i].name, map)) {
|
|
|
6ae9ed |
+ i++;
|
|
|
6ae9ed |
+ } else {
|
|
|
6ae9ed |
VIR_FREE(cpuModel->features[i].name);
|
|
|
6ae9ed |
VIR_DELETE_ELEMENT_INPLACE(cpuModel->features, i,
|
|
|
6ae9ed |
cpuModel->nfeatures);
|
|
|
6ae9ed |
@@ -2542,8 +2545,11 @@ x86UpdateHostModel(virCPUDefPtr guest,
|
|
|
6ae9ed |
/* Remove non-migratable features by default
|
|
|
6ae9ed |
* Note: this only works as long as no CPU model contains non-migratable
|
|
|
6ae9ed |
* features directly */
|
|
|
6ae9ed |
- for (i = 0; i < guest->nfeatures; i++) {
|
|
|
6ae9ed |
- if (!x86FeatureIsMigratable(guest->features[i].name, map)) {
|
|
|
6ae9ed |
+ i = 0;
|
|
|
6ae9ed |
+ while (i < guest->nfeatures) {
|
|
|
6ae9ed |
+ if (x86FeatureIsMigratable(guest->features[i].name, map)) {
|
|
|
6ae9ed |
+ i++;
|
|
|
6ae9ed |
+ } else {
|
|
|
6ae9ed |
VIR_FREE(guest->features[i].name);
|
|
|
6ae9ed |
VIR_DELETE_ELEMENT_INPLACE(guest->features, i, guest->nfeatures);
|
|
|
6ae9ed |
}
|
|
|
6ae9ed |
--
|
|
|
6ae9ed |
2.9.2
|
|
|
6ae9ed |
|