]> xenbits.xensource.com Git - libvirt.git/commitdiff
generic support for RDP and desktop graphic extensions
authorDaniel Veillard <veillard@redhat.com>
Fri, 15 May 2009 09:43:51 +0000 (09:43 +0000)
committerDaniel Veillard <veillard@redhat.com>
Fri, 15 May 2009 09:43:51 +0000 (09:43 +0000)
* docs/schemas/domain.rng src/domain_conf.[ch] src/qemu_driver.c:
  extend the generic code for the RDP and desktop extensions of
  the graphic tag needed for vbox, patch by Pritesh Kothari
Daniel

ChangeLog
docs/schemas/domain.rng
src/domain_conf.c
src/domain_conf.h
src/qemu_driver.c

index a58a6bc3e6ff185c7961811d7cb3e510a6541888..f2210ca7628b04d259a3b1b5749536cd753d7ebe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri May 15 11:41:46 CEST 2009 Daniel Veillard <veillard@redhat.com>
+
+       * docs/schemas/domain.rng src/domain_conf.[ch] src/qemu_driver.c:
+         extend the generic code for the RDP and desktop extensions of
+         the graphic tag needed for vbox, patch by Pritesh Kothari
+
 Thu May 14 12:29:41 CEST 2009 Daniel Veillard <veillard@redhat.com>
 
        * src/xend_internal.c: remove [] around cpumaps for recent xend
index f1fc8c7f88f6e4db048bc69f8b69418d1a86f9e9..204c6333d9c92804b8c1b92c3c3c542d9c479434 100644 (file)
             </attribute>
           </optional>
         </group>
+        <group>
+          <attribute name="type">
+            <value>rdp</value>
+          </attribute>
+          <optional>
+            <attribute name="port">
+              <ref name="PortNumber"/>
+            </attribute>
+          </optional>
+          <optional>
+            <attribute name="autoport">
+              <choice>
+                <value>yes</value>
+                <value>no</value>
+              </choice>
+            </attribute>
+          </optional>
+          <optional>
+            <attribute name="replaceUser">
+              <choice>
+                <value>yes</value>
+                <value>no</value>
+              </choice>
+            </attribute>
+          </optional>
+          <optional>
+            <attribute name="multiUser">
+              <choice>
+                <value>yes</value>
+                <value>no</value>
+              </choice>
+            </attribute>
+          </optional>
+          <optional>
+            <attribute name="listen">
+              <ref name="addrIP"/>
+            </attribute>
+          </optional>
+        </group>
+        <group>
+          <attribute name="type">
+            <value>desktop</value>
+          </attribute>
+          <optional>
+            <attribute name="display">
+              <text/>
+            </attribute>
+          </optional>
+          <optional>
+            <attribute name="fullscreen">
+              <choice>
+                <value>yes</value>
+                <value>no</value>
+              </choice>
+            </attribute>
+          </optional>
+        </group>
       </choice>
     </element>
   </define>
index 00aceef5b3e28b678f76179ec0753b789e9c6050..d7c4166d4c8bf7cbeb03e6270ec8dcdf58e79def 100644 (file)
@@ -151,7 +151,9 @@ VIR_ENUM_IMPL(virDomainInputBus, VIR_DOMAIN_INPUT_BUS_LAST,
 
 VIR_ENUM_IMPL(virDomainGraphics, VIR_DOMAIN_GRAPHICS_TYPE_LAST,
               "sdl",
-              "vnc")
+              "vnc",
+              "rdp",
+              "desktop")
 
 VIR_ENUM_IMPL(virDomainHostdevMode, VIR_DOMAIN_HOSTDEV_MODE_LAST,
               "subsystem",
@@ -245,6 +247,14 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
         VIR_FREE(def->data.sdl.display);
         VIR_FREE(def->data.sdl.xauth);
         break;
+
+    case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+        VIR_FREE(def->data.rdp.listenAddr);
+        break;
+
+    case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+        VIR_FREE(def->data.desktop.display);
+        break;
     }
 
     VIR_FREE(def);
