[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

On 06/24/2010 12:52 PM, Laine Stump wrote:
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(-)
Does this impact any of the existing test cases for qemu -h parsing? And if not, should we add a new file to tests/qemuhelpdata/ that exposes a known qemu version that does support -nodefconfig? -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 06/24/2010 12:52 PM, Laine Stump wrote:
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(-)
Does this impact any of the existing test cases for qemu -h parsing?
No.
And if not, should we add a new file to tests/qemuhelpdata/ that exposes a known qemu version that does support -nodefconfig?
I don't think there is currently a publicly available qemu release that supports -nodefconfig. Should we wait until one exists, or dummy up a test file?

On 06/24/2010 02:20 PM, Laine Stump wrote:
And if not, should we add a new file to tests/qemuhelpdata/ that exposes a known qemu version that does support -nodefconfig?
I don't think there is currently a publicly available qemu release that supports -nodefconfig. Should we wait until one exists, or dummy up a test file?
No need to dummy up a file (otherwise someone will ask us how to get that version of qemu); we'll just have to remember to add a new file later on when we officially support a newer released qemu version that adds -nodefconfig support. With those answers to my questions, ACK to your patch. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

On 06/24/2010 02:20 PM, Laine Stump wrote:
And if not, should we add a new file to tests/qemuhelpdata/ that exposes a known qemu version that does support -nodefconfig?
I don't think there is currently a publicly available qemu release that supports -nodefconfig. Should we wait until one exists, or dummy up a test file?
No need to dummy up a file (otherwise someone will ask us how to get that version of qemu); we'll just have to remember to add a new file later on when we officially support a newer released qemu version that adds -nodefconfig support.
With those answers to my questions, ACK to your patch.
Thanks. I pushed it.
participants (2)
-
Eric Blake
-
Laine Stump