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

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, and pretend things are fine. "-sdl" flag was exposed explicitly by qemu since 0.10.0, more detail: http://www.redhat.com/archives/libvir-list/2011-January/msg00442.html And we already have capability flag "QEMUD_CMD_FLAG_0_10", which could be used to prevent the patch affecting the older versions of QEMU. * src/qemu/qemu_command.c --- src/qemu/qemu_command.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a0075a4..55fe249 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3568,6 +3568,14 @@ qemuBuildCommandLine(virConnectPtr conn, } } else if ((def->ngraphics == 1) && def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { + if ((qemuCmdFlags & QEMUD_CMD_FLAG_0_10) && + !(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); -- 1.7.3.2

On Wed, Jan 12, 2011 at 06:06:04PM +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, and pretend things are fine.
"-sdl" flag was exposed explicitly by qemu since 0.10.0, more detail: http://www.redhat.com/archives/libvir-list/2011-January/msg00442.html
And we already have capability flag "QEMUD_CMD_FLAG_0_10", which could be used to prevent the patch affecting the older versions of QEMU.
* src/qemu/qemu_command.c --- src/qemu/qemu_command.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a0075a4..55fe249 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3568,6 +3568,14 @@ qemuBuildCommandLine(virConnectPtr conn, } } else if ((def->ngraphics == 1) && def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { + if ((qemuCmdFlags & QEMUD_CMD_FLAG_0_10) && + !(qemuCmdFlags & QEMUD_CMD_FLAG_SDL)) { + qemuReportError(VIR_ERR_INTERNAL_ERROR,
Use VIR_ERR_CONFIG_UNSUPPORTED here
+ _("sdl not supported by '%s'"), + def->emulator); + goto error; + } +
ACK, with that error code change made. Daniel

于 2011年01月12日 20:24, Daniel P. Berrange 写道:
On Wed, Jan 12, 2011 at 06:06:04PM +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, and pretend things are fine.
"-sdl" flag was exposed explicitly by qemu since 0.10.0, more detail: http://www.redhat.com/archives/libvir-list/2011-January/msg00442.html
And we already have capability flag "QEMUD_CMD_FLAG_0_10", which could be used to prevent the patch affecting the older versions of QEMU.
* src/qemu/qemu_command.c --- src/qemu/qemu_command.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a0075a4..55fe249 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3568,6 +3568,14 @@ qemuBuildCommandLine(virConnectPtr conn, } } else if ((def->ngraphics == 1)&& def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) { + if ((qemuCmdFlags& QEMUD_CMD_FLAG_0_10)&& + !(qemuCmdFlags& QEMUD_CMD_FLAG_SDL)) { + qemuReportError(VIR_ERR_INTERNAL_ERROR,
Use VIR_ERR_CONFIG_UNSUPPORTED here
oh, yeah, thanks. will update
+ _("sdl not supported by '%s'"), + def->emulator); + goto error; + } +
ACK, with that error code change made.
Daniel
participants (2)
-
Daniel P. Berrange
-
Osier Yang