Hi there,
I posted this mail some days ago on the devel mailinglist and got no
reply. I hope this is the better place and someone will give me a
hint.
As part of my diploma thesis I am currently extending Xen with
a new scheduler with some real time features.
As I didn't have any prior knowledge of Python I am having a hard
time understanding the path a call to xm takes through Xen.
It starts in my function in main.py where I check whether the
correct options are set.
-----------------main.py
def xm_sched_rtbe(args):
"""Get/Set options for RTBE Scheduler."""
print "called xm_sched_rtbe() argv:"
print args
correctSyntax = False
try:
(opts, params) = getopt.getopt(args, "o:m:d:t:e:p:s:q:i:b:")
print opts
print params
except getopt.GetoptError, opterr:
print opts
print params
err(opterr)
usage('sched-rtbe')
if serverType == SERVER_XEN_API:
err("ServerType SERVER_XEN_API not supported by RTBE.")
result = 1
op = None
mtf = None
domain = None
tp = None
event = None
prio = None
start = None
quantum = None
interval = None
mtf_id = None
for o, a in opts:
if o in ["-o"]:
op = a
elif o in ["-m"]:
mtf = int(a)
elif o in ["-d"]:
domain = int(a)
elif o in ["-t"]:
tp = int(a)
elif o in ["-e"]:
event = int(a)
elif o in ["-p"]:
prio = int(a)
elif o in ["-s"]:
start = int(a)
elif o in ["-q"]:
quantum = int(a)
elif o in ["-i"]:
interval = int(a)
elif o in ["-b"]:
mtf_id = int(a);
if op == "mtf":
op = RTBE_MTF
if mtf is None:
err("Operation 'mtf' needs -m set")
else:
correctSyntax = True
elif op == "bind":
op = RTBE_BIND_TP
if domain is None or tp is None or prio is None:
err("Operation 'bind' needs -d, -t and -p set")
else:
correctSyntax = True
elif op == "event":
op = RTBE_BIND_EVENT
if domain is None or event is None or quantum is None or interval is
None:
err("Operation 'event' needs -d, -q and -i set")
else:
correctSyntax = True
elif op == "add":
op = RTBE_ADD
if tp is None or start is None or quantum is None:
err("Operation 'add' needs -t, -q and -s set")
else:
correctSyntax = True
elif op == "del":
op = RTBE_DEL
if mtf_id is None:
err("Operation 'del' needs -b set")
else:
domain = 0
correctSyntax = True
elif op == "print":
op = RTBE_PRINT
correctSyntax = True
else:
err("Operation must be set: -o {mtf|bind|event|add|del|print}")
result = 0
if correctSyntax == True:
result =
server.xend.domain.sched_rtbe_set(op,domain,mtf,tp,event,prio,start,quantum,interval,mtf_id)
print "called server.xend.domain.sched_rtbe_set. result: %s" % result
if result != 0:
err(str(result))
-----------------end
My call to server.xend.domain.sched_rtbe_set() seems to never make
it into XendDomain.py, which looks like this:
-----------------XendDomain.py
def
domain_sched_rtbe_set(self,op,domain,mtf,tp,event,prio,start,qantum,interval,mtf_id):
"""Set rtbe scheduler parameters for a domain."""
print "called domain_sched_rtbe_set()"
#assert type(op) == int
if op is None:
return None
try:
if op == RTBE_MTF:
print "calling xc.sched_rtbe_mtf_set()"
# we use Dom0 for commands which don't need a domain, because
# of the signature of adjust from struct scheduler:
# int (*adjust) (struct domain *, struct
xen_domctl_scheduler_op *)
dominfo = self.domain_lookup_nr(0)
rc = xc.sched_rtbe_mtf_set(op,dominfo.getDomid(), mtf)
return rc
elif op == RTBE_BIND_TP:
dominfo = self.domain_lookup_nr(domain)
rc = xc.sched_rtbe_bind_tp(op, dominfo.getDomid(), tp, prio)
elif op == RTBE_BIND_EVENT:
dominfo = self.domain_lookup_nr(domain)
rc = xc.sched_rtbe_bind_event(op, dominfo.getDomid(), event,
quantum, interval)
elif op == RTBE_ADD:
dominfo = self.domain_lookup_nr(0)
rc = xc.sched_rtbe_add(op, dominfo.getDomid(), tp,start,quantum)
elif op == RTBE_DEL:
dominfo = self.domain_lookup_nr(0)
rc = xc.sched_rtbe_del(op, dominfo.getDomid(),mtf_id )
elif op == RTBE_PRINT:
dominfo = self.domain_lookup_nr(0)
rc = xc.sched_rtbe_print(op, dominfo.getDomid())
except Exception, ex:
log.exception(ex)
raise XendError(str(ex))
-----------------------------------
The print statement is never executed. All I get is:
Error: (22, 'Invalid argument') and then usage() is called.
Now to the part I do not get: In SrvDomain.py I defined:
def op_domain_sched_rtbe_set(self, _, req):
fn = FormFn(self.xd.domain_sched_rtbe_set,
[['op', 'int'],
['domain', 'int'],
['mtf', 'int'],
['tp', 'int'],
['event', 'int'],
['prio', 'int'],
['start', 'int'],
['quantum', 'int'],
['interval', 'int'],
['mtf_id', 'int']])
val = fn(req.args)
return val
Is this right? Are there any other places at which I have to define
the function? Which code is creating the Error: (22, 'Invalid
argument') message?
This stuff with FormFn is a bit too Python-Voodoo for me :)
Thanks!
MartinD:
_______________________________________________
Xen-tools mailing list
Xen-tools@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-tools
|