[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] xm,xend: flesh out xm sched-sedf
On Tue, Mar 07, 2006 at 05:42:43PM -0600, Ryan Harper wrote: > 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. Applied, complete with FIXME. > 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]) You can probably just go with def domid_match(domid, info): return domid == info['name'] || domid == str(info['dom']) and then, because I prefer to use None when I really mean 'value unspecified', and because I'd want to roll the test for 'unspecified' into domid_match, I'd do def domid_match(domid, info): return domid is None || domid == info['name'] || domid == str(info['dom']) and change the domid = -1 to domid = None, which then means that > + if domid == '-1' or domid_match(domid, d): loses the first test. Neater, IMHO, mainly because now we've got the one test, we can use filter and get rid of the for loop and the if statement altogether: doms = filter(lambda x : domid_match(domid, x), [parse_doms_info(dom) for dom in getDomains("")]) (It's a real shame that Guido's eschewed a decent partial-application syntax, because Python's list comprehensions are really nice, but some extra syntax for partial applications would make this example much nicer.) I'll let you try this; if you like it, send a patch back. Cheers, Ewan. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |