-vnc :5900,share=allow-exclusive
allows clients to ask for exclusive access which is
implemented by dropping  other connections Connecting
multiple clients in parallel requires all clients asking
for a shared session (vncviewer: -shared switch)

 -vnc :5900,share=force-shared
disables exclusive client access.  Useful for shared
desktop sessions, where you don't want someone forgetting
specify -shared disconnect everybody else.

 -vnc :5900,share=ignore
completely ignores the shared flag and allows everybody
connect unconditionally
---
 src/conf/domain_conf.c   | 28 ++++++++++++++++++++++++++++
 src/conf/domain_conf.h   | 11 +++++++++++
 src/libvirt_private.syms |  2 ++
 3 files changed, 41 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fe97c02..eaa0b0e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -513,6 +513,13 @@ VIR_ENUM_IMPL(virDomainGraphicsAuthConnected,
               "disconnect",
               "keep")
 
+VIR_ENUM_IMPL(virDomainGraphicsVNCDisplaySharingPolicy,
+              VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_LAST,
+              "default",
+              "allow-exclusive",
+              "force-shared",
+              "ignore")
+
 VIR_ENUM_IMPL(virDomainGraphicsSpiceChannelName,
               VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST,
               "main",
@@ -7545,6 +7552,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
     if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
         char *port = virXMLPropString(node, "port");
         char *autoport;
+        char *policy;
 
         if (port) {
             if (virStrToLong_i(port, NULL, 10, &def->data.vnc.port) < 0) {
@@ -7574,6 +7582,21 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
             VIR_FREE(autoport);
         }
 
+        if ((policy = virXMLPropString(node, "policy")) != NULL) {
+            int sharingPolicy =
+               virDomainGraphicsVNCDisplaySharingPolicyTypeFromString(policy);
+
+            if (sharingPolicy < 0) {
+                virReportError(VIR_ERR_INTERNAL_ERROR,
+                               _("unknown vnc display sharing policy '%s'"), 
policy);
+                VIR_FREE(policy);
+                goto error;
+            } else {
+                def->data.vnc.sharingPolicy = sharingPolicy;
+            }
+            VIR_FREE(policy);
+        }
+
         def->data.vnc.socket = virXMLPropString(node, "socket");
         def->data.vnc.keymap = virXMLPropString(node, "keymap");
 
@@ -14986,6 +15009,11 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
             virBufferEscapeString(buf, " keymap='%s'",
                                   def->data.vnc.keymap);
 
+        if (def->data.vnc.sharingPolicy)
+            virBufferAsprintf(buf, " policy='%s'",
+                              
virDomainGraphicsVNCDisplaySharingPolicyTypeToString(
+                              def->data.vnc.sharingPolicy));
+
         virDomainGraphicsAuthDefFormatAttr(buf, &def->data.vnc.auth, flags);
         break;
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 21f7ce2..05137ca 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1284,6 +1284,15 @@ struct _virDomainGraphicsAuthDef {
     int connected; /* action if connected */
 };
 
+enum virDomainGraphicsVNCDisplaySharingPolicy {
+    VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_DEFAULT = 0,
+    VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_ALLOW_EXCLUSIVE,
+    VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_FORCE_SHARED,
+    VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_IGNORE,
+
+    VIR_DOMAIN_GRAPHICS_VNC_DISPLAY_LAST
+};
+
 enum virDomainGraphicsSpiceChannelName {
     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MAIN,
     VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_DISPLAY,
@@ -1404,6 +1413,7 @@ struct _virDomainGraphicsDef {
             char *keymap;
             char *socket;
             virDomainGraphicsAuthDef auth;
+            int sharingPolicy;
         } vnc;
         struct {
             char *display;
@@ -2493,6 +2503,7 @@ VIR_ENUM_DECL(virDomainInputBus)
 VIR_ENUM_DECL(virDomainGraphics)
 VIR_ENUM_DECL(virDomainGraphicsListen)
 VIR_ENUM_DECL(virDomainGraphicsAuthConnected)
+VIR_ENUM_DECL(virDomainGraphicsVNCDisplaySharingPolicy)
 VIR_ENUM_DECL(virDomainGraphicsSpiceChannelName)
 VIR_ENUM_DECL(virDomainGraphicsSpiceChannelMode)
 VIR_ENUM_DECL(virDomainGraphicsSpiceImageCompression)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index d4cb4a3..6fdaa02 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -201,6 +201,8 @@ virDomainGraphicsSpiceZlibCompressionTypeFromString;
 virDomainGraphicsSpiceZlibCompressionTypeToString;
 virDomainGraphicsTypeFromString;
 virDomainGraphicsTypeToString;
+virDomainGraphicsVNCDisplaySharingPolicyTypeFromString;
+virDomainGraphicsVNCDisplaySharingPolicyTypeToString;
 virDomainHasDiskMirror;
 virDomainHostdevCapsTypeToString;
 virDomainHostdevDefAlloc;
-- 
1.8.1.4

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

Reply via email to