Re: [PATCH 14/21] qemu: capabilities: Replace aliased machine type by copy of the canonical machine

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

 



On 1/23/20 8:03 AM, Peter Krempa wrote:
The previous approac of just purging the alias combined with the fact

approach

that we filled in fake machine types in the test data meant that if a
test case used an alias machine type such as 'pc' or 'q35' it would not
properly resolve to the actual data returned by qemu.

This started to be a problem since the CPU driver now looks at the
default CPU reported with the machine type.

This patch replaces the original approach of just removing the alias by
replacing it with a copy of the machine type data which the type would
alias to. This means that we are using the real data while we don't
modify the test output after every qemu upgrade.

Additionally this change will allow us to drop adding the fake machine
types later.

The test fallout is from actually excercising the CPU driver with

exercising

actual data.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---

+++ b/src/qemu/qemu_capabilities.c
@@ -5910,8 +5910,12 @@ virQEMUCapsStripMachineAliasesForVirtType(virQEMUCapsPtr qemuCaps,

      for (i = 0; i < accel->nmachineTypes; i++) {
          virQEMUCapsMachineTypePtr mach = &accel->machineTypes[i];
+        g_autofree char *name = g_steal_pointer(&mach->alias);

-        VIR_FREE(mach->alias);
+        if (name) {
+            virQEMUCapsAddMachine(qemuCaps, virtType, name, NULL, mach->defaultCPU,
+                                  mach->maxCpus, mach->hotplugCpus, mach->qemuDefault);
+        }
      }
  }

@@ -5920,6 +5924,10 @@ virQEMUCapsStripMachineAliasesForVirtType(virQEMUCapsPtr qemuCaps,
   * virQEMUCapsStripMachineAliases:
   * @qemuCaps: capabilities object to process
   *
+ * Replace all aliases by the copy of the machine type they point to without
+ * actually having to modify the name. This allows us to add tests with the
+ * aliased machine without having to change the output files all the time.
+ *
   * Remove all aliases so that the tests depending on the latest capabilities
   * file can be stable when new files are added.

Is this paragraph stale now? (How can we remove aliases if we just replaced them?)

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux