From 1ea83207c815e12b1ef60f48a4663e12fbc59687 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Thu, 9 Dec 2010 18:25:11 +0000 Subject: [PATCH] Support leases in guest XML and lock manager 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 ... somearea thequickbrownfoxjumpsoverthelazydog ... 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. * 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/formatdomain.html.in | 39 +++++ docs/schemas/domain.rng | 24 ++++ src/conf/domain_conf.c | 134 ++++++++++++++++++ src/conf/domain_conf.h | 14 ++ .../qemuxml2argvdata/qemuxml2argv-lease.args | 4 + tests/qemuxml2argvdata/qemuxml2argv-lease.xml | 36 +++++ tests/qemuxml2xmltest.c | 1 + 7 files changed, 252 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-lease.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-lease.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index f8baffd66b..05171199cf 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -1071,6 +1071,45 @@ sub-element.

+

Device leases

+ +

+ When using a lock manager, it may be desirable to record device leases + against a VM. The lock manager will ensure the VM won't start unless + the leases can be acquired. +

+ +
+  ...
+  <devices>
+    ...
+    <lease>
+      <lockspace>somearea</lockspace>
+      <key>somekey</key>
+      <target path='/some/lease/path' offset='1024'/>
+    </lease>
+    ...
+  </devices>
+  ...
+ +
+
lockspace
+
This is an arbitrary string, identifying the lockspace + within which the key is held. Lock managers may impose + extra restrictions on the format, or length of the lockspace + name.
+
key
+
This is an arbitrary string, uniquely identifying the + lease to be acquired. Lock managers may impose extra + restrictions on the format, or length of the key. +
+
target
+
This is the fully qualified path of the file associated + with the lockspace. The offset specifies where the lease + is stored within the file. If the lock manager does not + require a offset, just pass 0. +
+

USB and PCI devices

diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng index c270815291..0be03711a4 100644 --- a/docs/schemas/domain.rng +++ b/docs/schemas/domain.rng @@ -586,6 +586,29 @@ + + + + + + + + + + + + + + + + + + + + + + +