virCgroupPtr cgroup)
{
int ret = -1;
- if (def->cputune.sharesSpecified &&
- virCgroupSetCpuShares(cgroup, def->cputune.shares) < 0)
- goto cleanup;
+
+ if (def->cputune.sharesSpecified) {
+ unsigned long long val;
+ if (virCgroupSetCpuShares(cgroup, def->cputune.shares) < 0)
+ goto cleanup;
+
+ if (virCgroupGetCpuShares(cgroup, &val) < 0)
+ goto cleanup;
+ def->cputune.shares = val;
+ }
if (def->cputune.quota != 0 &&
virCgroupSetCpuCfsQuota(cgroup, def->cputune.quota) < 0)
if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_CPU_SHARES)) {
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ unsigned long long val;
if (virCgroupSetCpuShares(priv->cgroup, params[i].value.ul) < 0)
goto cleanup;
- vm->def->cputune.shares = params[i].value.ul;
+ if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
+ goto cleanup;
+
+ vm->def->cputune.shares = val;
vm->def->cputune.sharesSpecified = true;
}
}
}
- if (vm->def->cputune.sharesSpecified &&
- virCgroupSetCpuShares(priv->cgroup, vm->def->cputune.shares) < 0)
- return -1;
+ if (vm->def->cputune.sharesSpecified) {
+ unsigned long long val;
+ if (virCgroupSetCpuShares(priv->cgroup, vm->def->cputune.shares) < 0)
+ return -1;
+
+ if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
+ return -1;
+ vm->def->cputune.shares = val;
+ }
return 0;
}
if (STREQ(param->field, VIR_DOMAIN_SCHEDULER_CPU_SHARES)) {
if (flags & VIR_DOMAIN_AFFECT_LIVE) {
+ unsigned long long val;
if (virCgroupSetCpuShares(priv->cgroup, value_ul) < 0)
goto cleanup;
- vm->def->cputune.shares = value_ul;
+
+ if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
+ goto cleanup;
+
+ vm->def->cputune.shares = val;
vm->def->cputune.sharesSpecified = true;
}