Re: [PATCH] qemu: Add a capability flag for -no-acpi

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

 



On 12/19/2011 06:08 PM, Michael Ellerman wrote:
> Currently non-x86 guests must have <acpi/> defined in <features> to
> prevent libvirt from running qemu with -no-acpi. Although it works, it
> is a hack.
> 
> Instead add a capability flag which indicates whether qemu understands
> the -no-acpi option. Use it to control whether libvirt emits -no-acpi.
> 
> Current versions of qemu always display -no-acpi in their help output,
> so this patch has no effect. However the development version of qemu
> has been modified such that -no-acpi is only displayed when it is
> actually supported.
> 
> Signed-off-by: Michael Ellerman <michael@xxxxxxxxxxxxxx>
> ---
>  src/qemu/qemu_capabilities.c |    3 +++
>  src/qemu/qemu_capabilities.h |    1 +
>  src/qemu/qemu_command.c      |    6 ++++--
>  3 files changed, 8 insertions(+), 2 deletions(-)

ACK and pushed, after fixing 'make check' to work with the new feature
bit (see below).

Meanwhile, I see nothing wrong with going one further - if we can tell
from the qemu binary and/or the domain XML which target architecture the
guest will be running in, then we could auto-disable acpi on non-x86
guests, even when qemu -help output mistakenly includes a useless
-no-acpi for that architecture, so that you could avoid the <acpi/> hack
even when targetting qemu that doesn't yet make the -help output context
sensitive.  But I'll let you do that as a separate patch.

Here's what I squashed - note that I cheated a bit, and blindly enabled
the new capability bit for all qemu xml tests; it was faster than adding
QEMU_CAPS_NO_ACPI to the bulk of the test entries in qemuxml2argvtest.c,
or editing more than 100 .argv files to remove the -no-acpi argument.
But if you ever expand that test to cover non-x86 XML->argv conversions,
then we should probably go with the longer approach of enabling the
capability per-test where it matters, rather than globally enabling it
for the duration of the test.

diff --git i/tests/qemuhelptest.c w/tests/qemuhelptest.c
index 4258fc9..f31c903 100644
--- i/tests/qemuhelptest.c
+++ w/tests/qemuhelptest.c
@@ -81,11 +81,12 @@ static int testHelpStrParsing(const void *data)
         goto cleanup;

     if (STRNEQ(got, expected)) {
-        fprintf(stderr,
-                "%s: computed flags do not match: got %s, expected %s\n",
-                info->name, got, expected);
+        if (virTestGetVerbose() || virTestGetDebug())
+            fprintf(stderr,
+                    "%s: computed flags do not match: got %s, expected
%s\n",
+                    info->name, got, expected);

-        if (getenv("VIR_TEST_DEBUG"))
+        if (virTestGetDebug())
             printMismatchedFlags(flags, info->flags);

         goto cleanup;
@@ -145,7 +146,8 @@ mymain(void)
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
             QEMU_CAPS_DRIVE,
-            QEMU_CAPS_NAME);
+            QEMU_CAPS_NAME,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("kvm-74", 9001, 1, 74,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -158,7 +160,8 @@ mymain(void)
             QEMU_CAPS_DRIVE_FORMAT,
             QEMU_CAPS_MEM_PATH,
             QEMU_CAPS_TDF,
-            QEMU_CAPS_NO_SHUTDOWN);
+            QEMU_CAPS_NO_SHUTDOWN,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("kvm-83-rhel56", 9001, 1, 83,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -185,7 +188,8 @@ mymain(void)
             QEMU_CAPS_DRIVE_READONLY,
             QEMU_CAPS_SMBIOS_TYPE,
             QEMU_CAPS_SPICE,
-            QEMU_CAPS_NO_SHUTDOWN);
+            QEMU_CAPS_NO_SHUTDOWN,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-0.10.5", 10005, 0, 0,
             QEMU_CAPS_KQEMU,
             QEMU_CAPS_VNC_COLON,
@@ -205,7 +209,8 @@ mymain(void)
             QEMU_CAPS_RTC_TD_HACK,
             QEMU_CAPS_NO_HPET,
             QEMU_CAPS_VGA_NONE,
-            QEMU_CAPS_NO_SHUTDOWN);
+            QEMU_CAPS_NO_SHUTDOWN,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-kvm-0.10.5", 10005, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -231,7 +236,8 @@ mymain(void)
             QEMU_CAPS_TDF,
             QEMU_CAPS_NESTING,
             QEMU_CAPS_VGA_NONE,
