Re: [PATCH 4/8] tests/testutilsqemu: extract guest creation into separate functions

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

 



On Fri, Apr 07, 2017 at 03:44:19PM +0200, Pavel Hrdina wrote:
All other architectures have separate functions to prepare guest
capabilities, do the same for i686 and x86_64 as well.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
tests/testutilsqemu.c | 182 +++++++++++++++++++++++++++++++-------------------
1 file changed, 114 insertions(+), 68 deletions(-)

diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c
index 4cc482dfb0..d82cebd578 100644
--- a/tests/testutilsqemu.c
+++ b/tests/testutilsqemu.c
@@ -141,6 +141,118 @@ static virCapsGuestMachinePtr *testQemuAllocNewerMachines(int *nmachines)
}


+static int
+testQemuAddI686Guest(virCapsPtr caps)
+{
+    int nmachines = 0;
+    virCapsGuestMachinePtr *machines = NULL;
+    virCapsGuestPtr guest;
+
+    if (!(machines = testQemuAllocMachines(&nmachines)))
+        goto error;
+
+    if (!(guest = virCapabilitiesAddGuest(caps,
+                                          VIR_DOMAIN_OSTYPE_HVM,
+                                          VIR_ARCH_I686,
+                                          "/usr/bin/qemu",
+                                          NULL,
+                                          nmachines,
+                                          machines)))
+        goto error;
+
+    if (!virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false))
+        goto error;
+
+    machines = NULL;

This is correct from the code movement point of view, but virCapabilitiesAddGuest
transfers the ownership of 'machines' to 'caps', so this assignment
should be above virCapabilitiesAddGuestFeature. Preferably in a
follow-up patch.

+
+    if (!virCapabilitiesAddGuestDomain(guest,
+                                       VIR_DOMAIN_VIRT_QEMU,

[...]

+
+static int
+testQemuAddX86_64Guest(virCapsPtr caps)
+{
+    int nmachines = 0;
+    virCapsGuestMachinePtr *machines = NULL;
+    virCapsGuestPtr guest;
+
+    if (!(machines = testQemuAllocNewerMachines(&nmachines)))
+        goto error;
+
+    if (!(guest = virCapabilitiesAddGuest(caps,
+                                          VIR_DOMAIN_OSTYPE_HVM,
+                                          VIR_ARCH_X86_64,
+                                          "/usr/bin/qemu-system-x86_64",
+                                          NULL,
+                                          nmachines,
+                                          machines)))
+        goto error;
+
+    if (!virCapabilitiesAddGuestFeature(guest, "cpuselection", true, false))
+        goto error;
+
+    machines = NULL;

Same here.

Jan

+    if (!virCapabilitiesAddGuestDomain(guest,
+                                       VIR_DOMAIN_VIRT_QEMU,
+                                       NULL,

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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