potential bug in "xm atropos" implementation
Quoted 1 line
From
tools/libxc/xc_atropos.c:
int xc_atropos_domain_set(int xc_handle,
u32 domid, u64 period, u64 slice, u64 latency,
int xtratime)which takes 6 arguments
Quoted 1 line
From
tools/python/xen/xm/main.py:
class ProgAtropos(Prog):
<snip>
def main(self, args):
if len(args) != 5: self.err("%s: Invalid argument(s)" % args[0])
dom = args[1]
v = map(int, args[2:5])
server.xend_domain_cpu_atropos_set(dom, *v)Now if you specify all 6 arguments on the command line, xm atropos fails with "Invalid arguments" due to the above code. If you give 5 arguments, ProgAtropos fails since the corresponding libxc function call takes 6 arguments.
Following patch will fix it:
main.py (working copy) renamed from main.py (revision 185) +2 -2
@@ -579,9 +579,9 @@ print "\nSet atropos parameters." def main(self, args): - if len(args) != 5: self.err("%s: Invalid argument(s)" % args[0]) + if len(args) != 6: self.err("%s: Invalid argument(s)" % args[0]) dom = args[1] - v = map(int, args[2:5]) + v = map(int, args[2:6]) server.xend_domain_cpu_atropos_set(dom, *v) xm.prog(ProgAtropos)
Signature · 9 lines
Diwaker Gupta http://resolute.ucsd.edu/diwaker ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl
Quoted 17 lines · Diwaker Gupta
From
tools/libxc/xc_atropos.c:int xc_atropos_domain_set(int
xc_handle,u32 domid, u64 period, u64 slice, u64 latency, int xtratime)which takes 6 arguments
From
tools/python/xen/xm/main.py:
class ProgAtropos(Prog):
<snip>def main(self, args): if len(args) != 5: self.err("%s: Invalid argument(s)" % args[0]) dom = args[1] v = map(int, args[2:5]) server.xend_domain_cpu_atropos_set(dom, *v)
Quoted 4 lines
Now if you specify all 6 arguments on the command line, xm atropos fails with "Invalid arguments" due to the above code. If you give 5 arguments, ProgAtropos fails since the corresponding libxc function call takes 6 arguments.
No, the 6th argument you see in the xc_atropos_domain_set function signature (i.e. the function's 1st argument -- xc_handle) is added in the Pyhton<->xc interface function pyxc_atropos_domain_set (in tools/python/xen/lowlevel/xc/xc.c).
christian
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
Quoted 4 lines
No, the 6th argument you see in the
xc_atropos_domain_setfunction signature (i.e. the function's 1st argument --xc_handle) is added in the Pyhton<->xc interface functionpyxc_atropos_domain_set(intools/python/xen/lowlevel/xc/xc.c).
I see. Basically I was running into this problem:
$ xm help atropos <lists FIVE params>
$ xm atropos 1 30 100 10 1 <FIVE params> Error: atropos: Invalid argument(s)
$ xm atropos 1 30 100 10 <FOUR params>
Traceback (most recent call last):
File "/usr/sbin/xm", line 6, in ?
main.main(sys.argv)
File "/usr/lib/python2.3/site-packages/xen/xm/main.py", line 786, in main
xm.main(args)
File "/usr/lib/python2.3/site-packages/xen/xm/main.py", line 105, in main
self.main_call(args)
File "/usr/lib/python2.3/site-packages/xen/xm/main.py", line 123, in main_call
p.main(args[1:])
File "/usr/lib/python2.3/site-packages/xen/xm/main.py", line 585, in main
server.xend_domain_cpu_atropos_set(dom, *v)
TypeError: xend_domain_cpu_atropos_set() takes exactly 6 arguments (5 given)Signature · 9 lines
Diwaker Gupta http://resolute.ucsd.edu/diwaker ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl
Christian Limpach
AppliedQuoted 6 lines · Diwaker Gupta
Quoted 4 lines
No, the 6th argument you see in the
xc_atropos_domain_setfunction signature (i.e. the function's 1st argument --xc_handle) is added in the Pyhton<->xc interface functionpyxc_atropos_domain_set(intools/python/xen/lowlevel/xc/xc.c).I see. Basically I was running into this problem:
ah I see, now your patch makes sense ;-) args[2:5] does (confusingly) not include the 5th element and len (of course) counts from 0. The 6th argument which xend_domain_cpu_atropos_set expects (its 1st) is not the 1st argument for xc_atropos_domain_set though...
I've applied your patch... Thanks!
christian
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl