Fix handling of Xen(ner) detection

Latest upstream QEMU can be built with Xen support, which introduces
a -xen-domid argument. This was  mistakenly detected as -domid due
to old Xenner support. Adapt to cope with both syntax. Also only
set domid if the virt type is xen, or the guest type is xen

* src/qemu_conf.c, src/qemu_conf.h: Detect new -xen-domid flag in
  preference to -domid.
* tests/qemuxml2argvdata/qemuxml2argv-bootloader.args,
  tests/qemuxml2argvdata/qemuxml2argv-input-xen.args: Add missing
  -domid param
* tests/qemuxml2argvdata/qemuxml2argv-misc-uuid.args: Remove bogus
  -boot param.
* tests/qemuxml2argvtest.c: Add missing QEMUD_CMD_FLAG_DOMID params
This commit is contained in:
Daniel P. Berrange 2009-08-25 14:17:29 +01:00
parent 12c542a421
commit b81a7ece97
6 changed files with 31 additions and 13 deletions

View File

@ -851,7 +851,9 @@ static unsigned int qemudComputeCmdFlags(const char *help,
flags |= QEMUD_CMD_FLAG_NAME;
if (strstr(help, "-uuid"))
flags |= QEMUD_CMD_FLAG_UUID;
if (strstr(help, "-domid"))
if (strstr(help, "-xen-domid"))
flags |= QEMUD_CMD_FLAG_XEN_DOMID;
else if (strstr(help, "-domid"))
flags |= QEMUD_CMD_FLAG_DOMID;
if (strstr(help, "-drive")) {
flags |= QEMUD_CMD_FLAG_DRIVE;
@ -1720,9 +1722,22 @@ int qemudBuildCommandLine(virConnectPtr conn,
ADD_ARG_LIT("-uuid");
ADD_ARG_LIT(uuid);
}
if (qemuCmdFlags & QEMUD_CMD_FLAG_DOMID) {
ADD_ARG_LIT("-domid");
ADD_ARG_LIT(domid);
if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
STREQ(def->os.type, "xen") ||
STREQ(def->os.type, "linux")) {
if (qemuCmdFlags & QEMUD_CMD_FLAG_DOMID) {
ADD_ARG_LIT("-domid");
ADD_ARG_LIT(domid);
} else if (qemuCmdFlags & QEMUD_CMD_FLAG_XEN_DOMID) {
ADD_ARG_LIT("-xen-attach");
ADD_ARG_LIT("-xen-domid");
ADD_ARG_LIT(domid);
} else {
qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
_("qemu emulator '%s' does not support xen"),
def->emulator);
goto error;
}
}
/*
@ -1775,9 +1790,11 @@ int qemudBuildCommandLine(virConnectPtr conn,
break;
}
}
boot[def->os.nBootDevs] = '\0';
ADD_ARG_LIT("-boot");
ADD_ARG_LIT(boot);
if (def->os.nBootDevs) {
boot[def->os.nBootDevs] = '\0';
ADD_ARG_LIT("-boot");
ADD_ARG_LIT(boot);
}
if (def->os.kernel) {
ADD_ARG_LIT("-kernel");

View File

@ -69,6 +69,7 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_PCIDEVICE = (1 << 17), /* PCI device assignment only supported by qemu-kvm */
QEMUD_CMD_FLAG_MEM_PATH = (1 << 18), /* mmap'ped guest backing supported */
QEMUD_CMD_FLAG_DRIVE_SERIAL = (1 << 19), /* -driver serial= available */
QEMUD_CMD_FLAG_XEN_DOMID = (1 << 20), /* -xen-domid (new style xen integration) */
};
/* Main driver state */

View File

@ -1 +1 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/xenner -S -M xenner -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -bootloader /usr/bin/pygrub -cdrom /dev/cdrom -net none -serial none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/xenner -S -M xenner -m 214 -smp 1 -domid 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -bootloader /usr/bin/pygrub -cdrom /dev/cdrom -net none -serial none -parallel none -usb

View File

@ -1 +1 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/xenner -S -M xenner -m 214 -smp 1 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -bootloader /foo -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/xenner -S -M xenner -m 214 -smp 1 -domid 6 -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -bootloader /foo -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -vnc 127.0.0.1:3

View File

@ -1 +1 @@
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -name QEMUGuest1 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 -domid 6 -nographic -monitor unix:/tmp/test-monitor,server,nowait -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -name QEMUGuest1 -uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 -nographic -monitor unix:/tmp/test-monitor,server,nowait -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb

View File

@ -195,7 +195,7 @@ mymain(int argc, char **argv)
DO_TEST("boot-cdrom", 0);
DO_TEST("boot-network", 0);
DO_TEST("boot-floppy", 0);
DO_TEST("bootloader", 0);
DO_TEST("bootloader", QEMUD_CMD_FLAG_DOMID);
DO_TEST("clock-utc", 0);
DO_TEST("clock-localtime", 0);
DO_TEST("hugepages", QEMUD_CMD_FLAG_MEM_PATH);
@ -246,11 +246,11 @@ mymain(int argc, char **argv)
DO_TEST("graphics-sdl-fullscreen", 0);
DO_TEST("input-usbmouse", 0);
DO_TEST("input-usbtablet", 0);
DO_TEST("input-xen", 0);
DO_TEST("input-xen", QEMUD_CMD_FLAG_DOMID);
DO_TEST("misc-acpi", 0);
DO_TEST("misc-no-reboot", 0);
DO_TEST("misc-uuid", QEMUD_CMD_FLAG_NAME |
QEMUD_CMD_FLAG_UUID | QEMUD_CMD_FLAG_DOMID);
QEMUD_CMD_FLAG_UUID);
DO_TEST("net-user", 0);
DO_TEST("net-virtio", 0);
DO_TEST("net-eth", 0);