[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemu: capabilities: fix machine name/canonical swappage



Things are supposed to look like:

<machine canonical='pc-0.12'>pc</machine>

But are currently swapped. This can cause many VMs to revert to having
machine type='pc' which will affect save/restore across qemu upgrades.
---
 src/qemu/qemu_capabilities.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 668935e..01a1b98 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2046,20 +2046,15 @@ qemuCapsProbeQMPMachineTypes(qemuCapsPtr caps,
 
     for (i = 0 ; i < nmachines ; i++) {
         if (machines[i]->alias) {
-            if (!(caps->machineAliases[i] = strdup(machines[i]->name))) {
-                virReportOOMError();
-                goto cleanup;
-            }
-            if (!(caps->machineTypes[i] = strdup(machines[i]->alias))) {
-                virReportOOMError();
-                goto cleanup;
-            }
-        } else {
-            if (!(caps->machineTypes[i] = strdup(machines[i]->name))) {
+            if (!(caps->machineAliases[i] = strdup(machines[i]->alias))) {
                 virReportOOMError();
                 goto cleanup;
             }
         }
+        if (!(caps->machineTypes[i] = strdup(machines[i]->name))) {
+            virReportOOMError();
+            goto cleanup;
+        }
         if (machines[i]->isDefault)
             defIdx = i;
     }
-- 
1.8.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]