On Wed, 17 Oct 2007 10:53:17 -0400 Daniel Veillard wrote: > On Thu, Oct 11, 2007 at 10:45:44AM -0500, Ryan Harper wrote: > > I think we should support the same cpuset notation that Xen supports, > > which means including ranges (1-4) and negation (^1). These two > > features make describing large ranges much more compact. > > Enclosed is a rewrite of the cpuset notations, which can plug as > a replacement for the current code in xend_internals, it should support > the existing syntax currently used to parse xend topology strings, > and also alllow ranges and negation. It's not as a patch but as a > standlone replacement program which can be used to test (in spirit > of the old topology.c one from Beth). > I guess that's okay, check the test output (and possibly extend the > test cases in tests array), It tried to think of everything including > the weird \\n python xend bug and the 'no cpus' in cell cases. > Just dump tst.c in libvirt/src, add $(INCLUDES) to the > $(CC) $(CFLAGS) -I../include -o tst tst.c .... line and run > make tst > ./tst > and check the output (also enclosed), > The parsing is done in a slightly different way, but that should > not change the output, I checked the test output. It seems work fine to me ! And also, how about this one for specifying "all" as an input ? --- tst.c_org 2007-10-17 20:52:10.000000000 -0400 +++ tst.c 2007-10-17 20:52:57.000000000 -0400 @@ -25,6 +25,7 @@ virXendError(void *conn, virErrorNumber #ifdef STANDALONE const char *tests[] = { + "node0:all", "node0:0-3,7,9-10\n node1:11-14\n", "node0:4,7\n", "node0:8-9,11\n", @@ -166,11 +167,19 @@ parseCpuSet(virConnectPtr conn, const ch while ((*cur != 0) && (*cur != sep)) { /* - * 3 constructs are allowed: + * 4 constructs are allowed: * - N : a single CPU number * - N-M : a range of CPU numbers with N < M * - ^N : remove a single CPU number from the set + * - all : apply the cpumap to all vcpus */ + if ( !strcmp(cur, "all") ) { + char buf[256]; + memset(&buf, 0, sizeof(buf)); + sprintf(buf, "0-%d", maxcpu); + cur = buf; + } + if (*cur == '^') { cur++; neg = 1; Thanks, Saori Fukuta -- Libvir-list mailing list Libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list