Mailing List Archive

[xen-unstable] Reject xm sched-* comands for other than the in-use scheduler.
# HG changeset patch
# User kaf24@localhost.localdomain
# Date 1169976900 0
# Node ID db0aeb4e41c3c4d30beb98ff33d189f5ea20322e
# Parent 4e7bda043cced371f098bb3bee486ed57d6388c2
Reject xm sched-* comands for other than the in-use scheduler.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
---
tools/python/xen/xm/main.py | 13 +++++++++++++
1 files changed, 13 insertions(+)

diff -r 4e7bda043cce -r db0aeb4e41c3 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py Sun Jan 28 09:33:47 2007 +0000
+++ b/tools/python/xen/xm/main.py Sun Jan 28 09:35:00 2007 +0000
@@ -706,6 +706,15 @@ def parse_doms_info(info):
'seclabel' : security.get_security_printlabel(info),
}

+def check_sched_type(sched):
+ current = 'unknown'
+ for x in server.xend.node.info()[1:]:
+ if len(x) > 1 and x[0] == 'xen_scheduler':
+ current = x[1]
+ break
+ if sched != current:
+ err("Xen is running with the %s scheduler" % current)
+ sys.exit(1)

def parse_sedf_info(info):
def get_info(n, t, d):
@@ -1098,6 +1107,8 @@ def xm_sched_sedf(args):
print( ("%(name)-32s %(domid)3d %(period)9.1f %(slice)9.1f" +
" %(latency)7.1f %(extratime)6d %(weight)6d") % info)

+ check_sched_type('sedf')
+
# we want to just display current info if no parameters are passed
if len(args) == 0:
domid = None
@@ -1170,6 +1181,8 @@ def xm_sched_credit(args):
def xm_sched_credit(args):
"""Get/Set options for Credit Scheduler."""

+ check_sched_type('credit')
+
try:
opts, params = getopt.getopt(args, "d:w:c:",
["domain=", "weight=", "cap="])

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