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-devel

[Xen-devel] [PATCH] xm,xend: flesh out xm sched-sedf

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xm,xend: flesh out xm sched-sedf
From: Ryan Harper <ryanh@xxxxxxxxxx>
Date: Tue, 7 Mar 2006 17:42:43 -0600
Delivery-date: Tue, 07 Mar 2006 23:43:32 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.6+20040907i
This patch

-Displays[1] current parameters for running domains ala xm list
-Allow users to set[2] one or more parameters[3] without having to 
 provide values for parameters they do not wish to change
-Adds additional testing of sched-sedf via new xm-test testcases.

With this patch applied, test 02_sedf_period_lower_neg.py exposes a
bug[4].  I'll follow up this email with a patch for the bug.


1. root@bebop:~ # xm sched-sedf
Name        ID     Period     Slice Latency  ExtraTime  Weight
Domain-0     0   20000000  15000000       0          1       0

2. root@bebop:~ # xm sched-sedf 0 --extratime=0
root@bebop:~ # xm sched-sedf
Name        ID     Period     Slice Latency  ExtraTime  Weight
Domain-0     0   20000000  15000000       0          0       0

3. root@bebop:~ # xm help sched-sedf
   sched-sedf [DOM] [OPTIONS]       Show|Set simple EDF parameters
              -p, --period          Relative deadline(ns).
              -s, --slice           Worst-case execution time(ns) (slice < 
period).
              -l, --latency         scaled period(ns) in case the domain is 
doing
                                    heavy I/O.
              -e, --extra           flag (0/1) which controls whether the
                                    domain can run in extra-time
              -w, --weight          mutually exclusive with period/slice and
                                    specifies another way of setting a domain's
                                    cpu period/slice.

4.
(XEN) Assertion 'curinf->deadl_abs > now' failed, line 582, file sched_sedf.c
(XEN) BUG at sched_sedf.c:582
(XEN) (file=extable.c, line=77) Pre-exception: ff119c79 -> 00000000
(XEN) ----[ Xen-3.0.0    Not tainted ]----
(XEN) CPU:    1
(XEN) EIP:    e008:[<ff119c79>] update_queues+0x38e/0x41e
(XEN) EFLAGS: 00010092   CONTEXT: hypervisor
(XEN) eax: ff1b02b8   ebx: 00000001   ecx: ffbf4000   edx: 00000000
(XEN) esi: ffffffff   edi: ffffffff   ebp: ffbf9e80   esp: ffbf9dc8
(XEN) cr0: 8005003b   cr3: db1e3000
(XEN) ds: e010   es: e010   fs: 0000   gs: 0000   ss: e010   cs: e008
(XEN) Xen stack trace from esp=ffbf9dc8:
(XEN)    ff1988f5 ff1988e8 00000246 ff1988e8 00000000 ff1d6b00 43f0e910 0000008d
(XEN)    43f0e910 00000002 ffbf9e60 ff11afea 00000001 00000001 43f0ece2 0000008d
(XEN)    2b275387 000003d4 ffbc5180 ffbc5180 43f0e90e 0000008d 43f0e910 0000008d
(XEN)    43f0e910 0000008d 43f0e90f 0000008d 138773c5 0000008d ffbda280 ffbc5180
(XEN)    43f0e910 0000008d ffbf9e60 ff11e20a ff1d5700 ffbc5180 ff21ef80 ffbc5184
(XEN)    43f0ece4 0000008d 00000000 ffbdc080 00000006 ffbf9fac ffbf9f00 ff11a544
(XEN)    43f0ece4 0000008d ff21ef80 ff21ef88 2b2757a5 00000000 00000000 2b2757a5
(XEN)    2b2757a5 00000000 2f558b4a 00000000 ff1f4f00 00000006 00000004 00000004
(XEN)    5eab1694 ffbdc080 ffbf9ef0 ff11f95d ff21ef90 ff21ef98 ff21ee00 ff21ef88
(XEN)    ff21ef80 00000001 43f0ece4 0000008d ffbdc080 00000006 ffbf9f70 ff11d69a
(XEN)    ffbf9f38 43f0ece4 0000008d ffbdc080 00000006 ffbf9fac ffbf9f70 ff11f5f8
(XEN)    ff1d7b80 0000008d ff11d21b 00000002 4425e306 0000008d 43f1a95f 0000008d
(XEN)    00000000 ffbdc094 43f0ece4 0000008d 43f0e60f 00000001 00000000 ff21e080
(XEN)    ffbdc094 00000001 ffbf9fa0 ff11e63a 00000001 ff1d6b00 ffbf9fa0 00000080
(XEN)    00ef0000 ff12d140 0000e008 00000001 00000002 00000001 ffbf9fb0 ff12d1a2
(XEN)    ff1afd28 00000001 ffbf9e7c 00000001 00000000 00015698 c55a2000 00000001
(XEN)    c55a3f98 00000000 00070000 c01010c7 00000061 00000246 c55a3f84 00000069
(XEN)    0000007b 0000007b 00000000 00000000 00000001 ff21e080
(XEN) Xen call trace:
(XEN)    [<ff119c79>] update_queues+0x38e/0x41e
(XEN)    [<ff11a544>] sedf_do_schedule+0x133/0x410
(XEN)    [<ff11d69a>] __enter_scheduler+0xe3/0x479
(XEN)    [<ff11e63a>] do_softirq+0xa2/0xb7
(XEN)    [<ff12d1a2>] idle_loop+0x5d/0x5f

