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

[libvirt] [PATCH 08/11] conf: Change virDomainCputune member 'shares' to unsigned long long



cgroup functions set and get the longer type so use it everywhere
---
 src/conf/domain_conf.c | 6 +++---
 src/conf/domain_conf.h | 2 +-
 src/lxc/lxc_native.c   | 2 +-
 src/vmx/vmx.c          | 6 +++---
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index fb05bf7..7108c7e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -15528,8 +15528,8 @@ virDomainDefParseXML(xmlDocPtr xml,
         goto error;

     /* Extract cpu tunables. */
-    if ((n = virXPathULong("string(./cputune/shares[1])", ctxt,
-                           &def->cputune.shares)) < -1) {
+    if ((n = virXPathULongLong("string(./cputune/shares[1])", ctxt,
+                               &def->cputune.shares)) < -1) {
         virReportError(VIR_ERR_XML_ERROR, "%s",
                        _("can't parse cputune shares value"));
         goto error;
@@ -22158,7 +22158,7 @@ virDomainCputuneDefFormat(virBufferPtr buf,
     virBufferAdjustIndent(&childrenBuf, virBufferGetIndent(buf, false) + 2);

     if (def->cputune.sharesSpecified)
-        virBufferAsprintf(&childrenBuf, "<shares>%lu</shares>\n",
+        virBufferAsprintf(&childrenBuf, "<shares>%llu</shares>\n",
                           def->cputune.shares);
     if (def->cputune.period)
         virBufferAsprintf(&childrenBuf, "<period>%llu</period>\n",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 82e581b..4e0550c 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2011,7 +2011,7 @@ typedef struct _virDomainCputune virDomainCputune;
 typedef virDomainCputune *virDomainCputunePtr;

 struct _virDomainCputune {
-    unsigned long shares;
+    unsigned long long shares;
     bool sharesSpecified;
     unsigned long long period;
     long long quota;
diff --git a/src/lxc/lxc_native.c b/src/lxc/lxc_native.c
index 0bea32e..5f9e50e 100644
--- a/src/lxc/lxc_native.c
+++ b/src/lxc/lxc_native.c
@@ -800,7 +800,7 @@ lxcSetCpuTune(virDomainDefPtr def, virConfPtr properties)

     if ((value = virConfGetValue(properties, "lxc.cgroup.cpu.shares")) &&
             value->str) {
-        if (virStrToLong_ul(value->str, NULL, 10, &def->cputune.shares) < 0)
+        if (virStrToLong_ull(value->str, NULL, 10, &def->cputune.shares) < 0)
             goto error;
         def->cputune.sharesSpecified = true;
     }
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index f729e5d..68a199f 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1547,8 +1547,8 @@ virVMXParseConfig(virVMXContext *ctx,
             def->cputune.shares = vcpus * 1000;
         } else if (STRCASEEQ(sched_cpu_shares, "high")) {
             def->cputune.shares = vcpus * 2000;
-        } else if (virStrToLong_ul(sched_cpu_shares, NULL, 10,
-                                   &def->cputune.shares) < 0) {
+        } else if (virStrToLong_ull(sched_cpu_shares, NULL, 10,
+                                    &def->cputune.shares) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("Expecting VMX entry 'sched.cpu.shares' to be an "
                              "unsigned integer or 'low', 'normal' or 'high' but "
@@ -3251,7 +3251,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
         } else if (def->cputune.shares == vcpus * 2000) {
             virBufferAddLit(&buffer, "sched.cpu.shares = \"high\"\n");
         } else {
-            virBufferAsprintf(&buffer, "sched.cpu.shares = \"%lu\"\n",
+            virBufferAsprintf(&buffer, "sched.cpu.shares = \"%llu\"\n",
                               def->cputune.shares);
         }
     }
-- 
2.8.2


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