mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-07 09:19:19 +00: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;
|
goto error;
|
||||||
|
|
||||||
/* Extract cpu tunables. */
|
/* Extract cpu tunables. */
|
||||||
if ((n = virXPathULong("string(./cputune/shares[1])", ctxt,
|
if ((n = virXPathULongLong("string(./cputune/shares[1])", ctxt,
|
||||||
&def->cputune.shares)) < -1) {
|
&def->cputune.shares)) < -1) {
|
||||||
virReportError(VIR_ERR_XML_ERROR, "%s",
|
virReportError(VIR_ERR_XML_ERROR, "%s",
|
||||||
_("can't parse cputune shares value"));
|
_("can't parse cputune shares value"));
|
||||||
goto error;
|
goto error;
|
||||||
@ -22158,7 +22158,7 @@ virDomainCputuneDefFormat(virBufferPtr buf,
|
|||||||
virBufferAdjustIndent(&childrenBuf, virBufferGetIndent(buf, false) + 2);
|
virBufferAdjustIndent(&childrenBuf, virBufferGetIndent(buf, false) + 2);
|
||||||
|
|
||||||
if (def->cputune.sharesSpecified)
|
if (def->cputune.sharesSpecified)
|
||||||
virBufferAsprintf(&childrenBuf, "<shares>%lu</shares>\n",
|
virBufferAsprintf(&childrenBuf, "<shares>%llu</shares>\n",
|
||||||
def->cputune.shares);
|
def->cputune.shares);
|
||||||
if (def->cputune.period)
|
if (def->cputune.period)
|
||||||
virBufferAsprintf(&childrenBuf, "<period>%llu</period>\n",
|
virBufferAsprintf(&childrenBuf, "<period>%llu</period>\n",
|
||||||
|
@ -2011,7 +2011,7 @@ typedef struct _virDomainCputune virDomainCputune;
|
|||||||
typedef virDomainCputune *virDomainCputunePtr;
|
typedef virDomainCputune *virDomainCputunePtr;
|
||||||
|
|
||||||
struct _virDomainCputune {
|
struct _virDomainCputune {
|
||||||
unsigned long shares;
|
unsigned long long shares;
|
||||||
bool sharesSpecified;
|
bool sharesSpecified;
|
||||||
unsigned long long period;
|
unsigned long long period;
|
||||||
long long quota;
|
long long quota;
|
||||||
|
@ -800,7 +800,7 @@ lxcSetCpuTune(virDomainDefPtr def, virConfPtr properties)
|
|||||||
|
|
||||||
if ((value = virConfGetValue(properties, "lxc.cgroup.cpu.shares")) &&
|
if ((value = virConfGetValue(properties, "lxc.cgroup.cpu.shares")) &&
|
||||||
value->str) {
|
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;
|
goto error;
|
||||||
def->cputune.sharesSpecified = true;
|
def->cputune.sharesSpecified = true;
|
||||||
}
|
}
|
||||||
|
@ -1547,8 +1547,8 @@ virVMXParseConfig(virVMXContext *ctx,
|
|||||||
def->cputune.shares = vcpus * 1000;
|
def->cputune.shares = vcpus * 1000;
|
||||||
} else if (STRCASEEQ(sched_cpu_shares, "high")) {
|
} else if (STRCASEEQ(sched_cpu_shares, "high")) {
|
||||||
def->cputune.shares = vcpus * 2000;
|
def->cputune.shares = vcpus * 2000;
|
||||||
} else if (virStrToLong_ul(sched_cpu_shares, NULL, 10,
|
} else if (virStrToLong_ull(sched_cpu_shares, NULL, 10,
|
||||||
&def->cputune.shares) < 0) {
|
&def->cputune.shares) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("Expecting VMX entry 'sched.cpu.shares' to be an "
|
_("Expecting VMX entry 'sched.cpu.shares' to be an "
|
||||||
"unsigned integer or 'low', 'normal' or 'high' but "
|
"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) {
|
} else if (def->cputune.shares == vcpus * 2000) {
|
||||||
virBufferAddLit(&buffer, "sched.cpu.shares = \"high\"\n");
|
virBufferAddLit(&buffer, "sched.cpu.shares = \"high\"\n");
|
||||||
} else {
|
} else {
|
||||||
virBufferAsprintf(&buffer, "sched.cpu.shares = \"%lu\"\n",
|
virBufferAsprintf(&buffer, "sched.cpu.shares = \"%llu\"\n",
|
||||||
def->cputune.shares);
|
def->cputune.shares);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user