Pass -name arg to QEMU when available

This commit is contained in:
Daniel P. Berrange 2008-05-15 16:15:17 +00:00
parent 3a7b528d4b
commit 0f1b6dd06a
5 changed files with 37 additions and 21 deletions

View File

@ -1,7 +1,14 @@
Thu May 15 12:11:08 EST 2008 Daniel P. Berrange <berrange@redhat.com>
* src/qemu_conf.c, src/qemu_conf.h: Pass the -name flag to QEMU
if available.
* tests/qemuxml2argvdata/qemuxml2argv-minimal.args,
tests/qemuxml2argvtest.c: Test for launching with -name flag
Thu May 15 12:08:08 EST 2008 Daniel P. Berrange <berrange@redhat.com>
Support paravirt framebuffer input configuration for xenner guests
* src/qemu_drive.c, src/qemu_conf.c, src/qemu_conf.h: Add support
* src/qemu_driver.c, src/qemu_conf.c, src/qemu_conf.h: Add support
for 'xen' input device type for Xenner PVFB
* tests/qemuxml2argv-input-xen.{args,xml}: Test case data
files for xen input devices

View File

@ -492,10 +492,12 @@ static int qemudExtractVersionInfo(const char *qemu, int *version, int *flags) {
*flags |= QEMUD_CMD_FLAG_KQEMU;
if (strstr(help, "-no-reboot"))
*flags |= QEMUD_CMD_FLAG_NO_REBOOT;
if (strstr(help, "\n-drive"))
*flags |= QEMUD_CMD_FLAG_DRIVE_OPT;
if (strstr(help, "-name"))
*flags |= QEMUD_CMD_FLAG_NAME;
if (strstr(help, "-drive"))
*flags |= QEMUD_CMD_FLAG_DRIVE;
if (strstr(help, "boot=on"))
*flags |= QEMUD_CMD_FLAG_DRIVE_BOOT_OPT;
*flags |= QEMUD_CMD_FLAG_DRIVE_BOOT;
if (*version >= 9000)
*flags |= QEMUD_CMD_FLAG_VNC_COLON;
ret = 0;
@ -2350,6 +2352,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
len = 1 + /* qemu */
2 + /* machine type */
disableKQEMU + /* Disable kqemu */
(vm->qemuCmdFlags & QEMUD_CMD_FLAG_NAME ? 2 : 0) + /* -name XXX */
2 * vm->def->ndisks + /* disks*/
(vm->def->nnets > 0 ? (4 * vm->def->nnets) : 2) + /* networks */
1 + /* usb */
@ -2396,6 +2399,12 @@ int qemudBuildCommandLine(virConnectPtr conn,
if (!((*argv)[++n] = strdup(vcpus)))
goto no_memory;
if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_NAME) {
if (!((*argv)[++n] = strdup("-name")))
goto no_memory;
if (!((*argv)[++n] = strdup(vm->def->name)))
goto no_memory;
}
/*
* NB, -nographic *MUST* come before any serial, or monitor
* or parallel port flags due to QEMU craziness, where it
@ -2474,11 +2483,11 @@ int qemudBuildCommandLine(virConnectPtr conn,
}
/* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */
if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_OPT) {
if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE) {
int bootCD = 0, bootFloppy = 0, bootDisk = 0;
/* If QEMU supports boot=on for -drive param... */
if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_BOOT_OPT) {
if (vm->qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_BOOT) {
for (i = 0 ; i < vm->def->os.nBootDevs ; i++) {
switch (vm->def->os.bootDevs[i]) {
case QEMUD_BOOT_CDROM:

View File

@ -249,8 +249,9 @@ enum qemud_cmd_flags {
QEMUD_CMD_FLAG_KQEMU = (1 << 0),
QEMUD_CMD_FLAG_VNC_COLON = (1 << 1),
QEMUD_CMD_FLAG_NO_REBOOT = (1 << 2),
QEMUD_CMD_FLAG_DRIVE_OPT = (1 << 3),
QEMUD_CMD_FLAG_DRIVE_BOOT_OPT = (1 << 4),
QEMUD_CMD_FLAG_DRIVE = (1 << 3),
QEMUD_CMD_FLAG_DRIVE_BOOT = (1 << 4),
QEMUD_CMD_FLAG_NAME = (1 << 5),
};

View File

@ -1 +1 @@
/usr/bin/qemu -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb
/usr/bin/qemu -M pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor pty -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb

View File

@ -20,7 +20,7 @@ static struct qemud_driver driver;
#define MAX_FILE 4096
static int testCompareXMLToArgvFiles(const char *xml, const char *cmd, int driveFlag) {
static int testCompareXMLToArgvFiles(const char *xml, const char *cmd, int extraFlags) {
char xmlData[MAX_FILE];
char argvData[MAX_FILE];
char *xmlPtr = &(xmlData[0]);
@ -47,10 +47,7 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *cmd, int drive
vm.qemuVersion = 0 * 1000 * 100 + (8 * 1000) + 1;
vm.qemuCmdFlags = QEMUD_CMD_FLAG_VNC_COLON |
QEMUD_CMD_FLAG_NO_REBOOT;
if (driveFlag) {
vm.qemuCmdFlags |= QEMUD_CMD_FLAG_DRIVE_OPT;
vm.qemuCmdFlags |= QEMUD_CMD_FLAG_DRIVE_BOOT_OPT;
}
vm.qemuCmdFlags |= extraFlags;
vm.migrateFrom[0] = '\0';
vmdef->vncActivePort = vmdef->vncPort;
@ -100,7 +97,7 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *cmd, int drive
struct testInfo {
const char *name;
int driveFlag;
int extraFlags;
};
static int testCompareXMLToArgvHelper(const void *data) {
@ -111,7 +108,7 @@ static int testCompareXMLToArgvHelper(const void *data) {
abs_srcdir, info->name);
snprintf(args, PATH_MAX, "%s/qemuxml2argvdata/qemuxml2argv-%s.args",
abs_srcdir, info->name);
return testCompareXMLToArgvFiles(xml, args, info->driveFlag);
return testCompareXMLToArgvFiles(xml, args, info->extraFlags);
}
@ -135,15 +132,15 @@ main(int argc, char **argv)
driver.caps = qemudCapsInit();
#define DO_TEST(name, driveFlag) \
#define DO_TEST(name, extraFlags) \
do { \
struct testInfo info = { name, driveFlag }; \
struct testInfo info = { name, extraFlags }; \
if (virtTestRun("QEMU XML-2-ARGV " name, \
1, testCompareXMLToArgvHelper, &info) < 0) \
ret = -1; \
} while (0)
DO_TEST("minimal", 0);
DO_TEST("minimal", QEMUD_CMD_FLAG_NAME);
DO_TEST("boot-cdrom", 0);
DO_TEST("boot-network", 0);
DO_TEST("boot-floppy", 0);
@ -152,8 +149,10 @@ main(int argc, char **argv)
DO_TEST("disk-cdrom", 0);
DO_TEST("disk-floppy", 0);
DO_TEST("disk-many", 0);
DO_TEST("disk-virtio", 1);
DO_TEST("disk-xenvbd", 1);
DO_TEST("disk-virtio", QEMUD_CMD_FLAG_DRIVE |
QEMUD_CMD_FLAG_DRIVE_BOOT);
DO_TEST("disk-xenvbd", QEMUD_CMD_FLAG_DRIVE |
QEMUD_CMD_FLAG_DRIVE_BOOT);
DO_TEST("graphics-vnc", 0);
DO_TEST("graphics-sdl", 0);
DO_TEST("input-usbmouse", 0);