On Thu, Apr 30, 2009 at 11:28:30AM +0200, Pritesh Kothari wrote:
Hi All,
I have added support for multiple graphics devices, the patches are as below.
I have checked them against current cvs head and works fine
ACK, this patch loooks good.
Daniel
diff --git a/src/domain_conf.c b/src/domain_conf.c
index bb134c0..424fd9c 100644
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -409,7 +409,9 @@ void virDomainDefFree(virDomainDefPtr def)
if (!def)
return;
- virDomainGraphicsDefFree(def->graphics);
+ for (i = 0 ; i < def->ngraphics ; i++)
+ virDomainGraphicsDefFree(def->graphics[i]);
+ VIR_FREE(def->graphics);
for (i = 0 ; i < def->ninputs ; i++)
virDomainInputDefFree(def->inputs[i]);
@@ -2427,19 +2429,21 @@ static virDomainDefPtr virDomainDefParseXML(virConnectPtr conn,
"%s", _("cannot extract graphics
devices"));
goto error;
}
- if (n > 0) {
+ if (n && VIR_ALLOC_N(def->graphics, n) < 0)
+ goto no_memory;
+ for (i = 0 ; i < n ; i++) {
virDomainGraphicsDefPtr graphics = virDomainGraphicsDefParseXML(conn,
- nodes[0],
+ nodes[i],
flags);
if (!graphics)
goto error;
- def->graphics = graphics;
+ def->graphics[def->ngraphics++] = graphics;
}
VIR_FREE(nodes);
/* If graphics are enabled, there's an implicit PS2 mouse */
- if (def->graphics != NULL) {
+ if (def->ngraphics > 0) {
virDomainInputDefPtr input;
if (VIR_ALLOC(input) < 0) {
@@ -3512,7 +3516,7 @@ char *virDomainDefFormat(virConnectPtr conn,
virDomainInputDefFormat(conn, &buf, def->inputs[n]) < 0)
goto cleanup;
- if (def->graphics) {
+ if (def->ngraphics > 0) {
/* If graphics is enabled, add the implicit mouse */
virDomainInputDef autoInput = {
VIR_DOMAIN_INPUT_TYPE_MOUSE,
@@ -3523,8 +3527,9 @@ char *virDomainDefFormat(virConnectPtr conn,
if (virDomainInputDefFormat(conn, &buf, &autoInput) < 0)
goto cleanup;
- if (virDomainGraphicsDefFormat(conn, &buf, def, def->graphics, flags)
< 0)
- goto cleanup;
+ for (n = 0 ; n < def->ngraphics ; n++)
+ if (virDomainGraphicsDefFormat(conn, &buf, def, def->graphics[n],
flags) < 0)
+ goto cleanup;
}
for (n = 0 ; n < def->nsounds ; n++)
diff --git a/src/domain_conf.h b/src/domain_conf.h
index 5fbc395..e64dcb4 100644
--- a/src/domain_conf.h
+++ b/src/domain_conf.h
@@ -457,8 +457,8 @@ struct _virDomainDef {
int localtime;
- /* Only 1 */
- virDomainGraphicsDefPtr graphics;
+ int ngraphics;
+ virDomainGraphicsDefPtr *graphics;
int ndisks;
virDomainDiskDefPtr *disks;
--
Libvir-list mailing list
Libvir-list(a)redhat.com
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 :|