[libvirt] [PATCH] qemu: Reject SDL graphic if it's not supported by qemu

Osier Yang jyang at redhat.com
Tue Jan 11 07:43:07 UTC 2011


If the emulator doesn't support SDL graphic, we should reject
the use of SDL graphic xml with error messages, but not ignore
it silently.

* src/qemu/qemu_command.c
---
 src/qemu/qemu_command.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 7dd8e03..cf4ae01 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3567,6 +3567,14 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     } else if ((def->ngraphics == 1) &&
                def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
+        if (!(qemuCmdFlags & QEMUD_CMD_FLAG_SDL)) {
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("sdl not supported by '%s'"),
+                            def->emulator);
+
+            goto error;
+        }
+
         if (def->graphics[0]->data.sdl.xauth)
             virCommandAddEnvPair(cmd, "XAUTHORITY",
                                  def->graphics[0]->data.sdl.xauth);
@@ -3586,9 +3594,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         /* 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)
-            virCommandAddArg(cmd, "-sdl");
-
+        virCommandAddArg(cmd, "-sdl");
     } else if ((def->ngraphics == 1) &&
                def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
         virBuffer opt = VIR_BUFFER_INITIALIZER;
--
1.7.3.2




More information about the libvir-list mailing list