[libvirt] [PATCH 2/8] Support leases in guest XML and lock manager
Eric Blake
eblake at redhat.com
Thu May 12 22:37:23 UTC 2011
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110512/24d63676/attachment-0001.sig>
More information about the libvir-list
mailing list