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

[libvirt] [PATCH] Check for presence of qemu -nodefconfig option before using it



We previously assumed that if the -device option existed in qemu, that
-nodefconfig would also exist. It turns out that isn't the case, as
demonstrated by qemu-kvm-0.12.3 in Fedora 13.

*/src/qemu/qemu_conf.[hc] - add a new QEMUD_CMD_FLAG, set it via the
                            help output, and check it before adding
                            -nodefconfig to the qemu commandline.
---
 src/qemu/qemu_conf.c |    5 ++++-
 src/qemu/qemu_conf.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 9cece8b..b45b592 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -1176,6 +1176,8 @@ static unsigned long long qemudComputeCmdFlags(const char *help,
         flags |= QEMUD_CMD_FLAG_BALLOON;
     if (strstr(help, "-device"))
         flags |= QEMUD_CMD_FLAG_DEVICE;
+    if (strstr(help, "-nodefconfig"))
+        flags |= QEMUD_CMD_FLAG_NODEFCONFIG;
     /* The trailing ' ' is important to avoid a bogus match */
     if (strstr(help, "-rtc "))
         flags |= QEMUD_CMD_FLAG_RTC;
@@ -3780,7 +3782,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
         ADD_ARG_LIT("-nographic");
 
     if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
-        ADD_ARG_LIT("-nodefconfig"); /* Disabling global config files */
+        if (qemuCmdFlags & QEMUD_CMD_FLAG_NODEFCONFIG)
+            ADD_ARG_LIT("-nodefconfig"); /* Disabling global config files */
         ADD_ARG_LIT("-nodefaults");  /* Disabling default guest devices */
     }
 
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 0f8a1b3..ab5f158 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -90,6 +90,7 @@ enum qemud_cmd_flags {
     QEMUD_CMD_FLAG_NO_KVM_PIT    = (1LL << 34), /* -no-kvm-pit-reinjection supported */
     QEMUD_CMD_FLAG_TDF           = (1LL << 35), /* -tdf flag (user-mode pit catchup) */
     QEMUD_CMD_FLAG_PCI_CONFIGFD  = (1LL << 36), /* pci-assign.configfd */
+    QEMUD_CMD_FLAG_NODEFCONFIG   = (1LL << 37), /* -nodefconfig */
 };
 
 /* Main driver state */
-- 
1.7.1


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