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

[libvirt] [PATCH] 504914 Xen scheduler setting problems



    504914 Xen scheduler setting problems

    https://bugzilla.redhat.com/show_bug.cgi?id=504914
    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 ouput 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

diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index 4bfcce4..a7da2ec 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -1524,7 +1524,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 843102a..4254bcd 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -1345,8 +1345,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 (domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__, buf, val);
                         return(-1);
                     }

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/


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