[PATCH 2/2] lxc: Resolve issue with virsh schedinfo for non running domain

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since commit 'cfed9ad4' the 'virsh schedinfo <domain>' command 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

This change will result in the following:

Scheduler      : posix
cpu_shares     : 0

The code sequence is a 'virGetSchedulerType()' which returns the "*params"
for a subsequent 'virDomainGetSchedulerParameters[Flags]()' call. The latter
requires at least 1 'nparam' to be provided/returned.
---
 src/lxc/lxc_driver.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 3d6baf5..1991a31 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -1617,6 +1617,13 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom,
     }
     priv = vm->privateData;
 
+    /* Domain not running or no cgroup */
+    if (!priv->cgroup) {
+        if (nparams)
+            *nparams = 1;
+        goto cleanup;
+    }
+
     if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) {
         virReportError(VIR_ERR_OPERATION_INVALID,
                        "%s", _("cgroup CPU controller is not mounted"));
@@ -1633,9 +1640,9 @@ static char *lxcDomainGetSchedulerType(virDomainPtr dom,
             *nparams = 3;
     }
 
+cleanup:
     ignore_value(VIR_STRDUP(ret, "posix"));
 
-cleanup:
     if (vm)
         virObjectUnlock(vm);
     lxcDriverUnlock(driver);
-- 
1.8.1.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]