direct-io.hg

changeset 6815:541a3239f352

Rename xm commands and cleanup of the "bogus" argument code.
For the "bogus" argument code, avoid changing the argument list so
that errors can be reported consistently.
Signed-off-by: Dan Smith <danms@us.ibm.com>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Wed Sep 14 17:06:25 2005 +0000 (2005-09-14)
parents 481a4ce27c15
children 9c9a3bb878c2
files docs/misc/sedf_scheduler_mini-HOWTO.txt tools/python/xen/xm/main.py
line diff
     1.1 --- a/docs/misc/sedf_scheduler_mini-HOWTO.txt	Wed Sep 14 15:56:06 2005 +0000
     1.2 +++ b/docs/misc/sedf_scheduler_mini-HOWTO.txt	Wed Sep 14 17:06:25 2005 +0000
     1.3 @@ -10,7 +10,7 @@ Overview:
     1.4  Usage:
     1.5     -add "sched=sedf" on Xen's boot command-line
     1.6     -create domains as usual
     1.7 -   -use "xm sedf <dom-id> <period> <slice> <latency-hint> <extra> <weight>"
     1.8 +   -use "xm sched-sedf <dom-id> <period> <slice> <latency-hint> <extra> <weight>"
     1.9      Where:
    1.10        -period/slice are the normal EDF scheduling parameters in nanosecs
    1.11        -latency-hint is the scaled period in case the domain is doing heavy I/O
    1.12 @@ -22,23 +22,23 @@ Usage:
    1.13  
    1.14  Examples:
    1.15   normal EDF (20ms/5ms):
    1.16 -  xm sedf <dom-id> 20000000 5000000 0 0 0
    1.17 +  xm sched-sedf <dom-id> 20000000 5000000 0 0 0
    1.18    
    1.19   best-effort domains (i.e. non-realtime):
    1.20 -  xm sedf <dom-id> 20000000 0 0 1 0
    1.21 +  xm sched-sedf <dom-id> 20000000 0 0 1 0
    1.22   
    1.23   normal EDF (20ms/5ms) + share of extra-time:
    1.24 -  xm sedf <dom-id> 20000000 5000000 0 1 0
    1.25 +  xm sched-sedf <dom-id> 20000000 5000000 0 1 0
    1.26    
    1.27   4 domains with weights 2:3:4:2
    1.28 -  xm sedf <d1> 0 0 0 0 2
    1.29 -  xm sedf <d2> 0 0 0 0 3
    1.30 -  xm sedf <d3> 0 0 0 0 4
    1.31 -  xm sedf <d4> 0 0 0 0 2
    1.32 +  xm sched-sedf <d1> 0 0 0 0 2
    1.33 +  xm sched-sedf <d2> 0 0 0 0 3
    1.34 +  xm sched-sedf <d3> 0 0 0 0 4
    1.35 +  xm sched-sedf <d4> 0 0 0 0 2
    1.36    
    1.37   1 fully-specified (10ms/3ms) domain, 3 other domains share
    1.38   available rest in 2:7:3 ratio:
    1.39 -  xm sedf <d1> 10000000 3000000 0 0 0
    1.40 -  xm sedf <d2> 0 0 0 0 2
    1.41 -  xm sedf <d3> 0 0 0 0 7
    1.42 -  xm sedf <d4> 0 0 0 0 3
    1.43 \ No newline at end of file
    1.44 +  xm sched-sedf <d1> 10000000 3000000 0 0 0
    1.45 +  xm sched-sedf <d2> 0 0 0 0 2
    1.46 +  xm sched-sedf <d3> 0 0 0 0 7
    1.47 +  xm sched-sedf <d4> 0 0 0 0 3
     2.1 --- a/tools/python/xen/xm/main.py	Wed Sep 14 15:56:06 2005 +0000
     2.2 +++ b/tools/python/xen/xm/main.py	Wed Sep 14 17:06:25 2005 +0000
     2.3 @@ -64,7 +64,6 @@ xm full list of subcommands:
     2.4    Domain Commands:
     2.5      console <DomId>         attach to console of DomId
     2.6      cpus-list <DomId> <VCpu>          get the list of cpus for a VCPU
     2.7 -    cpus-set <DomId> <VCpu> <CPUS>    set which cpus a VCPU can use. 
     2.8      create  <ConfigFile>      create a domain
     2.9      destroy <DomId>           terminate a domain immediately
    2.10      domid   <DomName>         convert a domain name to a domain id
    2.11 @@ -83,6 +82,7 @@ xm full list of subcommands:
    2.12      vcpu-enable <DomId> <VCPU>        disable VCPU in a domain
    2.13      vcpu-disable <DomId> <VCPU>       enable VCPU in a domain
    2.14      vcpu-list <DomId>                 get the list of VCPUs for a domain
    2.15 +    vcpu-pin <DomId> <VCpu> <CPUS>    set which cpus a VCPU can use. 
    2.16  
    2.17    Xen Host Commands:
    2.18      dmesg   [--clear]         read or clear Xen's message buffer
    2.19 @@ -91,14 +91,15 @@ xm full list of subcommands:
    2.20      top                       monitor system and domains in real-time
    2.21  
    2.22    Scheduler Commands:
    2.23 -    bvt <options>             set BVT scheduler parameters
    2.24 -    bvt_ctxallow <Allow>      set the BVT scheduler context switch allowance
    2.25 -    sedf <options>            set simple EDF parameters
    2.26 +    sched-bvt <options>       set BVT scheduler parameters
    2.27 +    sched-bvt-ctxallow <Allow>
    2.28 +        Set the BVT scheduler context switch allowance
    2.29 +    sched-sedf <options>      set simple EDF parameters
    2.30  
    2.31    Virtual Device Commands:
    2.32 -    block-create <DomId> <BackDev> <FrontDev> <Mode> [BackDomId]
    2.33 +    block-attach  <DomId> <BackDev> <FrontDev> <Mode> [BackDomId]
    2.34          Create a new virtual block device 
    2.35 -    block-destroy <DomId> <DevId>  Destroy a domain's virtual block device
    2.36 +    block-detach  <DomId> <DevId>  Destroy a domain's virtual block device
    2.37      block-list    <DomId>          List virtual block devices for a domain
    2.38      block-refresh <DomId> <DevId>  Refresh a virtual block device for a domain
    2.39      network-limit   <DomId> <Vif> <Credit> <Period>
    2.40 @@ -172,8 +173,7 @@ def xm_create(args):
    2.41      from xen.xm import create
    2.42      # ugly hack because the opt parser apparently wants
    2.43      # the subcommand name just to throw it away!
    2.44 -    args.insert(0,"bogus")
    2.45 -    create.main(args)
    2.46 +    create.main(["bogus"] + args)
    2.47  
    2.48  def xm_save(args):
    2.49      arg_check(args,2,"save")
    2.50 @@ -201,8 +201,7 @@ def xm_migrate(args):
    2.51      from xen.xm import migrate
    2.52      # ugly hack because the opt parser apparently wants
    2.53      # the subcommand name just to throw it away!
    2.54 -    args.insert(0,"bogus")
    2.55 -    migrate.main(args)
    2.56 +    migrate.main(["bogus"] + args)
    2.57  
    2.58  def xm_list(args):
    2.59      use_long = 0
    2.60 @@ -289,8 +288,7 @@ def xm_show_vcpus(domsinfo):
    2.61                     vcpuinfo)
    2.62  
    2.63  def xm_vcpu_list(args):
    2.64 -    args.insert(0,"-v")
    2.65 -    xm_list(args)
    2.66 +    xm_list(["-v"] + args)
    2.67  
    2.68  def xm_destroy(args):
    2.69      arg_check(args,1,"destroy")
    2.70 @@ -298,33 +296,28 @@ def xm_destroy(args):
    2.71      from xen.xm import destroy
    2.72      # ugly hack because the opt parser apparently wants
    2.73      # the subcommand name just to throw it away!
    2.74 -    args.insert(0,"bogus")
    2.75 -    destroy.main(args)
    2.76 +    destroy.main(["bogus"] + args)
    2.77              
    2.78  def xm_reboot(args):
    2.79      arg_check(args,1,"reboot")
    2.80 +    from xen.xm import shutdown
    2.81      # ugly hack because the opt parser apparently wants
    2.82      # the subcommand name just to throw it away!
    2.83 -    args.insert(0,"bogus")
    2.84 -    args.insert(2,"-R")
    2.85 -    from xen.xm import shutdown
    2.86 -    shutdown.main(args)
    2.87 +    shutdown.main(["bogus", "-R"] + args)
    2.88  
    2.89  def xm_shutdown(args):
    2.90      arg_check(args,1,"shutdown")
    2.91  
    2.92 +    from xen.xm import shutdown
    2.93      # ugly hack because the opt parser apparently wants
    2.94      # the subcommand name just to throw it away!
    2.95 -    args.insert(0,"bogus")
    2.96 -    from xen.xm import shutdown
    2.97 -    shutdown.main(args)
    2.98 +    shutdown.main(["bogus"] + args)
    2.99  
   2.100  def xm_sysrq(args):
   2.101      from xen.xm import sysrq
   2.102      # ugly hack because the opt parser apparently wants
   2.103      # the subcommand name just to throw it away!
   2.104 -    args.insert(0,"bogus")
   2.105 -    sysrq.main(args)
   2.106 +    sysrq.main(["bogus"] + args)
   2.107  
   2.108  def xm_pause(args):
   2.109      arg_check(args, 1, "pause")
   2.110 @@ -358,8 +351,8 @@ def cpu_make_map(cpulist):
   2.111  
   2.112      return cpumap
   2.113  
   2.114 -def xm_cpus_set(args):
   2.115 -    arg_check(args, 3, "cpus-set")
   2.116 +def xm_vcpu_pin(args):
   2.117 +    arg_check(args, 3, "vcpu-pin")
   2.118      
   2.119      dom  = args[0]
   2.120      vcpu = int(args[1])
   2.121 @@ -423,22 +416,22 @@ def xm_domname(args):
   2.122      dom = server.xend_domain(name)
   2.123      print sxp.child_value(dom, 'name')
   2.124  
   2.125 -def xm_bvt(args):
   2.126 -    arg_check(args, 6, "bvt")
   2.127 +def xm_sched_bvt(args):
   2.128 +    arg_check(args, 6, "sched-bvt")
   2.129      dom = args[0]
   2.130      v = map(long, args[1:6])
   2.131      from xen.xend.XendClient import server
   2.132      server.xend_domain_cpu_bvt_set(dom, *v)
   2.133  
   2.134 -def xm_bvt_ctxallow(args):
   2.135 -    arg_check(args, 1, "bvt_ctxallow")
   2.136 +def xm_sched_bvt_ctxallow(args):
   2.137 +    arg_check(args, 1, "sched-bvt-ctxallow")
   2.138  
   2.139      slice = int(args[0])
   2.140      from xen.xend.XendClient import server
   2.141      server.xend_node_cpu_bvt_slice_set(slice)
   2.142  
   2.143 -def xm_sedf(args):
   2.144 -    arg_check(args, 6, "sedf")
   2.145 +def xm_sched_sedf(args):
   2.146 +    arg_check(args, 6, "sched-sedf")
   2.147      
   2.148      dom = args[0]
   2.149      v = map(int, args[1:6])
   2.150 @@ -482,10 +475,11 @@ its contents if the [-c|--clear] flag is
   2.151                fn=set_true, default=0,
   2.152                use="Clear the contents of the Xen message buffer.")
   2.153      # Work around for gopts
   2.154 -    args.insert(0,"bogus")
   2.155 -    gopts.parse(args)
   2.156 -    if not (1 <= len(args) <= 2):
   2.157 -        err('Invalid arguments: ' + str(args))
   2.158 +    myargs = args
   2.159 +    myargs.insert(0, "bogus")
   2.160 +    gopts.parse(myargs)
   2.161 +    if not (1 <= len(myargs) <= 2):
   2.162 +        err('Invalid arguments: ' + str(myargs))
   2.163  
   2.164      from xen.xend.XendClient import server
   2.165      if not gopts.vals.clear:
   2.166 @@ -512,6 +506,14 @@ def xm_network_list(args):
   2.167          sxp.show(x)
   2.168          print
   2.169  
   2.170 +def xm_network_attach(args):
   2.171 +
   2.172 +    print "Not implemented"
   2.173 +
   2.174 +def xm_network_detach(args):
   2.175 +
   2.176 +    print "Not implemented"
   2.177 +    
   2.178  def xm_block_list(args):
   2.179      arg_check(args,1,"block-list")
   2.180      dom = args[0]
   2.181 @@ -520,11 +522,14 @@ def xm_block_list(args):
   2.182          sxp.show(x)
   2.183          print
   2.184  
   2.185 -def xm_block_create(args):
   2.186 +def xm_block_attach(args):
   2.187      n = len(args)
   2.188 +    if n == 0:
   2.189 +        usage("block-attach")
   2.190 +        
   2.191      if n < 4 or n > 5:
   2.192          err("%s: Invalid argument(s)" % args[0])
   2.193 -        usage("block-create")
   2.194 +        usage("block-attach")
   2.195  
   2.196      dom = args[0]
   2.197      vbd = ['vbd',
   2.198 @@ -546,8 +551,8 @@ def xm_block_refresh(args):
   2.199      from xen.xend.XendClient import server
   2.200      server.xend_domain_device_refresh(dom, 'vbd', dev)
   2.201  
   2.202 -def xm_block_destroy(args):
   2.203 -    arg_check(args,2,"block-destroy")
   2.204 +def xm_block_detach(args):
   2.205 +    arg_check(args,2,"block-detach")
   2.206  
   2.207      dom = args[0]
   2.208      dev = args[1]
   2.209 @@ -615,7 +620,7 @@ commands = {
   2.210      "mem-max": xm_mem_max,
   2.211      "mem-set": xm_mem_set,
   2.212      # cpu commands
   2.213 -    "cpus-set": xm_cpus_set,
   2.214 +    "vcpu-pin": xm_vcpu_pin,
   2.215  #    "cpus-list": xm_cpus_list,
   2.216      "vcpu-enable": xm_vcpu_enable,
   2.217      "vcpu-disable": xm_vcpu_disable,
   2.218 @@ -631,17 +636,19 @@ commands = {
   2.219      "info": xm_info,
   2.220      "log": xm_log,
   2.221      # scheduler
   2.222 -    "bvt": xm_bvt,
   2.223 -    "bvt_ctxallow": xm_bvt_ctxallow,
   2.224 -    "sedf": xm_sedf,
   2.225 +    "sched-bvt": xm_sched_bvt,
   2.226 +    "sched-bvt-ctxallow": xm_sched_bvt_ctxallow,
   2.227 +    "sched-sedf": xm_sched_sedf,
   2.228      # block
   2.229 -    "block-create": xm_block_create,
   2.230 -    "block-destroy": xm_block_destroy,
   2.231 +    "block-attach": xm_block_attach,
   2.232 +    "block-detach": xm_block_detach,
   2.233      "block-list": xm_block_list,
   2.234      "block-refresh": xm_block_refresh,
   2.235      # network
   2.236      "network-limit": xm_network_limit,
   2.237      "network-list": xm_network_list,
   2.238 +    "network-attach": xm_network_attach,
   2.239 +    "network-detach": xm_network_detach,
   2.240      # vnet
   2.241      "vnet-list": xm_vnet_list,
   2.242      "vnet-create": xm_vnet_create,
   2.243 @@ -719,8 +726,6 @@ def main(argv=sys.argv):
   2.244              sys.exit(1)
   2.245          except XendError, ex:
   2.246              if len(args) > 0:
   2.247 -                if args[0] == "bogus":
   2.248 -                    args.remove("bogus")
   2.249                  handle_xend_error(argv[1], args[0], ex)
   2.250              else:
   2.251                  print "Unexpected error:", sys.exc_info()[0]