[PATCH 5/5] xen: Fix scheduler setting problems

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

 



From: Daniel Veillard <veillard@xxxxxxxxxx>

Doing `virsh schedinfo rhel5u3 --cap 65535' the hypervisor does the
call, but does not change the value nor raise an error. Best is just to
consider it's not in the allowed values. The problem is that the error
won't be output since the xend driver will then be called and raise an
error

    error: this function is not supported by the hypervisor: unsupported
    in xendConfigVersion < 4

which will override the useful information from
xenUnifiedDomainSetSchedulerParameters(). So best is to also invert the
order in which the xen sub-drivers are called.

* src/xen/xen_hypervisor.c: mark 65535 cap value as out of bound
* src/xen/xen_hypervisor.c: reverse the order of the calls to the xen
  sub drivers to get the error message if needed
---
 src/xen/xen_driver.c     |    3 ++-
 src/xen/xen_hypervisor.c |    4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index ddbfa7a..56ba41b 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1588,7 +1588,8 @@ xenUnifiedDomainSetSchedulerParameters (virDomainPtr dom,
     GET_PRIVATE(dom->conn);
     int i, ret;
 
-    for (i = 0; i < XEN_UNIFIED_NR_DRIVERS; ++i) {
+    /* do the hypervisor call last to get better error */
+    for (i = XEN_UNIFIED_NR_DRIVERS - 1; i >= 0; i--) {
         if (priv->opened[i] && drivers[i]->domainSetSchedulerParameters) {
            ret = drivers[i]->domainSetSchedulerParameters(dom, params, nparams);
            if (ret == 0)
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index 67d0f4b..6246513 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -1394,8 +1394,8 @@ xenHypervisorSetSchedulerParameters(virDomainPtr domain,
                 } else if (STREQ (params[i].field, str_cap) &&
                     params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
                     val = params[i].value.ui;
-                    if (val > USHRT_MAX) {
-                        snprintf(buf, sizeof(buf), _("Credit scheduler cap parameter (%d) is out of range (0-65535)"), val);
+                    if (val >= USHRT_MAX) {
+                        snprintf(buf, sizeof(buf), _("Credit scheduler cap parameter (%d) is out of range (0-65534)"), val);
                         virXenErrorFunc(VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
                         return(-1);
                     }
-- 
1.7.2

--
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]