-- 
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
(512) 838-9253   T/L: 678-9253
ryanh@xxxxxxxxxx


diffstat output:
 a/tools/xm-test/tests/sedf/01_sedf_multi_pos.py             |   28 --
 b/tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py      |   62 ++++++
 b/tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py      |   41 ++++
 b/tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py       |   37 +++
 b/tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py       |   45 ++++
 b/tools/xm-test/tests/sedf/05_sedf_extratime_pos.py         |   63 ++++++
 b/tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py |   68 +++++++
 tools/python/xen/xend/XendDomain.py                         |   12 +
 tools/python/xen/xm/main.py                                 |  114 +++++++++++-
 tools/xm-test/tests/sedf/Makefile.am                        |    4 
 10 files changed, 437 insertions(+), 37 deletions(-)

Signed-off-by: Ryan Harper <ryanh@xxxxxxxxxx>
---
diff -r f14e12b3327a tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Tue Mar  7 23:09:23 2006
+++ b/tools/python/xen/xend/XendDomain.py       Tue Mar  7 17:18:16 2006
@@ -487,7 +487,17 @@
         """
         dominfo = self.domain_lookup(domid)
         try:
-            return xc.sedf_domain_get(dominfo.getDomid())
+            
+            sedf_info = xc.sedf_domain_get(dominfo.getDomid())
+            # return sxpr
+            return ['sedf',
+                    ['domain',    sedf_info['domain']],
+                    ['period',    sedf_info['period']],
+                    ['slice',     sedf_info['slice']],
+                    ['latency',   sedf_info['latency']],
+                    ['extratime', sedf_info['extratime']],
+                    ['weight',    sedf_info['weight']]]
+
         except Exception, ex:
             raise XendError(str(ex))
 
diff -r f14e12b3327a tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Tue Mar  7 23:09:23 2006
+++ b/tools/python/xen/xm/main.py       Tue Mar  7 17:18:16 2006
@@ -83,7 +83,17 @@
                                     parameters"""
 sched_bvt_ctxallow_help = """sched-bvt-ctxallow <Allow>       Set the BVT 
scheduler context switch
                                     allowance"""
