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

Daniel P. Berrange berrange at redhat.com
Tue Jan 11 11:29:17 UTC 2011


On Tue, Jan 11, 2011 at 03:43:07PM +0800, Osier Yang wrote:
> 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

NACK.

Most previous versions of QEMU don't have any explicit -sdl
flag. You got SDL automagically when *no* -vnc flag was
given. So this change breaks many old QEMU versions.

> ---
>  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;


Daniel




More information about the libvir-list mailing list