Re: [libvirt] [PATCH 31/34] Add support for explicit -sdl flag to QEMU

2010-01-16 Thread Daniel P. Berrange
On Fri, Jan 15, 2010 at 09:00:36PM +0100, Daniel Veillard wrote:
 On Fri, Jan 08, 2010 at 05:23:27PM +, Daniel P. Berrange wrote:
  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
  
 
   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 */
   };
 
   Aren't we getting close to the 32 options limits ?

It doesn't really matter as we can trivially just make it an int64, or
turn it into a plain enum, instead of bitflags. This isn't exposed in
the API anywhere

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH 31/34] Add support for explicit -sdl flag to QEMU

2010-01-15 Thread Daniel Veillard
On Fri, Jan 08, 2010 at 05:23:27PM +, Daniel P. Berrange wrote:
 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
 

  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 */
  };

  Aren't we getting close to the 32 options limits ?


  ACK,

Daniel

-- 
Daniel Veillard  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
dan...@veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH 31/34] Add support for explicit -sdl flag to QEMU

2010-01-08 Thread Daniel P. Berrange
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@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list