-sched_sedf_help = "sched-sedf <Parameters>          Set simple EDF parameters"
+sched_sedf_help = "sched-sedf [DOM] [OPTIONS]       Show|Set simple EDF 
parameters\n" + \
+"              -p, --period          Relative deadline(ns).\n\
+              -s, --slice           Worst-case execution time(ns) (slice < 
period).\n\
+              -l, --latency         scaled period(ns) in case the domain is 
doing\n\
+                                    heavy I/O.\n\
+              -e, --extra           flag (0/1) which controls whether the\n\
+                                    domain can run in extra-time\n\
+              -w, --weight          mutually exclusive with period/slice and\n\
+                                    specifies another way of setting a 
domain's\n\
+                                    cpu period/slice."
+
 block_attach_help = """block-attach <DomId> <BackDev> <FrontDev> <Mode>
                 [BackDomId]         Create a new virtual block device"""
 block_detach_help = """block-detach  <DomId> <DevId>    Destroy a domain's 
virtual block device,
@@ -377,6 +387,20 @@
         }
 
 
+def parse_sedf_info(info):
+    def get_info(n, t, d):
+        return t(sxp.child_value(info, n, d))
+
+    return {
+        'dom'      : get_info('domain',        int,   -1),
+        'period'   : get_info('period',        int,   -1),
+        'slice'    : get_info('slice',         int,   -1),
+        'latency'  : get_info('latency',       int,   -1),
+        'extratime': get_info('extratime',     int,   -1),
+        'weight'   : get_info('weight',        int,   -1),
+        }
+
+
 def xm_brief_list(doms):
     print 'Name                              ID Mem(MiB) VCPUs State  Time(s)'
     for dom in doms:
@@ -617,12 +641,88 @@
     server.xend_node_cpu_bvt_slice_set(slice)
 
 def xm_sched_sedf(args):
-    arg_check(args, "sched-sedf", 6)
-    
-    dom = args[0]
-    v = map(int, args[1:6])
-    from xen.xend.XendClient import server
-    server.xend_domain_cpu_sedf_set(dom, *v)
+    def print_sedf(info):
+        print( ("%(name)-32s %(dom)3d %(period)12d %(slice)12d %(latency)12d" +
+                " %(extratime)10d %(weight)7d") % info)
+
+    # FIXME: this can probably go away if someone points me to the proper way.
+    def domid_match(domid, info):
+        d = ""
+        f = ""
+        try:
+            d = int(domid)
+            f = 'dom'
+        except:
+            d = domid 
+            f = 'name'
+
+        return (d == info[f])
+          
+    # we want to just display current info if no parameters are passed
+    if len(args) == 0:
+        domid = '-1'
+    else:
+        # we expect at least a domain id (name or number)
+        # and at most a domid up to 5 options with values
+        arg_check(args, "sched-sedf", 1, 11)
+        domid = args[0]
+        # drop domid from args since get_opt doesn't recognize it
+        args = args[1:] 
+
+    opts = {}
+    try:
+        (options, params) = getopt.gnu_getopt(args, 'p:s:l:e:w:',
+            ['period=', 'slice=', 'latency=', 'extratime=', 'weight='])
+    except getopt.GetoptError, opterr:
+        err(opterr)
+        sys.exit(1)
+    
+    for (k, v) in options:
+        if k in ['-p', '--period']:
+            opts['period'] = v
+        elif k in ['-s', '--slice']:
+            opts['slice'] = v
+        elif k in ['-l', '--latency']:
+            opts['latency'] = v
+        elif k in ['-e', '--extratime']:
+            opts['extratime'] = v
+        elif k in ['-w', '--weight']:
+            opts['weight'] = v
+
+    # print header if we aren't setting any parameters
+    if len(opts.keys()) == 0:
+        print '%-33s %-8s %-13s %-10s %-8s %-10s %-6s' %('Name','ID','Period',
+                                                         'Slice', 'Latency',
+                                                         'ExtraTime','Weight')
+
+    from xen.xend.XendClient import server
+    for dom in getDomains(""):
+        d = parse_doms_info(dom)
+        
+        if domid == '-1' or domid_match(domid, d):
+
+            # fetch current values so as not to clobber them
+            sedf_info = \
+                parse_sedf_info(server.xend_domain_cpu_sedf_get(d['dom']))
+            sedf_info['name'] = d['name']
+
+            # update values in case of call to set
+            if len(opts.keys()) > 0:
+                for k in opts.keys():
+                    sedf_info[k]=opts[k]
+            
+                # send the update
+                v = map(int, [sedf_info['period'],  sedf_info['slice'],
+                              sedf_info['latency'], sedf_info['extratime'],
+                              sedf_info['weight']])
+                rv = server.xend_domain_cpu_sedf_set(d['dom'], *v)
+                if int(rv) != 0:
+                    err("Failed to set sedf parameters (rv=%d)."%(rv))
+
+            # not setting values, display info
+            else:
+                print_sedf(sedf_info)
+
 
 def xm_info(args):
     arg_check(args, "info", 0)
diff -r f14e12b3327a tools/xm-test/tests/sedf/Makefile.am
--- a/tools/xm-test/tests/sedf/Makefile.am      Tue Mar  7 23:09:23 2006
+++ b/tools/xm-test/tests/sedf/Makefile.am      Tue Mar  7 17:18:16 2006
@@ -1,7 +1,9 @@
 
 SUBDIRS =
 
-TESTS = 01_sedf_multi_pos.test
+TESTS = 01_sedf_period_slice_pos.py 02_sedf_period_lower_neg.py \
+        03_sedf_slice_lower_neg.py  04_sedf_slice_upper_neg.py  \
+        05_sedf_extratime_pos.py 06_sedf_extratime_disable_neg.py
 
 XFAIL_TESTS = 
 
diff -r f14e12b3327a tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py
--- /dev/null   Tue Mar  7 23:09:23 2006
+++ b/tools/xm-test/tests/sedf/01_sedf_period_slice_pos.py      Tue Mar  7 
17:18:16 2006
@@ -0,0 +1,62 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@xxxxxxxxxx>
+# Author: Ryan Harper <ryanh@xxxxxxxxxx>
+
+from XmTestLib import *
+
+def get_sedf_params(domain):
+    status, output = traceCommand("xm sched-sedf %s" %(domain.getName()))
+    return (status, output.split('\n')[1].split())
+
+
+domain = XmTestDomain(extraConfig = {"sched":"sedf"})
+
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+# get current param values as baseline
+(status, params) = get_sedf_params(domain)
+
+# check rv
+if status != 0:
+    FAIL("Getting sedf parameters return non-zero rv (%d)", status)
+
+# parse out current params
+(name, domid, p, s, l, e, w) = params
+
+# NB: setting period requires non-zero slice 
+# scale current period in half
+period = str(int(p) / 2)
+slice  = str(int(p) / 4)
+
+opts = "%s -p %s -s %s" %(domain.getName(), period, slice)
+(status, output) = traceCommand("xm sched-sedf %s" %(opts))
+
+# check rv
+if status != 0:
+    FAIL("Setting sedf parameters return non-zero rv (%d)" % status)
+
+# validate 
+(s,params) = get_sedf_params(domain)
+
+# check rv
+if s != 0:
+    FAIL("Getting sedf parameters return non-zero rv (%d)" % s)
+
+(name,domid,p1,s1,l1,e1,w1) = params
+
+if p1 != period:
+    FAIL("Failed to change domain period from %d to %d" %(p, period))
+
+if s1 != slice:
+    FAIL("Failed to change domain slice from %d to %d" %(s, slice))
+
+# Stop the domain (nice shutdown)
+domain.stop()
diff -r f14e12b3327a tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py
--- /dev/null   Tue Mar  7 23:09:23 2006
+++ b/tools/xm-test/tests/sedf/02_sedf_period_lower_neg.py      Tue Mar  7 
17:18:16 2006
@@ -0,0 +1,41 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@xxxxxxxxxx>
+# Author: Ryan Harper <ryanh@xxxxxxxxxx>
+#
+# Test if sched-sedf <dom> -p <period> handles lower bound 
+
+from XmTestLib import *
+
+def get_sedf_params(domain):
+    status, output = traceCommand("xm sched-sedf %s" %(domain.getName()))
+    return (status, output.split('\n')[1].split())
+
+
+domain = XmTestDomain(extraConfig = {"sched":"sedf"})
+
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+# pick bogus period
+period = "-1"
+
+# NB: setting period requires non-zero slice 
+# scale current period in half
+slice  = "1"
+
+opts = "%s -p %s -s %s" %(domain.getName(), period, slice)
+(status, output) = traceCommand("xm sched-sedf %s" %(opts))
+
+# we should see this output from xm 
+eyecatcher = "Failed to set sedf parameters"
+
+# check for failure
+if output.find(eyecatcher) >= 0:
+    FAIL("sched-sedf let me set bogus period (%s)" %(period))
diff -r f14e12b3327a tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py
--- /dev/null   Tue Mar  7 23:09:23 2006
+++ b/tools/xm-test/tests/sedf/03_sedf_slice_lower_neg.py       Tue Mar  7 
17:18:16 2006
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@xxxxxxxxxx>
+# Author: Ryan Harper <ryanh@xxxxxxxxxx>
+#
+# Test if sched-sedf <dom> -p <period> handles lower bound 
+
+from XmTestLib import *
+
+def get_sedf_params(domain):
+    status, output = traceCommand("xm sched-sedf %s" %(domain.getName()))
+    return (status, output.split('\n')[1].split())
+
+
+domain = XmTestDomain(extraConfig = {"sched":"sedf"})
+
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+# pick bogus slice
+slice  = "0"
+
+opts = "%s -s %s" %(domain.getName(), slice)
+(status, output) = traceCommand("xm sched-sedf %s" %(opts))
+
+# we should see this output from xm 
+eyecatcher = "Failed to set sedf parameters"
+
+# check for failure
+if output.find(eyecatcher) >= 0:
+    FAIL("sched-sedf let me set bogus slice (%s)" %(slice)
diff -r f14e12b3327a tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py
--- /dev/null   Tue Mar  7 23:09:23 2006
+++ b/tools/xm-test/tests/sedf/04_sedf_slice_upper_neg.py       Tue Mar  7 
17:18:16 2006
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@xxxxxxxxxx>
+# Author: Ryan Harper <ryanh@xxxxxxxxxx>
+
+from XmTestLib import *
+
+def get_sedf_params(domain):
+    status, output = traceCommand("xm sched-sedf %s" %(domain.getName()))
+    return (status, output.split('\n')[1].split())
+
+
+domain = XmTestDomain(extraConfig = {"sched":"sedf"})
+
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+# get current param values as baseline
+(status, params) = get_sedf_params(domain)
+
+# check rv
+if status != 0:
+    FAIL("Getting sedf parameters return non-zero rv (%d)", status)
+
+# parse out current params
+(name, domid, p, s, l, e, w) = params
+
+# set slice > than current period
+slice  = str(int(p)+1)
+
+opts = "%s -s %s" %(domain.getName(), slice)
+(status, output) = traceCommand("xm sched-sedf %s" %(opts))
+
+# we should see this output from xm 
+eyecatcher = "Failed to set sedf parameters"
+
+# check for failure
+if output.find(eyecatcher) >= 0:
+    FAIL("sched-sedf let me set a slice bigger than my period.")
diff -r f14e12b3327a tools/xm-test/tests/sedf/05_sedf_extratime_pos.py
--- /dev/null   Tue Mar  7 23:09:23 2006
+++ b/tools/xm-test/tests/sedf/05_sedf_extratime_pos.py Tue Mar  7 17:18:16 2006
@@ -0,0 +1,63 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@xxxxxxxxxx>
+# Author: Ryan Harper <ryanh@xxxxxxxxxx>
+
+from XmTestLib import *
+
+def get_sedf_params(domain):
+    status, output = traceCommand("xm sched-sedf %s" %(domain.getName()))
+    return (status, output.split('\n')[1].split())
+
+
+domain = XmTestDomain(extraConfig = {"sched":"sedf"})
+
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+# get current param values as baseline
+(status, params) = get_sedf_params(domain)
+
+# check rv
+if status != 0:
+    FAIL("Getting sedf parameters return non-zero rv (%d)", status)
+
+# parse out current params
+(name, domid, p, s, l, e, w) = params
+
+# toggle extratime value
+extratime = str((int(e)+1)%2)
+
+direction = "disable"
+# NB: when disabling extratime(=0), must pass in a slice
+opts = "%s -e %s" %(domain.getName(), extratime)
+if extratime == "0":
+    opts += " -s %s" %( str( (int(p)/2)+1 ) )
+    direction = "enable"
+    
+(status, output) = traceCommand("xm sched-sedf %s" %(opts))
+
+# check rv
+if status != 0:
+   FAIL("Setting sedf parameters return non-zero rv (%d)" % status)
+
+# validate
+(s,params) = get_sedf_params(domain)
+
+# check rv
+if s != 0:
+    FAIL("Getting sedf parameters return non-zero rv (%d)" % s)
+
+(name,domid,p1,s1,l1,e1,w1) = params
+
+if e1 != extratime:
+    FAIL("Failed to %s extratime" %(direction))
+
+# Stop the domain (nice shutdown)
+domain.stop()
diff -r f14e12b3327a tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py
--- /dev/null   Tue Mar  7 23:09:23 2006
+++ b/tools/xm-test/tests/sedf/06_sedf_extratime_disable_neg.py Tue Mar  7 
17:18:16 2006
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+
+# Copyright (C) International Business Machines Corp., 2005
+# Author: Dan Smith <danms@xxxxxxxxxx>
+# Author: Ryan Harper <ryanh@xxxxxxxxxx>
+
+from XmTestLib import *
+
+def get_sedf_params(domain):
+    status, output = traceCommand("xm sched-sedf %s" %(domain.getName()))
+    return (status, output.split('\n')[1].split())
+
+
+domain = XmTestDomain(extraConfig = {"sched":"sedf"})
+
+try:
+    domain.start()
+except DomainError, e:
+    if verbose:
+        print "Failed to create test domain because:"
+        print e.extra
+    FAIL(str(e))
+
+# get current param values as baseline
+(status, params) = get_sedf_params(domain)
+
+# check rv
+if status != 0:
+    FAIL("Getting sedf parameters return non-zero rv (%d)", status)
+
+# parse out current params
+(name, domid, p, s, l, e, w) = params
+
+# if extratime is off, turn it on and drop slice to 0
+if str(e) == "0":
+    extratime = 1
+    opts = "%s -e %s" %(domain.getName(), extratime)
+    (status, output) = traceCommand("xm sched-sedf %s" %(opts))
+
+    # check rv
+    if status != 0:
+        FAIL("Failed to force extratime on (%d)" % status)
+
+    # drop slice to 0 now that we are in extratime mode
+    slice = 0
+
+    opts = "%s -s %s" %(domain.getName(), slice)
+    (status, output) = traceCommand("xm sched-sedf %s" %(opts))
+
+    # check rv
+    if status != 0:
+        FAIL("Failed to force slice to 0 (%d)" % status)
+
+
+# ASSERT(extratime=1, slice=0)
+
+# attempt to disable extratime without setting slice
+extratime = "0"
+
+opts = "%s -e %s " %(domain.getName(), extratime)
+(status, output) = traceCommand("xm sched-sedf %s" %(opts))
+
+# we should see this output from xm 
+eyecatcher = "Failed to set sedf parameters"
+
+# check for failure
+if output.find(eyecatcher) >= 0:
+    FAIL("sched-sedf let me disable extratime without a non-zero slice")
diff -r f14e12b3327a tools/xm-test/tests/sedf/01_sedf_multi_pos.py
--- a/tools/xm-test/tests/sedf/01_sedf_multi_pos.py     Tue Mar  7 23:09:23 2006
+++ /dev/null   Tue Mar  7 17:18:16 2006
@@ -1,28 +0,0 @@
-#!/usr/bin/python
-
-# Copyright (C) International Business Machines Corp., 2005
-# Author: Dan Smith <danms@xxxxxxxxxx>
-
-from XmTestLib import *
-
-sedf_opts = "20000000 5000000 0 0 0"
-
-domain = XmTestDomain(extraConfig = {"sched":"sedf"})
-
-try:
-    domain.start()
-except DomainError, e:
-    if verbose:
-        print "Failed to create test domain because:"
-        print e.extra
-    FAIL(str(e))
-
-for i in range(5):
-    status, output = traceCommand("xm sched-sedf %s %s" % (domain.getName(),
-                                                           sedf_opts))
-    if status != 0:
-        FAIL("[%i] xm sedf returned invalid %i != 0" % (i, status))
-
-    
-    
-

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