-            QEMU_CAPS_NO_SHUTDOWN);
+            QEMU_CAPS_NO_SHUTDOWN,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("kvm-86", 10050, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -257,7 +263,8 @@ mymain(void)
             QEMU_CAPS_NESTING,
             QEMU_CAPS_SMBIOS_TYPE,
             QEMU_CAPS_VGA_NONE,
-            QEMU_CAPS_NO_SHUTDOWN);
+            QEMU_CAPS_NO_SHUTDOWN,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-kvm-0.11.0-rc2", 10092, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -288,7 +295,8 @@ mymain(void)
             QEMU_CAPS_NAME_PROCESS,
             QEMU_CAPS_SMBIOS_TYPE,
             QEMU_CAPS_VGA_NONE,
-            QEMU_CAPS_NO_SHUTDOWN);
+            QEMU_CAPS_NO_SHUTDOWN,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-0.12.1", 12001, 0, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -320,7 +328,8 @@ mymain(void)
             QEMU_CAPS_MIGRATE_QEMU_FD,
             QEMU_CAPS_DRIVE_AIO,
             QEMU_CAPS_NO_SHUTDOWN,
-            QEMU_CAPS_PCI_ROMBAR);
+            QEMU_CAPS_PCI_ROMBAR,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-kvm-0.12.1.2-rhel60", 12001, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -366,7 +375,8 @@ mymain(void)
             QEMU_CAPS_PIIX4_USB_UHCI,
             QEMU_CAPS_USB_HUB,
             QEMU_CAPS_NO_SHUTDOWN,
-            QEMU_CAPS_PCI_ROMBAR);
+            QEMU_CAPS_PCI_ROMBAR,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-kvm-0.12.3", 12003, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -405,7 +415,8 @@ mymain(void)
             QEMU_CAPS_MIGRATE_QEMU_FD,
             QEMU_CAPS_DRIVE_AIO,
             QEMU_CAPS_NO_SHUTDOWN,
-            QEMU_CAPS_PCI_ROMBAR);
+            QEMU_CAPS_PCI_ROMBAR,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-kvm-0.13.0", 13000, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -460,7 +471,8 @@ mymain(void)
             QEMU_CAPS_PCI_OHCI,
             QEMU_CAPS_USB_HUB,
             QEMU_CAPS_NO_SHUTDOWN,
-            QEMU_CAPS_PCI_ROMBAR);
+            QEMU_CAPS_PCI_ROMBAR,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-kvm-0.12.1.2-rhel61", 12001, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -511,7 +523,8 @@ mymain(void)
             QEMU_CAPS_PIIX4_USB_UHCI,
             QEMU_CAPS_USB_HUB,
             QEMU_CAPS_NO_SHUTDOWN,
-            QEMU_CAPS_PCI_ROMBAR);
+            QEMU_CAPS_PCI_ROMBAR,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-kvm-0.12.1.2-rhel62-beta", 12001, 1, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -570,7 +583,8 @@ mymain(void)
             QEMU_CAPS_ICH9_USB_EHCI1,
             QEMU_CAPS_USB_HUB,
             QEMU_CAPS_NO_SHUTDOWN,
-            QEMU_CAPS_PCI_ROMBAR);
+            QEMU_CAPS_PCI_ROMBAR,
+            QEMU_CAPS_NO_ACPI);
     DO_TEST("qemu-1.0", 1000000, 0, 0,
             QEMU_CAPS_VNC_COLON,
             QEMU_CAPS_NO_REBOOT,
@@ -632,7 +646,8 @@ mymain(void)
             QEMU_CAPS_USB_HUB,
             QEMU_CAPS_NO_SHUTDOWN,
             QEMU_CAPS_PCI_ROMBAR,
-            QEMU_CAPS_ICH9_AHCI);
+            QEMU_CAPS_ICH9_AHCI,
+            QEMU_CAPS_NO_ACPI);

     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
diff --git i/tests/qemuxml2argvtest.c w/tests/qemuxml2argvtest.c
index 228d052..e1221eb 100644
--- i/tests/qemuxml2argvtest.c
+++ w/tests/qemuxml2argvtest.c
@@ -145,6 +145,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
     qemuCapsSetList(extraFlags,
                     QEMU_CAPS_VNC_COLON,
                     QEMU_CAPS_NO_REBOOT,
+                    QEMU_CAPS_NO_ACPI,
                     QEMU_CAPS_LAST);

     if (qemudCanonicalizeMachine(&driver, vmdef) < 0)
diff --git i/tests/qemuxmlnstest.c w/tests/qemuxmlnstest.c
index 86cf974..0432cc4 100644
--- i/tests/qemuxmlnstest.c
+++ w/tests/qemuxmlnstest.c
@@ -89,6 +89,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
     qemuCapsSetList(extraFlags,
                     QEMU_CAPS_VNC_COLON,
                     QEMU_CAPS_NO_REBOOT,
+                    QEMU_CAPS_NO_ACPI,
                     QEMU_CAPS_LAST);

     if (qemudCanonicalizeMachine(&driver, vmdef) < 0)


-- 
Eric Blake   eblake@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP 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]