[PATCHv2 2/4] openvz: support file system quota reporting

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/openvz/openvz_conf.c                        |   16 ++++++++++++++++
 tests/domainschemadata/domain-openvz-simple.xml |    2 ++
 2 files changed, 18 insertions(+)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 5f107ed..44637d8 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -407,6 +407,8 @@ openvzReadFSConf(virDomainDefPtr def,
     virDomainFSDefPtr fs = NULL;
     char *veid_str = NULL;
     char *temp = NULL;
+    const char *param;
+    unsigned long long barrier, limit;
 
     ret = openvzReadVPSConfigParam(veid, "OSTEMPLATE", &temp);
     if (ret < 0) {
@@ -444,6 +446,20 @@ openvzReadFSConf(virDomainDefPtr def,
 
     fs->dst = strdup("/");
 
+    param = "DISKSPACE";
+    ret = openvzReadVPSConfigParam(veid, param, &temp);
+    if (ret > 0) {
+        if (openvzParseBarrierLimit(temp, &barrier, &limit)) {
+            openvzError(VIR_ERR_INTERNAL_ERROR,
+                        _("Could not read '%s' from config for container %d"),
+                        param, veid);
+            goto error;
+        } else {
+            fs->space_soft_limit = barrier * 1024; /* unit is bytes */
+            fs->space_hard_limit = limit * 1024;   /* unit is bytes */
+        }
+    }
+
     if (fs->src == NULL || fs->dst == NULL)
         goto no_memory;
 
diff --git a/tests/domainschemadata/domain-openvz-simple.xml b/tests/domainschemadata/domain-openvz-simple.xml
index a121d39..949e96d 100644
--- a/tests/domainschemadata/domain-openvz-simple.xml
+++ b/tests/domainschemadata/domain-openvz-simple.xml
@@ -21,6 +21,8 @@
     <filesystem type='template' accessmode='passthrough'>
       <source name='debian'/>
       <target dir='/'/>
+      <space_hard_limit>1153024</space_hard_limit>
+      <space_soft_limit>1048576</space_soft_limit>
     </filesystem>
   </devices>
 </domain>
-- 
1.7.10

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]