generic support for RDP and desktop graphic extensions

* 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
This commit is contained in:
Daniel Veillard 2009-05-15 09:43:51 +00:00
parent fa1ceca232
commit cd223d93da
5 changed files with 182 additions and 1 deletions

View File

@ -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

View File

@ -725,6 +725,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>

View 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");

View 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;
};

View File

@ -4841,6 +4841,7 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
vm->def->name);
goto cleanup;
}
virDomainObjUnlock(vm);
}
if (!(vm = virDomainAssignDef(dconn,