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

[Xen-changelog] [xen-unstable] xend: Fix scheduler parameters of rebooted domain



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1180010747 -3600
# Node ID 8fcefab1d63b040111786ef9653ecb5332ac1171
# Parent  7ff65f88880460832da3236d3c82242df5a576b9
xend: Fix scheduler parameters of rebooted domain

When I changed the scheduler parameters of a domain with
xm sched-credit, the information of xm sched-credit was changed.
But as for the information of xm list, the values of the domain
configuration definition were kept.
And, then I rebooted the domain. The information of xm list was
not changed. But as for the information of xm sched-credit, the
values of the domain configuration definition were returned.

# xm create /xen/PVdomain.1 cpu_cap=150 cpu_weight=512
Using config file "/xen/PVdomain.1".
Started domain PVdomain.1
# xm sched-credit -d PVdomain.1
Name                              ID Weight Cap
PVdomain.1                         1    512  150
# xm sched-credit -d PVdomain.1 -c 75 -w 384
# xm sched-credit -d PVdomain.1
Name                              ID Weight Cap
PVdomain.1                         1    384   75
# xm list --long PVdomain.1 | grep cpu_
    (cpu_weight 512)
    (cpu_cap 150)
    (cpu_time 29.353831745)
# xm reboot PVdomain.1
# xm sched-credit -d PVdomain.1
Name                              ID Weight Cap
PVdomain.1                         2    512  150
# xm list --long PVdomain.1 | grep cpu_
    (cpu_weight 512)
    (cpu_cap 150)
    (cpu_time 5.950247186)

If the scheduler parameters of the domain were changed with
xm sched-credit, I think that xm list should show the current
values about the scheduler parameters.
And, then if the domain is rebooted, I think that the rebooted
domain should keep the preceding values about the scheduler
parameters.

Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomain.py     |   14 +++++++++++++-
 tools/python/xen/xend/XendDomainInfo.py |    6 ++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff -r 7ff65f888804 -r 8fcefab1d63b tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Thu May 24 13:42:41 2007 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Thu May 24 13:45:47 2007 +0100
@@ -1402,6 +1402,8 @@ class XendDomain:
         @type cap: int
         @rtype: 0
         """
+        set_weight = False
+        set_cap = False
         dominfo = self.domain_lookup_nr(domid)
         if not dominfo:
             raise XendInvalidDomain(str(domid))
@@ -1410,16 +1412,26 @@ class XendDomain:
                 weight = int(0)
             elif weight < 1 or weight > 65535:
                 raise XendError("weight is out of range")
+            else:
+                set_weight = True
 
             if cap is None:
                 cap = int(~0)
             elif cap < 0 or cap > dominfo.getVCpuCount() * 100:
                 raise XendError("cap is out of range")
+            else:
+                set_cap = True
 
             assert type(weight) == int
             assert type(cap) == int
 
-            return xc.sched_credit_domain_set(dominfo.getDomid(), weight, cap)
+            rc = xc.sched_credit_domain_set(dominfo.getDomid(), weight, cap)
+            if rc == 0:
+                if set_weight:
+                    dominfo.setWeight(weight)
+                if set_cap:
+                    dominfo.setCap(cap)
+            return rc
         except Exception, ex:
             log.exception(ex)
             raise XendError(str(ex))
diff -r 7ff65f888804 -r 8fcefab1d63b tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Thu May 24 13:42:41 2007 +0100
+++ b/tools/python/xen/xend/XendDomainInfo.py   Thu May 24 13:45:47 2007 +0100
@@ -1009,8 +1009,14 @@ class XendDomainInfo:
     def getCap(self):
         return self.info.get('cpu_cap', 0)
 
+    def setCap(self, cpu_cap):
+        self.info['cpu_cap'] = cpu_cap
+
     def getWeight(self):
         return self.info.get('cpu_weight', 256)
+
+    def setWeight(self, cpu_weight):
+        self.info['cpu_weight'] = cpu_weight
 
     def setResume(self, state):
         self._resume = state

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.