mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-12 04:58:32 +03:00
conf: Change virDomainCputune member 'shares' to unsigned long long
cgroup functions set and get the longer type so use it everywhere
This commit is contained in:
parent
8bf8838fb4
commit
e6e144689d
@ -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",
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user