Re: [libvirt] [PATCH 1/3] qemu: new vnc display sharing policy caps flag

2013-05-07 Thread Ján Tomko
On 05/06/2013 03:19 PM, Guannan Ren wrote:
 QEMU_CAPS_VNC_DISPLAY_POLICY (qemu = v1.10)
 ---
  docs/formatdomain.html.in | 13 +++--
  docs/schemas/domaincommon.rng |  9 +
  src/qemu/qemu_capabilities.c  | 12 
  src/qemu/qemu_capabilities.h  |  1 +
  tests/qemuhelptest.c  |  9 ++---
  5 files changed, 35 insertions(+), 9 deletions(-)
 
 diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
 index 572d7ee..50aa2db 100644
 --- a/docs/formatdomain.html.in
 +++ b/docs/formatdomain.html.in
 @@ -3493,7 +3493,7 @@ qemu-kvm -net nic,model=? /dev/null
...
lt;devicesgt;
  lt;graphics type='sdl' display=':0.0'/gt;
 -lt;graphics type='vnc' port='5904'gt;
 +lt;graphics type='vnc' port='5904' policy='allow-exclusive'gt;
lt;listen type='address' address='1.2.3.4'/gt;
  lt;/graphicsgt;
  lt;graphics type='rdp' autoport='yes' multiUser='yes' /gt;
 @@ -3536,7 +3536,16 @@ qemu-kvm -net nic,model=? /dev/null
  allows control of connected client during password changes.
  VNC accepts codekeep/code value only.
  span class=sincesince 0.9.3/span
 -NB, this may not be supported by all hypervisors.br/  br/
 +NB, this may not be supported by all hypervisors.br/
 +The optional codepolicy/code attribute specifies vnc server
 +display sharing policy. allow-exclusive allows clients to ask
 +for exclusive access by dropping other connections. Connecting
 +multiple clients in parallel requires all clients asking for a
 +shared session (vncviewer: -Shared switch). This is the default
 +value. force-shared disables exclusive client access, every
 +connection has to specify -Shared switch for vncviewer. ignore
 +welcomes every connection unconditionally
 +span class=sincesince 1.0.6/span. br/ br/
  Rather than using listen/port, QEMU supports a
  codesocket/code attribute for listening on a unix
  domain socket path.span class=sinceSince 0.8.8/span
 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
 index 10596dc..c3a7fbd 100644
 --- a/docs/schemas/domaincommon.rng
 +++ b/docs/schemas/domaincommon.rng
 @@ -2075,6 +2075,15 @@
ref name=addrIPorName/
  /attribute
/optional
 +  optional
 +attribute name='policy'
 +  choice
 +valueallow-exclusive/value
 +valueforce-shared/value
 +valueignore/value
 +  /choice
 +/attribute
 +  /optional
  /group
  group
optional

These two hunks seem like they would fit better in the later patches.
And naming the attribute 'sharingPolicy' or just 'sharing' might be more clear.

 diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
 index a3a8d1f..d758691 100644
 --- a/src/qemu/qemu_capabilities.c
 +++ b/src/qemu/qemu_capabilities.c
 @@ -221,9 +221,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
tpm-tis,
  
nvram,  /* 140 */
 -  pci-bridge, /* 141 */
 -  vfio-pci, /* 142 */
 -  vfio-pci.bootindex, /* 143 */
 +  pci-bridge,
 +  vfio-pci,
 +  vfio-pci.bootindex,
 +  vnc-display-policy,
  );
  

Oops, I seem to have started a trend when I forgot to delete that comment
after rebase :)

  struct _virQEMUCaps {
 @@ -1181,8 +1182,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
  if (version = 11000)
  virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
  
 -if (version = 1001000)
 +if (version = 1001000) {
  virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION);
 +virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_DISPLAY_POLICY);
 +}
  
  if (version = 1002000)
  virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);

Is there a help string we could look for instead of setting it based on version?

 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
 index 213f63c..ec39325 100644
 --- a/src/qemu/qemu_capabilities.h
 +++ b/src/qemu/qemu_capabilities.h
 @@ -182,6 +182,7 @@ enum virQEMUCapsFlags {
  QEMU_CAPS_DEVICE_PCI_BRIDGE  = 141, /* -device pci-bridge */
  QEMU_CAPS_DEVICE_VFIO_PCI= 142, /* -device vfio-pci */
  QEMU_CAPS_VFIO_PCI_BOOTINDEX = 143, /* bootindex param for vfio-pci 
 device */
 +QEMU_CAPS_VNC_DISPLAY_POLICY = 144, /* set display sharing policy */
  
  QEMU_CAPS_LAST,   /* this must always be the last item */
  };

IMHO VNC_SHARING_POLICY would be more fitting.

Jan

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


Re: [libvirt] [PATCH 1/3] qemu: new vnc display sharing policy caps flag

2013-05-07 Thread Eric Blake
On 05/07/2013 01:51 AM, Ján Tomko wrote:
 On 05/06/2013 03:19 PM, Guannan Ren wrote:
 QEMU_CAPS_VNC_DISPLAY_POLICY (qemu = v1.10)

