On 05/11/2012 03:14 PM, Guido Günther wrote:
---
docs/formatdomain.html.in | 12 ++++++
docs/schemas/domaincommon.rng | 12 ++++++
src/conf/domain_conf.c | 88 +++++++++++++++++++++++++++++++++++++++--
src/conf/domain_conf.h | 2 +
4 files changed, 111 insertions(+), 3 deletions(-)
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index e1fe0c4..8ef20c0 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1673,6 +1673,18 @@
default read-write access is given (currently only works for
QEMU/KVM driver).
</dd>
+
+ <dt><code>space_hard_limit</code></dt>
+ <dd>
+ Maximum space available to this guests's filesystem.
+ </dd>
+
+ <dt><code>space_soft_limit</code></dt>
+ <dd>
+ Maximum space available to this guest's filesystem. The container is
+ is permitted to exceed its soft limits for a grace period of time. Afterwards
+ the hard limit is enforced.
Needs a <span class="since">Since 0.9.13</span>.
+++ b/src/conf/domain_conf.c
@@ -4086,14 +4086,72 @@ cleanup:
goto cleanup;
}
+
+/* Parse a value located at XPATH within CTXT, and store the
+ * result into val. If REQUIRED, then the value must exist;
+ * otherwise, the value is optional. The value is in bytes.
+ * Return 0 on success, -1 on failure after issuing error. */
+static int
+virDomainParseScaledValue(const char *xpath,
+ xmlXPathContextPtr ctxt,
+ unsigned long long *val,
+ unsigned long long scale,
+ unsigned long long max,
+ bool required)
+{
Looks like this is a generalization of virDomainParseMemory; I'd like to
see that function refactored to use this function instead of duplicating
the bulk of the code between the two functions. In fact, it might even
be worth to add this function and do the refactoring as a pre-req patch.
static virDomainFSDefPtr
virDomainFSDefParseXML(xmlNodePtr node,
+ xmlXPathContextPtr ctxt,
unsigned int flags) {
virDomainFSDefPtr def;
- xmlNodePtr cur;
+ xmlNodePtr cur, safe_node = ctxt->node;
s/safe_node/save_node/, here and below
@@ -11101,6 +11175,14 @@ virDomainFSDefFormat(virBufferPtr buf,
if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
return -1;
+
+ if (def->space_hard_limit)
+ virBufferAsprintf(buf, " <space_hard_limit
unit='B'>"
s/B/bytes/, to match what we've done in storage_conf.c.
Probably worth a v3, but I like where it's heading.
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org