[libvirt] [PATCH 2/2] qemu: Add support for -no-user-config

Jiri Denemark jdenemar at redhat.com
Thu Apr 26 14:28:25 UTC 2012


Thanks to this new option we are now able to use modern CPU models (such
as Westmere) defined in external configuration file.
---
 src/qemu/qemu_capabilities.c |    7 ++++++-
 src/qemu/qemu_capabilities.h |    1 +
 src/qemu/qemu_command.c      |   11 ++++++-----
 src/qemu/qemu_driver.c       |    2 +-
 4 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6e5165b..a3c87d1 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -161,6 +161,7 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
               "block-job-async",
               "scsi-cd",
               "ide-cd",
+              "no-user-config",
     );
 
 struct qemu_feature_flags {
@@ -1082,6 +1083,8 @@ qemuCapsComputeCmdFlags(const char *help,
     }
     if (strstr(help, "-nodefconfig"))
         qemuCapsSet(flags, QEMU_CAPS_NODEFCONFIG);
+    if (strstr(help, "-no-user-config"))
+        qemuCapsSet(flags, QEMU_CAPS_NO_USER_CONFIG);
     /* The trailing ' ' is important to avoid a bogus match */
     if (strstr(help, "-rtc "))
         qemuCapsSet(flags, QEMU_CAPS_RTC);
@@ -1634,7 +1637,9 @@ qemuCapsProbeCommand(const char *qemu,
     virCommandPtr cmd = virCommandNew(qemu);
 
     if (qemuCaps) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
+        if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG))
+            virCommandAddArg(cmd, "-no-user-config");
+        else if (qemuCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
             virCommandAddArg(cmd, "-nodefconfig");
     }
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 7a6c5a0..0e0899e 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -129,6 +129,7 @@ enum qemuCapsFlags {
     QEMU_CAPS_BLOCKJOB_ASYNC     = 91, /* qemu 1.1 block-job-cancel */
     QEMU_CAPS_SCSI_CD            = 92, /* -device scsi-cd */
     QEMU_CAPS_IDE_CD             = 93, /* -device ide-cd */
+    QEMU_CAPS_NO_USER_CONFIG     = 94, /* -no-user-config */
 
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 45cd417..e847060 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -4237,11 +4237,12 @@ qemuBuildCommandLine(virConnectPtr conn,
         virCommandAddArg(cmd, "-nographic");
 
     if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
-            virCommandAddArg(cmd,
-                             "-nodefconfig"); /* Disable global config files */
-        virCommandAddArg(cmd,
-                         "-nodefaults");  /* Disable default guest devices */
+        /* Disable global config files and default devices */
+        if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG))
+            virCommandAddArg(cmd, "-no-user-config");
+        else if (qemuCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
+            virCommandAddArg(cmd, "-nodefconfig");
+        virCommandAddArg(cmd, "-nodefaults");
     }
 
     /* Serial graphics adapter */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index bcc3947..0345d89 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4868,7 +4868,7 @@ qemudCanonicalizeMachineDirect(virDomainDefPtr def, char **canonical)
     int i, nmachines = 0;
 
     /* XXX we should be checking emulator capabilities and pass them instead
-     * of NULL so that -nodefconfig is properly added when
+     * of NULL so that -nodefconfig or -no-user-config is properly added when
      * probing machine types. Luckily, qemu does not support specifying new
      * machine types in its configuration files yet, which means passing this
      * additional parameter makes no difference now.
-- 
1.7.8.5




More information about the libvir-list mailing list