Huh?  qemu is at 1.5, not 1.10.  Based on your code, you meant 1.1.


 -if (version = 1001000)
 +if (version = 1001000) {
  virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION);
 +virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_DISPLAY_POLICY);
 +}
  
  if (version = 1002000)
  virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
 
 Is there a help string we could look for instead of setting it based on 
 version?

Yuck - it looks like neither 1.1 nor 1.2 exposed this information in
their -help output (at least, based on tests/qemuhelpdata contents).  I
don't see any -device probing we can do either.  Even with the new
query-command-line-options in qemu 1.5-rc1 (hmm, my patch series is
still pending[1]), I get an error trying to do

{execute:query-command-line-options,arguments:{option:vnc}}
{error: {class: GenericError, desc: invalid option name: vnc}}

I think we are indeed stuck with a hard-coded version probe, which is
annoying for backport purposes.

[1] https://www.redhat.com/archives/libvir-list/2013-April/msg01968.html

-- 
Eric Blake   eblake redhat com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH 1/3] qemu: new vnc display sharing policy caps flag

2013-05-06 Thread Guannan Ren
QEMU_CAPS_VNC_DISPLAY_POLICY (qemu = v1.10)
---
 docs/formatdomain.html.in | 13 +++--
 docs/schemas/domaincommon.rng |  9 +
 src/qemu/qemu_capabilities.c  | 12 
 src/qemu/qemu_capabilities.h  |  1 +
 tests/qemuhelptest.c  |  9 ++---
 5 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 572d7ee..50aa2db 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -3493,7 +3493,7 @@ qemu-kvm -net nic,model=? /dev/null
   ...
   lt;devicesgt;
 lt;graphics type='sdl' display=':0.0'/gt;
-lt;graphics type='vnc' port='5904'gt;
+lt;graphics type='vnc' port='5904' policy='allow-exclusive'gt;
   lt;listen type='address' address='1.2.3.4'/gt;
 lt;/graphicsgt;
 lt;graphics type='rdp' autoport='yes' multiUser='yes' /gt;
@@ -3536,7 +3536,16 @@ qemu-kvm -net nic,model=? /dev/null
 allows control of connected client during password changes.
 VNC accepts codekeep/code value only.
 span class=sincesince 0.9.3/span
-NB, this may not be supported by all hypervisors.br/  br/
+NB, this may not be supported by all hypervisors.br/
+The optional codepolicy/code attribute specifies vnc server
+display sharing policy. allow-exclusive allows clients to ask
+for exclusive access by dropping other connections. Connecting
+multiple clients in parallel requires all clients asking for a
+shared session (vncviewer: -Shared switch). This is the default
+value. force-shared disables exclusive client access, every
+connection has to specify -Shared switch for vncviewer. ignore
+welcomes every connection unconditionally
+span class=sincesince 1.0.6/span. br/ br/
 Rather than using listen/port, QEMU supports a
 codesocket/code attribute for listening on a unix
 domain socket path.span class=sinceSince 0.8.8/span
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 10596dc..c3a7fbd 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -2075,6 +2075,15 @@
   ref name=addrIPorName/
 /attribute
   /optional
+  optional
+attribute name='policy'
+  choice
+valueallow-exclusive/value
+valueforce-shared/value
+valueignore/value
+  /choice
+/attribute
+  /optional
 /group
 group
   optional
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index a3a8d1f..d758691 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -221,9 +221,10 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
   tpm-tis,
 
   nvram,  /* 140 */
-  pci-bridge, /* 141 */
-  vfio-pci, /* 142 */
-  vfio-pci.bootindex, /* 143 */
+  pci-bridge,
+  vfio-pci,
+  vfio-pci.bootindex,
+  vnc-display-policy,
 );
 
 struct _virQEMUCaps {
@@ -1181,8 +1182,10 @@ virQEMUCapsComputeCmdFlags(const char *help,
 if (version = 11000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_CPU_HOST);
 
-if (version = 1001000)
+if (version = 1001000) {
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION);
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_DISPLAY_POLICY);
+}
 
 if (version = 1002000)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY);
@@ -2383,6 +2386,7 @@ virQEMUCapsInitQMPBasic(virQEMUCapsPtr qemuCaps)
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_IPV6_MIGRATION);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_MACHINE_OPT);
 virQEMUCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_CORE);
+virQEMUCapsSet(qemuCaps, QEMU_CAPS_VNC_DISPLAY_POLICY);
 }
 
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 213f63c..ec39325 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -182,6 +182,7 @@ enum virQEMUCapsFlags {
 QEMU_CAPS_DEVICE_PCI_BRIDGE  = 141, /* -device pci-bridge */
 QEMU_CAPS_DEVICE_VFIO_PCI= 142, /* -device vfio-pci */
 QEMU_CAPS_VFIO_PCI_BOOTINDEX = 143, /* bootindex param for vfio-pci device 
*/
+QEMU_CAPS_VNC_DISPLAY_POLICY = 144, /* set display sharing policy */
 
 QEMU_CAPS_LAST,   /* this must always be the last item */
 };
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index fa56406..9894222 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -822,7 +822,8 @@ mymain(void)
 QEMU_CAPS_DEVICE_USB_NET,
 QEMU_CAPS_DTB,
 QEMU_CAPS_IPV6_MIGRATION,
-QEMU_CAPS_DEVICE_PCI_BRIDGE);
+QEMU_CAPS_DEVICE_PCI_BRIDGE,
+