From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Smith Subject: [RESEND] [PATCH] Cleanup xm commands and "bogus" arguments Date: Wed, 14 Sep 2005 08:32:02 -0700 Message-ID: <87irx3r7gt.fsf@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen Developers List-Id: xen-devel@lists.xenproject.org --=-=-= This is a resend of the union of two patches I sent to xen-tools quite a while ago. I imagine they just got lost, but if they were not applied for a reason, please let me know. The patch includes the discussed xm command renames, as well as a cleanup of the "bogus" argument code, which avoids changing the argument list so that errors can be reported consistently. Signed-off-by: Dan Smith --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=REPATCH-cleanups-renames.patch Content-Transfer-Encoding: quoted-printable diff -r 5959fae4722a docs/misc/sedf_scheduler_mini-HOWTO.txt --- a/docs/misc/sedf_scheduler_mini-HOWTO.txt Wed Sep 14 13:37:50 2005 +++ b/docs/misc/sedf_scheduler_mini-HOWTO.txt Wed Sep 14 08:14:12 2005 @@ -10,7 +10,7 @@ Usage: =C2=A0 =C2=A0-add "sched=3Dsedf" on Xen's boot command-line =C2=A0 =C2=A0-create domains as usual -=C2=A0 =C2=A0-use "xm sedf " +=C2=A0 =C2=A0-use "xm sched-sedf = " =C2=A0 Where: =C2=A0 -period/slice are the normal EDF scheduling parameters in nanos= ecs =C2=A0 -latency-hint is the scaled period in case the domain is doing = heavy I/O @@ -22,23 +22,23 @@ =20 Examples: =C2=A0normal EDF (20ms/5ms): -=C2=A0 xm sedf 20000000 5000000 0 0 0 +=C2=A0 xm sched-sedf 20000000 5000000 0 0 0 =20=20=20 =C2=A0best-effort domains (i.e. non-realtime): -=C2=A0 xm sedf 20000000 0 0 1 0 +=C2=A0 xm sched-sedf 20000000 0 0 1 0 =C2=A0 normal EDF (20ms/5ms) + share of extra-time: -=C2=A0 xm sedf 20000000 5000000 0 1 0 +=C2=A0 xm sched-sedf 20000000 5000000 0 1 0 =20=20=20 =C2=A04 domains with weights 2:3:4:2 -=C2=A0 xm sedf 0 0 0 0 2 -=C2=A0 xm sedf 0 0 0 0 3 -=C2=A0 xm sedf 0 0 0 0 4 -=C2=A0 xm sedf 0 0 0 0 2 +=C2=A0 xm sched-sedf 0 0 0 0 2 +=C2=A0 xm sched-sedf 0 0 0 0 3 +=C2=A0 xm sched-sedf 0 0 0 0 4 +=C2=A0 xm sched-sedf 0 0 0 0 2 =20=20=20 =C2=A01 fully-specified (10ms/3ms) domain, 3 other domains share =C2=A0available rest in 2:7:3 ratio: -=C2=A0 xm sedf 10000000 3000000 0 0 0 -=C2=A0 xm sedf 0 0 0 0 2 -=C2=A0 xm sedf 0 0 0 0 7 -=C2=A0 xm sedf 0 0 0 0 3 \ No newline at end of file +=C2=A0 xm sched-sedf 10000000 3000000 0 0 0 +=C2=A0 xm sched-sedf 0 0 0 0 2 +=C2=A0 xm sched-sedf 0 0 0 0 7 +=C2=A0 xm sched-sedf 0 0 0 0 3 \ No newline at end of file diff -r 5959fae4722a tools/python/xen/xm/main.py --- a/tools/python/xen/xm/main.py Wed Sep 14 13:37:50 2005 +++ b/tools/python/xen/xm/main.py Wed Sep 14 08:14:12 2005 @@ -64,7 +64,6 @@ Domain Commands: console attach to console of DomId cpus-list get the list of cpus for a VCPU - cpus-set set which cpus a VCPU can use.=20 create create a domain destroy terminate a domain immediately domid convert a domain name to a domain id @@ -83,6 +82,7 @@ vcpu-enable disable VCPU in a domain vcpu-disable enable VCPU in a domain vcpu-list get the list of VCPUs for a domain + vcpu-pin set which cpus a VCPU can use.=20 =20 Xen Host Commands: dmesg [--clear] read or clear Xen's message buffer @@ -91,14 +91,15 @@ top monitor system and domains in real-time =20 Scheduler Commands: - bvt set BVT scheduler parameters - bvt_ctxallow set the BVT scheduler context switch allowan= ce - sedf set simple EDF parameters + sched-bvt set BVT scheduler parameters + sched-bvt-ctxallow + Set the BVT scheduler context switch allowance + sched-sedf set simple EDF parameters =20 Virtual Device Commands: - block-create [BackDomId] + block-attach [BackDomId] Create a new virtual block device=20 - block-destroy Destroy a domain's virtual block device + block-detach Destroy a domain's virtual block device block-list List virtual block devices for a domain block-refresh Refresh a virtual block device for a do= main network-limit @@ -172,8 +173,7 @@ from xen.xm import create # ugly hack because the opt parser apparently wants # the subcommand name just to throw it away! - args.insert(0,"bogus") - create.main(args) + create.main(["bogus"] + args) =20 def xm_save(args): arg_check(args,2,"save") @@ -201,8 +201,7 @@ from xen.xm import migrate # ugly hack because the opt parser apparently wants # the subcommand name just to throw it away! - args.insert(0,"bogus") - migrate.main(args) + migrate.main(["bogus"] + args) =20 def xm_list(args): use_long =3D 0 @@ -289,8 +288,7 @@ vcpuinfo) =20 def xm_vcpu_list(args): - args.insert(0,"-v") - xm_list(args) + xm_list(["-v"] + args) =20 def xm_destroy(args): arg_check(args,1,"destroy") @@ -298,33 +296,28 @@ from xen.xm import destroy # ugly hack because the opt parser apparently wants # the subcommand name just to throw it away! - args.insert(0,"bogus") - destroy.main(args) + destroy.main(["bogus"] + args) =20=20=20=20=20=20=20=20=20=20=20=20=20 def xm_reboot(args): arg_check(args,1,"reboot") + from xen.xm import shutdown # ugly hack because the opt parser apparently wants # the subcommand name just to throw it away! - args.insert(0,"bogus") - args.insert(2,"-R") - from xen.xm import shutdown - shutdown.main(args) + shutdown.main(["bogus", "-R"] + args) =20 def xm_shutdown(args): arg_check(args,1,"shutdown") =20 + from xen.xm import shutdown # ugly hack because the opt parser apparently wants # the subcommand name just to throw it away! - args.insert(0,"bogus") - from xen.xm import shutdown - shutdown.main(args) + shutdown.main(["bogus"] + args) =20 def xm_sysrq(args): from xen.xm import sysrq # ugly hack because the opt parser apparently wants # the subcommand name just to throw it away! - args.insert(0,"bogus") - sysrq.main(args) + sysrq.main(["bogus"] + args) =20 def xm_pause(args): arg_check(args, 1, "pause") @@ -358,8 +351,8 @@ =20 return cpumap =20 -def xm_cpus_set(args): - arg_check(args, 3, "cpus-set") +def xm_vcpu_pin(args): + arg_check(args, 3, "vcpu-pin") =20=20=20=20=20 dom =3D args[0] vcpu =3D int(args[1]) @@ -423,22 +416,22 @@ dom =3D server.xend_domain(name) print sxp.child_value(dom, 'name') =20 -def xm_bvt(args): - arg_check(args, 6, "bvt") +def xm_sched_bvt(args): + arg_check(args, 6, "sched-bvt") dom =3D args[0] v =3D map(long, args[1:6]) from xen.xend.XendClient import server server.xend_domain_cpu_bvt_set(dom, *v) =20 -def xm_bvt_ctxallow(args): - arg_check(args, 1, "bvt_ctxallow") +def xm_sched_bvt_ctxallow(args): + arg_check(args, 1, "sched-bvt-ctxallow") =20 slice =3D int(args[0]) from xen.xend.XendClient import server server.xend_node_cpu_bvt_slice_set(slice) =20 -def xm_sedf(args): - arg_check(args, 6, "sedf") +def xm_sched_sedf(args): + arg_check(args, 6, "sched-sedf") =20=20=20=20=20 dom =3D args[0] v =3D map(int, args[1:6]) @@ -482,10 +475,11 @@ fn=3Dset_true, default=3D0, use=3D"Clear the contents of the Xen message buffer.") # Work around for gopts - args.insert(0,"bogus") - gopts.parse(args) - if not (1 <=3D len(args) <=3D 2): - err('Invalid arguments: ' + str(args)) + myargs =3D args + myargs.insert(0, "bogus") + gopts.parse(myargs) + if not (1 <=3D len(myargs) <=3D 2): + err('Invalid arguments: ' + str(myargs)) =20 from xen.xend.XendClient import server if not gopts.vals.clear: @@ -512,6 +506,14 @@ sxp.show(x) print =20 +def xm_network_attach(args): + + print "Not implemented" + +def xm_network_detach(args): + + print "Not implemented" +=20=20=20=20 def xm_block_list(args): arg_check(args,1,"block-list") dom =3D args[0] @@ -520,11 +522,14 @@ sxp.show(x) print =20 -def xm_block_create(args): +def xm_block_attach(args): n =3D len(args) + if n =3D=3D 0: + usage("block-attach") +=20=20=20=20=20=20=20=20 if n < 4 or n > 5: err("%s: Invalid argument(s)" % args[0]) - usage("block-create") + usage("block-attach") =20 dom =3D args[0] vbd =3D ['vbd', @@ -546,8 +551,8 @@ from xen.xend.XendClient import server server.xend_domain_device_refresh(dom, 'vbd', dev) =20 -def xm_block_destroy(args): - arg_check(args,2,"block-destroy") +def xm_block_detach(args): + arg_check(args,2,"block-detach") =20 dom =3D args[0] dev =3D args[1] @@ -615,7 +620,7 @@ "mem-max": xm_mem_max, "mem-set": xm_mem_set, # cpu commands - "cpus-set": xm_cpus_set, + "vcpu-pin": xm_vcpu_pin, # "cpus-list": xm_cpus_list, "vcpu-enable": xm_vcpu_enable, "vcpu-disable": xm_vcpu_disable, @@ -631,17 +636,19 @@ "info": xm_info, "log": xm_log, # scheduler - "bvt": xm_bvt, - "bvt_ctxallow": xm_bvt_ctxallow, - "sedf": xm_sedf, + "sched-bvt": xm_sched_bvt, + "sched-bvt-ctxallow": xm_sched_bvt_ctxallow, + "sched-sedf": xm_sched_sedf, # block - "block-create": xm_block_create, - "block-destroy": xm_block_destroy, + "block-attach": xm_block_attach, + "block-detach": xm_block_detach, "block-list": xm_block_list, "block-refresh": xm_block_refresh, # network "network-limit": xm_network_limit, "network-list": xm_network_list, + "network-attach": xm_network_attach, + "network-detach": xm_network_detach, # vnet "vnet-list": xm_vnet_list, "vnet-create": xm_vnet_create, @@ -719,8 +726,6 @@ sys.exit(1) except XendError, ex: if len(args) > 0: - if args[0] =3D=3D "bogus": - args.remove("bogus") handle_xend_error(argv[1], args[0], ex) else: print "Unexpected error:", sys.exc_info()[0] --=-=-= -- Dan Smith IBM Linux Technology Center Open Hypervisor Team email: danms@us.ibm.com --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --=-=-=--