[libvirt] [PATCH for v1.0.6-maint 0/2] Resolve issues seen with schedinfo

This is a backport of: https://www.redhat.com/archives/libvir-list/2013-June/msg00453.html submitted upstread as commit id 'b2375453' and '38ada092' John Ferlan (2): qemu: Resolve issue with GetScheduler APIs for non running domain lxc: Resolve issue with GetScheduler APIs for non running domain src/lxc/lxc_driver.c | 11 ++++++++++- src/qemu/qemu_driver.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) -- 1.8.1.4

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. --- src/qemu/qemu_driver.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 5ca0fd4..ebba21d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -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; } -- 1.8.1.4

As a consequence of the cgroup layout changes from commit 'cfed9ad4', the lxcDomainGetSchedulerParameters[Flags]()' and lxcGetSchedulerType() 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. --- src/lxc/lxc_driver.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 3d6baf5..4ab1736 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1617,6 +1617,14 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom, } priv = vm->privateData; + /* Domain not running, thus no cgroups - return defaults */ + if (!virDomainObjIsActive(vm)) { + if (nparams) + *nparams = 3; + 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")); @@ -1895,9 +1903,10 @@ lxcDomainGetSchedulerParametersFlags(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; + cpu_bw_status = true; /* Allow copy of data to params[] */ } goto out; } -- 1.8.1.4

On 06/19/2013 10:44 PM, John Ferlan wrote:
This is a backport of:
https://www.redhat.com/archives/libvir-list/2013-June/msg00453.html
submitted upstread as commit id 'b2375453' and '38ada092'
Instead of posting the commit ids separately, use "git cherry-pick -x" to automatically include them in the commit message, since cover letters don't make it to git.
John Ferlan (2): qemu: Resolve issue with GetScheduler APIs for non running domain lxc: Resolve issue with GetScheduler APIs for non running domain
These look identical to the ones on master branch. Since they have been ACKed upstream, you can just push them to the maint branch unless they conflict too much. You might find these threads helpful: https://www.redhat.com/archives/libvir-list/2012-October/msg01640.html https://www.redhat.com/archives/libvir-list/2013-February/msg01082.html https://www.redhat.com/archives/libvir-list/2013-February/msg01182.html Jan

On 06/20/2013 04:18 AM, Ján Tomko wrote:
On 06/19/2013 10:44 PM, John Ferlan wrote:
This is a backport of:
https://www.redhat.com/archives/libvir-list/2013-June/msg00453.html
submitted upstread as commit id 'b2375453' and '38ada092'
Instead of posting the commit ids separately, use "git cherry-pick -x" to automatically include them in the commit message, since cover letters don't make it to git.
John Ferlan (2): qemu: Resolve issue with GetScheduler APIs for non running domain lxc: Resolve issue with GetScheduler APIs for non running domain
These look identical to the ones on master branch. Since they have been ACKed upstream, you can just push them to the maint branch unless they conflict too much.
You might find these threads helpful:
https://www.redhat.com/archives/libvir-list/2012-October/msg01640.html https://www.redhat.com/archives/libvir-list/2013-February/msg01082.html https://www.redhat.com/archives/libvir-list/2013-February/msg01182.html
Jan
Pushed (thanks for the tips/pointers). John
participants (2)
-
John Ferlan
-
Ján Tomko