[Libvir] Update XML -> SEXPR conversion for new PVFB syntax

Previously I sent a patch to handle parsing of the new PVFB syntax. This patch provides the counterpart - generating the new syntax when creating paravirt guests. We only enable the new style syntax if using xendConfigVersion 3 or later (ie, 3.0.4), and only for PV guests. HVM and older PV guests still use old style syntax. In this I also added support for vnclisten & vncpasswd parameters mapped to the 'listen' and 'passwd' attributes on the XML <graphics> tag. Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Mon, Dec 11, 2006 at 08:58:45PM +0000, Daniel P. Berrange wrote:
Previously I sent a patch to handle parsing of the new PVFB syntax. This patch provides the counterpart - generating the new syntax when creating paravirt guests. We only enable the new style syntax if using xendConfigVersion 3 or later (ie, 3.0.4), and only for PV guests. HVM and older PV guests still use old style syntax.
okay
In this I also added support for vnclisten & vncpasswd parameters mapped to the 'listen' and 'passwd' attributes on the XML <graphics> tag.
right we discussed that before
RCS file: /data/cvs/libvirt/src/xend_internal.c,v retrieving revision 1.80 diff -u -p -r1.80 xend_internal.c --- src/xend_internal.c 7 Dec 2006 18:23:19 -0000 1.80 +++ src/xend_internal.c 11 Dec 2006 17:36:52 -0000
XML generation with new graphics data, fine.
+ if (xmlStrEqual(graphics_type, BAD_CAST "sdl")) { + virBufferAdd(buf, "(type sdl)", 10); + // TODO: + // Need to understand sdl options + // + //virBufferAdd(buf, "(display localhost:10.0)", 24); + //virBufferAdd(buf, "(xauthority /root/.Xauthority)", 30);
Let's avoid C++ style comments if possible.
+ /* New style PVFB config - 3.0.4 merge */ + if (xendConfigVersion >= 3 && !hvm) { + obj = xmlXPathEval(BAD_CAST "/domain/devices/graphics", ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) { + for (i = 0; i < obj->nodesetval->nodeNr; i++) { + res = virDomainParseXMLGraphicsDescNew(obj->nodesetval->nodeTab[i], &buf);
So if using HVM, we still call virDomainParseXMLGraphicsDescOld, even if using the new interface, maybe the renaming New/Old is not perfect then, because that's not the only factor in selecting one or the other. But it's rather a stylistic comment :-) Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Tue, Dec 12, 2006 at 08:34:08AM -0500, Daniel Veillard wrote:
On Mon, Dec 11, 2006 at 08:58:45PM +0000, Daniel P. Berrange wrote:
+ if (xmlStrEqual(graphics_type, BAD_CAST "sdl")) { + virBufferAdd(buf, "(type sdl)", 10); + // TODO: + // Need to understand sdl options + // + //virBufferAdd(buf, "(display localhost:10.0)", 24); + //virBufferAdd(buf, "(xauthority /root/.Xauthority)", 30);
Let's avoid C++ style comments if possible.
Opps, that was copy & pasted from original code. I've fixed this & the original to use C scomments.
+ /* New style PVFB config - 3.0.4 merge */ + if (xendConfigVersion >= 3 && !hvm) { + obj = xmlXPathEval(BAD_CAST "/domain/devices/graphics", ctxt); + if ((obj != NULL) && (obj->type == XPATH_NODESET) && + (obj->nodesetval != NULL) && (obj->nodesetval->nodeNr >= 0)) { + for (i = 0; i < obj->nodesetval->nodeNr; i++) { + res = virDomainParseXMLGraphicsDescNew(obj->nodesetval->nodeTab[i], &buf);
So if using HVM, we still call virDomainParseXMLGraphicsDescOld, even if using the new interface, maybe the renaming New/Old is not perfect then, because that's not the only factor in selecting one or the other. But it's rather a stylistic comment :-)
Renamed to virDomainParseXMLGraphicsDescVFB and virDomainParseXMLGraphicsDescImage to reflect where they appear in the SEXPR. Regards, Dan. -- |=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=| |=- Perl modules: http://search.cpan.org/~danberr/ -=| |=- Projects: http://freshmeat.net/~danielpb/ -=| |=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|

On Wed, Dec 13, 2006 at 02:09:02PM +0000, Daniel P. Berrange wrote:
On Tue, Dec 12, 2006 at 08:34:08AM -0500, Daniel Veillard wrote:
So if using HVM, we still call virDomainParseXMLGraphicsDescOld, even if using the new interface, maybe the renaming New/Old is not perfect then, because that's not the only factor in selecting one or the other. But it's rather a stylistic comment :-)
Renamed to virDomainParseXMLGraphicsDescVFB and virDomainParseXMLGraphicsDescImage to reflect where they appear in the SEXPR.
Cool, thanks ! Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard