WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Improve xm sched-credit command for inact

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Improve xm sched-credit command for inactive managed domains
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 06 Jul 2007 10:10:29 -0700
Delivery-date: Fri, 06 Jul 2007 10:08:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1183728894 -3600
# Node ID d6078c9423555d7ada248594114ff041893bade6
# Parent  7ac7f147241405af83e7a9d748cf7b01279734fc
Improve xm sched-credit command for inactive managed domains
Allows to change the scheduler parameters of inactive managed domains.
Signed-off-by: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
---
 tools/python/xen/xend/XendDomain.py |   17 ++++++++++++-----
 tools/python/xen/xm/main.py         |   34 ++++++++++++++++++++++------------
 2 files changed, 34 insertions(+), 17 deletions(-)

diff -r 7ac7f1472414 -r d6078c942355 tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Fri Jul 06 14:22:59 2007 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Fri Jul 06 14:34:54 2007 +0100
@@ -1399,10 +1399,15 @@ class XendDomain:
         dominfo = self.domain_lookup_nr(domid)
         if not dominfo:
             raise XendInvalidDomain(str(domid))
-        try:
-            return xc.sched_credit_domain_get(dominfo.getDomid())
-        except Exception, ex:
-            raise XendError(str(ex))
+        
+        if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+            try:
+                return xc.sched_credit_domain_get(dominfo.getDomid())
+            except Exception, ex:
+                raise XendError(str(ex))
+        else:
+            return {'weight' : dominfo.getWeight(),
+                    'cap'    : dominfo.getCap()} 
     
     def domain_sched_credit_set(self, domid, weight = None, cap = None):
         """Set credit scheduler parameters for a domain.
@@ -1436,7 +1441,9 @@ class XendDomain:
             assert type(weight) == int
             assert type(cap) == int
 
-            rc = xc.sched_credit_domain_set(dominfo.getDomid(), weight, cap)
+            rc = 0
+            if dominfo._stateGet() in (DOM_STATE_RUNNING, DOM_STATE_PAUSED):
+                rc = xc.sched_credit_domain_set(dominfo.getDomid(), weight, 
cap)
             if rc == 0:
                 if set_weight:
                     dominfo.setWeight(weight)
diff -r 7ac7f1472414 -r d6078c942355 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Fri Jul 06 14:22:59 2007 +0100
+++ b/tools/python/xen/xm/main.py       Fri Jul 06 14:34:54 2007 +0100
@@ -1529,7 +1529,7 @@ def xm_sched_credit(args):
 
     doms = filter(lambda x : domid_match(domid, x),
                   [parse_doms_info(dom)
-                  for dom in getDomains(None, 'running')])
+                  for dom in getDomains(None, 'all')])
 
     if weight is None and cap is None:
         if domid is not None and doms == []: 
@@ -1545,7 +1545,7 @@ def xm_sched_credit(args):
                         server.xenapi.VM.get_metrics(
                             get_single_vm(d['name'])))
                 else:
-                    info = server.xend.domain.sched_credit_get(d['domid'])
+                    info = server.xend.domain.sched_credit_get(d['name'])
             except xmlrpclib.Fault:
                 pass
 
@@ -1557,8 +1557,8 @@ def xm_sched_credit(args):
             info['cap']    = int(info['cap'])
             
             info['name']  = d['name']
-            info['domid'] = int(d['domid'])
-            print( ("%(name)-32s %(domid)5d %(weight)6d %(cap)4d") % info)
+            info['domid'] = str(d['domid'])
+            print( ("%(name)-32s %(domid)5s %(weight)6d %(cap)4d") % info)
     else:
         if domid is None:
             # place holder for system-wide scheduler parameters
@@ -1566,14 +1566,24 @@ def xm_sched_credit(args):
             usage('sched-credit')
 
         if serverType == SERVER_XEN_API:
-            server.xenapi.VM.add_to_VCPUs_params_live(
-                get_single_vm(domid),
-                "weight",
-                weight)
-            server.xenapi.VM.add_to_VCPUs_params_live(
-                get_single_vm(domid),
-                "cap",
-                cap)            
+            if doms[0]['domid']:
+                server.xenapi.VM.add_to_VCPUs_params_live(
+                    get_single_vm(domid),
+                    "weight",
+                    weight)
+                server.xenapi.VM.add_to_VCPUs_params_live(
+                    get_single_vm(domid),
+                    "cap",
+                    cap)
+            else:
+                server.xenapi.VM.add_to_VCPUs_params(
+                    get_single_vm(domid),
+                    "weight",
+                    weight)
+                server.xenapi.VM.add_to_VCPUs_params(
+                    get_single_vm(domid),
+                    "cap",
+                    cap)
         else:
             result = server.xend.domain.sched_credit_set(domid, weight, cap)
             if result != 0:

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Improve xm sched-credit command for inactive managed domains, Xen patchbot-unstable <=