mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 06:35:24 +00:00
qemu: Resolve issue with GetScheduler APIs for non running domain
As a consequence of the cgroup layout changes from commit '632f78ca', the
qemuDomainGetSchedulerParameters[Flags]()' and qemuGetSchedulerType() APIs
failed to return data for a non running domain. This can be seen through
a 'virsh schedinfo <domain>' command which returns:
Scheduler : Unknown
error: Requested operation is not valid: cgroup CPU controller is not mounted
Prior to that change a non running domain would return:
Scheduler : posix
cpu_shares : 0
vcpu_period : 0
vcpu_quota : 0
emulator_period: 0
emulator_quota : 0
This patch will restore the capability to return configuration only data
for a non running domain regardless of whether cgroups are available.
(cherry picked from commit b237545341
)
This commit is contained in:
parent
5cd988cb1a
commit
245fc93c88
@ -6903,6 +6903,14 @@ static char *qemuDomainGetSchedulerType(virDomainPtr dom,
|
||||
}
|
||||
priv = vm->privateData;
|
||||
|
||||
/* Domain not running, thus no cgroups - return defaults */
|
||||
if (!virDomainObjIsActive(vm)) {
|
||||
if (nparams)
|
||||
*nparams = 5;
|
||||
ignore_value(VIR_STRDUP(ret, "posix"));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) {
|
||||
virReportError(VIR_ERR_OPERATION_INVALID,
|
||||
"%s", _("cgroup CPU controller is not mounted"));
|
||||
@ -8315,11 +8323,12 @@ qemuDomainGetSchedulerParametersFlags(virDomainPtr dom,
|
||||
|
||||
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
|
||||
shares = persistentDef->cputune.shares;
|
||||
if (*nparams > 1 && cpu_bw_status) {
|
||||
if (*nparams > 1) {
|
||||
period = persistentDef->cputune.period;
|
||||
quota = persistentDef->cputune.quota;
|
||||
emulator_period = persistentDef->cputune.emulator_period;
|
||||
emulator_quota = persistentDef->cputune.emulator_quota;
|
||||
cpu_bw_status = true; /* Allow copy of data to params[] */
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user