direct-io.hg

changeset 13652:db0aeb4e41c3

Reject xm sched-* comands for other than the in-use scheduler.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author kaf24@localhost.localdomain
date Sun Jan 28 09:35:00 2007 +0000 (2007-01-28)
parents 4e7bda043cce
children fd57cef459dc
files tools/python/xen/xm/main.py
line diff
     1.1 --- a/tools/python/xen/xm/main.py	Sun Jan 28 09:33:47 2007 +0000
     1.2 +++ b/tools/python/xen/xm/main.py	Sun Jan 28 09:35:00 2007 +0000
     1.3 @@ -706,6 +706,15 @@ def parse_doms_info(info):
     1.4          'seclabel' : security.get_security_printlabel(info),
     1.5          }
     1.6  
     1.7 +def check_sched_type(sched):
     1.8 +    current = 'unknown'
     1.9 +    for x in server.xend.node.info()[1:]:
    1.10 +        if len(x) > 1 and x[0] == 'xen_scheduler':
    1.11 +            current = x[1]
    1.12 +            break
    1.13 +    if sched != current:
    1.14 +        err("Xen is running with the %s scheduler" % current)
    1.15 +        sys.exit(1)
    1.16  
    1.17  def parse_sedf_info(info):
    1.18      def get_info(n, t, d):
    1.19 @@ -1098,6 +1107,8 @@ def xm_sched_sedf(args):
    1.20          print( ("%(name)-32s %(domid)3d %(period)9.1f %(slice)9.1f" +
    1.21                  " %(latency)7.1f %(extratime)6d %(weight)6d") % info)
    1.22  
    1.23 +    check_sched_type('sedf')
    1.24 +
    1.25      # we want to just display current info if no parameters are passed
    1.26      if len(args) == 0:
    1.27          domid = None
    1.28 @@ -1170,6 +1181,8 @@ def xm_sched_sedf(args):
    1.29  def xm_sched_credit(args):
    1.30      """Get/Set options for Credit Scheduler."""
    1.31      
    1.32 +    check_sched_type('credit')
    1.33 +
    1.34      try:
    1.35          opts, params = getopt.getopt(args, "d:w:c:",
    1.36              ["domain=", "weight=", "cap="])