On Fri, Jan 08, 2010 at 05:22:59PM +0000, Daniel P. Berrange wrote: > Introduce a new structure > > struct _virDomainDeviceDriveAddress { > unsigned int controller; > unsigned int bus; > unsigned int unit; > }; > > and plug that into virDomainDeviceAddress and generates XML that > looks like > > <address type='drive' controller='1' bus='0' unit='5'/> > > This syntax will be used by the QEMU driver to explicitly control > how drives are attached to the bus > > * src/conf/domain_conf.h, src/conf/domain_conf.c: Parsing and > formatting of drive addresses > * docs/schemas/domain.rng: Define new address format for drives [...] > @@ -1434,6 +1455,21 @@ > <param name="pattern">(0x)?[0-7]</param> > </data> > </define> > + <define name="driveController"> > + <data type="string"> > + <param name="pattern">[0-9]{1,2}</param> > + </data> > + </define> > + <define name="driveBus"> > + <data type="string"> > + <param name="pattern">[0-9]{1,2}</param> > + </data> > + </define> > + <define name="driveUnit"> > + <data type="string"> > + <param name="pattern">[0-9]{1,2}</param> > + </data> > + </define> > <define name="featureName"> > <data type="string"> > <param name='pattern'>[a-zA-Z0-9\-_]+</param> [...] > +static int > +virDomainDeviceDriveAddressParseXML(virConnectPtr conn, > + xmlNodePtr node, > + virDomainDeviceDriveAddressPtr addr) > +{ > + char *bus, *unit, *controller; > + int ret = -1; > + > + memset(addr, 0, sizeof(*addr)); > + > + controller = virXMLPropString(node, "controller"); > + bus = virXMLPropString(node, "bus"); > + unit = virXMLPropString(node, "unit"); > + > + if (controller && > + virStrToLong_ui(controller, NULL, 10, &addr->controller) < 0) { > + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s", > + _("Cannot parse <address> 'controller' attribute")); > + goto cleanup; > + } > + > + if (bus && > + virStrToLong_ui(bus, NULL, 10, &addr->bus) < 0) { > + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s", > + _("Cannot parse <address> 'bus' attribute")); > + goto cleanup; > + } > + > + if (unit && > + virStrToLong_ui(unit, NULL, 10, &addr->unit) < 0) { > + virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s", > + _("Cannot parse <address> 'unit' attribute")); > + goto cleanup; > + } There is also a mismatch here, as the RNG will allow only values 0-99 and the parsing will allow any unsigned decimal. But again that's not a blocker, the issue could be fixed later, just keep a comment somewhere about the todo on the parser side. ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@xxxxxxxxxxxx | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/ -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list