On Thu, Apr 30, 2009 at 04:15:27PM +0200, Pritesh Kothari wrote: > Hi All, > > As per the discussion earlier on the list I have modified the rdp type and > added a new desktop type and posting the patch for same. ACK, this looks good to me. Daniel > diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng > index 2f784e1..5e4aa5b 100644 > --- a/docs/schemas/domain.rng > +++ b/docs/schemas/domain.rng > @@ -711,6 +711,63 @@ > </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> > diff --git a/src/domain_conf.c b/src/domain_conf.c > index ed4b8e5..4030fa0 100644 > --- a/src/domain_conf.c > +++ b/src/domain_conf.c > @@ -150,7 +150,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", > @@ -244,6 +246,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); > @@ -1501,6 +1511,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: > @@ -3269,6 +3341,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"); > diff --git a/src/domain_conf.h b/src/domain_conf.h > index 84fc477..1d12fea 100644 > --- a/src/domain_conf.h > +++ b/src/domain_conf.h > @@ -264,6 +264,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, > }; > @@ -285,6 +287,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; > }; > > -- > Libvir-list mailing list > Libvir-list@xxxxxxxxxx > https://www.redhat.com/mailman/listinfo/libvir-list -- |: 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@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list