On 05/11/2011 03:33 AM, Daniel P. Berrange wrote: > A lock manager may operate in various modes. The direct mode of > operation is to obtain locks based on the resources associated > with devices in the XML. The indirect mode is where the app > creating the domain provides explicit leases for each resource > that needs to be locked. This XML extension allows for listing > resources in the XML > > <devices> > ... > <lease> > <lockspace>somearea</lockspace> > <key>thequickbrownfoxjumpsoverthelazydog</key> > <target path='/some/lease/path' offset='23432'/> > </lease> > ... > </devices> > > The 'lockspace' is a unique identifier for the lockspace which > the lease is associated > > The 'key' is a unique identifier for the resource associated > with the lease. > > The 'target' is the file on disk where the leases are held. Sounds reasonable on the XML front. However, > > * docs/schemas/domain.rng: Add lease schema > * src/conf/domain_conf.c, src/conf/domain_conf.h: parsing and > formatting for leases > * tests/qemuxml2argvdata/qemuxml2argv-lease.args, > tests/qemuxml2argvdata/qemuxml2argv-lease.xml, > tests/qemuxml2xmltest.c: Test XML handling for leases > --- > docs/schemas/domain.rng | 22 ++++ Patch is incomplete - you need something in docs/formatdomain.html.in before you can commit this. > +++ b/docs/schemas/domain.rng > @@ -586,6 +586,27 @@ > <ref name="address"/> > </optional> > </define> > + > + <define name="lease"> > + <element name="lease"> <interleave> > + <element name="lockspace"> > + <text/> > + </element> > + <element name="key"> > + <text/> > + </element> > + <element name="target"> > + <attribute name="path"> > + <text/> > + </attribute> > + <optional> > + <attribute name="offset"> > + <ref name="unsignedInt"/> > + </attribute> > + </optional> > + </element> </interleave> > + </element> > + </define> > + > + cur = node->children; > + while (cur != NULL) { > + if (cur->type == XML_ELEMENT_NODE) { > + if ((key == NULL) && > + (xmlStrEqual(cur->name, BAD_CAST "key"))) { > + key = (char *)xmlNodeGetContent(cur); > + } else if ((lockspace == NULL) && > + (xmlStrEqual(cur->name, BAD_CAST "lockspace"))) { > + lockspace = (char *)xmlNodeGetContent(cur); > + } else if ((path == NULL) && > + (xmlStrEqual(cur->name, BAD_CAST "target"))) { > + path = virXMLPropString(cur, "path"); > + offset = virXMLPropString(cur, "offset"); > + } Do we want to reject unknown elements? Here, you just silently ignore them. > +++ b/tests/qemuxml2argvdata/qemuxml2argv-lease.args > @@ -0,0 +1 @@ > +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -cdrom /root/boot.iso -net none -serial none -parallel none -usb Please break this file up, using backslash-newline, so that it generally fits in 80 columns. -- Eric Blake eblake@xxxxxxxxxx +1-801-349-2682 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list