@@ -1521,6 +1531,68 @@ virDomainGraphicsDefParseXML(virConnectPtr conn,
             def->data.sdl.fullscreen = 0;
         def->data.sdl.xauth = virXMLPropString(node, "xauth");
         def->data.sdl.display = virXMLPropString(node, "display");
+    } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP) {
+        char *port = virXMLPropString(node, "port");
+        char *autoport;
+        char *replaceUser;
+        char *multiUser;
+
+        if (port) {
+            if (virStrToLong_i(port, NULL, 10, &def->data.rdp.port) < 0) {
+                virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                                     _("cannot parse rdp port %s"), port);
+                VIR_FREE(port);
+                goto error;
+            }
+            VIR_FREE(port);
+        } else {
+            def->data.rdp.port = 0;
+            def->data.rdp.autoport = 1;
+        }
+
+        if ((autoport = virXMLPropString(node, "autoport")) != NULL) {
+            if (STREQ(autoport, "yes")) {
+                if (flags & VIR_DOMAIN_XML_INACTIVE)
+                    def->data.rdp.port = 0;
+                def->data.rdp.autoport = 1;
+            }
+            VIR_FREE(autoport);
+        }
+
+        if ((replaceUser = virXMLPropString(node, "replaceUser")) != NULL) {
+            if (STREQ(replaceUser, "yes")) {
+                def->data.rdp.replaceUser = 1;
+            }
+            VIR_FREE(replaceUser);
+        }
+
+        if ((multiUser = virXMLPropString(node, "multiUser")) != NULL) {
+            if (STREQ(multiUser, "yes")) {
+                def->data.rdp.multiUser = 1;
+            }
+            VIR_FREE(multiUser);
+        }
+
+        def->data.rdp.listenAddr = virXMLPropString(node, "listen");
+    } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP) {
+        char *fullscreen = virXMLPropString(node, "fullscreen");
+
+        if (fullscreen != NULL) {
+            if (STREQ(fullscreen, "yes")) {
+                def->data.desktop.fullscreen = 1;
+            } else if (STREQ(fullscreen, "no")) {
+                def->data.desktop.fullscreen = 0;
+            } else {
+                virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("unknown fullscreen value '%s'"), fullscreen);
+                VIR_FREE(fullscreen);
+                goto error;
+            }
+            VIR_FREE(fullscreen);
+        } else
+            def->data.desktop.fullscreen = 0;
+
+        def->data.desktop.display = virXMLPropString(node, "display");
     }
 
 cleanup:
@@ -3295,6 +3367,38 @@ virDomainGraphicsDefFormat(virConnectPtr conn,
             virBufferAddLit(buf, " fullscreen='yes'");
 
         break;
+
+    case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
+        if (def->data.rdp.port)
+            virBufferVSprintf(buf, " port='%d'",
+                              def->data.rdp.port);
+        else if (def->data.rdp.autoport)
+            virBufferAddLit(buf, " port='0'");
+
+        if (def->data.rdp.autoport)
+            virBufferVSprintf(buf, " autoport='yes'");
+
+        if (def->data.rdp.replaceUser)
+            virBufferVSprintf(buf, " replaceUser='yes'");
+
+        if (def->data.rdp.multiUser)
+            virBufferVSprintf(buf, " multiUser='yes'");
+
+        if (def->data.rdp.listenAddr)
+            virBufferVSprintf(buf, " listen='%s'", def->data.rdp.listenAddr);
+
+        break;
+
+    case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
+        if (def->data.desktop.display)
+            virBufferEscapeString(buf, " display='%s'",
+                                  def->data.desktop.display);
+
+        if (def->data.desktop.fullscreen)
+            virBufferAddLit(buf, " fullscreen='yes'");
+
+        break;
+
     }
 
     virBufferAddLit(buf, "/>\n");
index c0a5288cbf9f1c7482129b48e31103cc74273236..a8ab99ebdcd95eda5a11bd814060708530e46d3a 100644 (file)
@@ -268,6 +268,8 @@ struct _virDomainSoundDef {
 enum virDomainGraphicsType {
     VIR_DOMAIN_GRAPHICS_TYPE_SDL,
     VIR_DOMAIN_GRAPHICS_TYPE_VNC,
+    VIR_DOMAIN_GRAPHICS_TYPE_RDP,
+    VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP,
 
     VIR_DOMAIN_GRAPHICS_TYPE_LAST,
 };
@@ -289,6 +291,17 @@ struct _virDomainGraphicsDef {
             char *xauth;
             int fullscreen;
         } sdl;
+        struct {
+            int port;
+            char *listenAddr;
+            int autoport : 1;
+            int replaceUser : 1;
+            int multiUser : 1;
+        } rdp;
+        struct {
+            char *display;
+            int fullscreen : 1;
+        } desktop;
     } data;
 };
 
index bd60b29c1a4213b20195eecbda97515dd8dbc255..67b5e1c963759c3eaa785e849635d0b44191e534 100644 (file)
@@ -4841,6 +4841,7 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
                               vm->def->name);
             goto cleanup;
         }
+        virDomainObjUnlock(vm);
     }
 
     if (!(vm = virDomainAssignDef(dconn,