Not all QEMU builds default to SDL graphics for their display. Newer QEMU now has an explicit -sdl flag, which we can use to explicitly request SDL intead of relying on the default. This protects libvirt against unexpected changes in graphics default * src/qemu/qemu_conf.c, src/qemu/qemu_conf.h: Probe for -sdl flag and use it if it is found * tests/qemuhelptest.c: Add SDL flag to tests --- src/qemu/qemu_conf.c | 8 ++++++++ src/qemu/qemu_conf.h | 1 + tests/qemuhelptest.c | 13 +++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index 9cd53f9..b87b170 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -1117,6 +1117,8 @@ static unsigned int qemudComputeCmdFlags(const char *help, flags |= QEMUD_CMD_FLAG_BALLOON; if (strstr(help, "-device")) flags |= QEMUD_CMD_FLAG_DEVICE; + if (strstr(help, "-sdl")) + flags |= QEMUD_CMD_FLAG_SDL; if (version >= 9000) flags |= QEMUD_CMD_FLAG_VNC_COLON; @@ -3425,6 +3427,12 @@ int qemudBuildCommandLine(virConnectPtr conn, */ ADD_ENV_COPY("QEMU_AUDIO_DRV"); ADD_ENV_COPY("SDL_AUDIODRIVER"); + + /* New QEMU has this flag to let us explicitly ask for + * SDL graphics. This is better than relying on the + * default, since the default changes :-( */ + if (qemuCmdFlags & QEMUD_CMD_FLAG_SDL) + ADD_ARG_LIT("-sdl"); } if (def->nvideos) { diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 174d397..4a862d1 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -79,6 +79,7 @@ enum qemud_cmd_flags { QEMUD_CMD_FLAG_MONITOR_JSON = (1 << 24), /* JSON mode for monitor */ QEMUD_CMD_FLAG_BALLOON = (1 << 25), /* -balloon available */ QEMUD_CMD_FLAG_DEVICE = (1 << 26), /* Is the new -chardev arg available */ + QEMUD_CMD_FLAG_SDL = (1 << 27), /* Is the new -sdl arg available */ }; /* Main driver state */ diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c index c2d7942..5ae14a6 100644 --- a/tests/qemuhelptest.c +++ b/tests/qemuhelptest.c @@ -140,7 +140,8 @@ mymain(int argc, char **argv) QEMUD_CMD_FLAG_DRIVE_SERIAL | QEMUD_CMD_FLAG_VGA | QEMUD_CMD_FLAG_0_10 | - QEMUD_CMD_FLAG_ENABLE_KVM, + QEMUD_CMD_FLAG_ENABLE_KVM | + QEMUD_CMD_FLAG_SDL, 10005, 0, 0); DO_TEST("qemu-kvm-0.10.5", QEMUD_CMD_FLAG_VNC_COLON | @@ -159,7 +160,8 @@ mymain(int argc, char **argv) QEMUD_CMD_FLAG_VGA | QEMUD_CMD_FLAG_0_10 | QEMUD_CMD_FLAG_PCIDEVICE | - QEMUD_CMD_FLAG_MEM_PATH, + QEMUD_CMD_FLAG_MEM_PATH | + QEMUD_CMD_FLAG_SDL, 10005, 1, 0); DO_TEST("kvm-86", QEMUD_CMD_FLAG_VNC_COLON | @@ -177,7 +179,8 @@ mymain(int argc, char **argv) QEMUD_CMD_FLAG_DRIVE_SERIAL | QEMUD_CMD_FLAG_VGA | QEMUD_CMD_FLAG_0_10 | - QEMUD_CMD_FLAG_PCIDEVICE, + QEMUD_CMD_FLAG_PCIDEVICE | + QEMUD_CMD_FLAG_SDL, 10050, 1, 0); DO_TEST("qemu-kvm-0.11.0-rc2", QEMUD_CMD_FLAG_VNC_COLON | @@ -198,7 +201,8 @@ mymain(int argc, char **argv) QEMUD_CMD_FLAG_PCIDEVICE | QEMUD_CMD_FLAG_MEM_PATH | QEMUD_CMD_FLAG_ENABLE_KVM | - QEMUD_CMD_FLAG_BALLOON, + QEMUD_CMD_FLAG_BALLOON | + QEMUD_CMD_FLAG_SDL, 10092, 1, 0); DO_TEST("qemu-0.12.1", QEMUD_CMD_FLAG_VNC_COLON | @@ -214,6 +218,7 @@ mymain(int argc, char **argv) QEMUD_CMD_FLAG_VGA | QEMUD_CMD_FLAG_0_10 | QEMUD_CMD_FLAG_ENABLE_KVM | + QEMUD_CMD_FLAG_SDL | QEMUD_CMD_FLAG_XEN_DOMID | QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX | QEMUD_CMD_FLAG_CHARDEV | -- 1.6.5.2 -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list