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

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

 



Since commit '632f78ca' 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
emulator_period: 0
emulator_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/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 4a76f14..7292149 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6899,12 +6899,20 @@ static char *qemuDomainGetSchedulerType(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"));
         goto cleanup;
     }
 
+
     if (nparams) {
         rc = qemuGetCpuBWStatus(priv->cgroup);
         if (rc < 0)
@@ -6915,11 +6923,12 @@ static char *qemuDomainGetSchedulerType(virDomainPtr dom,
             *nparams = 5;
     }
 
+cleanup:
     ignore_value(VIR_STRDUP(ret, "posix"));
 
-cleanup:
     if (vm)
         virObjectUnlock(vm);
+
     return ret;
 }
 
-- 
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]