All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ken Grant <ken@xensource.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] add per command help to xm
Date: Tue, 15 Nov 2005 12:11:23 -0800	[thread overview]
Message-ID: <437A40EB.4050201@xensource.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

Revised help in xm based on Sean Dague's new man page.   Resurrected 
help on individual commands.

Cheers,
Ken


[-- Attachment #2: xm_help.patch --]
[-- Type: text/plain, Size: 12333 bytes --]

# HG changeset patch
# User kgrant@localhost.localdomain
# Node ID b15def26e09aa8deebe0452733e498b53d072aec
# Parent  090e44133d40247bc3ccbb565b644d02fdac6829
Add per command help / make help match new man pages

diff -r 090e44133d40 -r b15def26e09a tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py	Mon Nov 14 17:13:38 2005
+++ b/tools/python/xen/xm/main.py	Tue Nov 15 19:56:14 2005
@@ -40,26 +40,85 @@
 
 import console
 
+# Strings for shorthelp
+console_help = "console <DomId>                  Attach to domain DomId's console."
+create_help =  """create [-c] <ConfigFile>
+               [Name=Value]..       Create a domain based on Config File"""
+destroy_help = "destroy <DomId>                  Terminate a domain immediately"
+help_help =    "help                             Display this message"
+list_help =    "list [--long] [DomId, ...]       List information about domains"
+mem_max_help = "mem-max <DomId> <Mem>            Set maximum memory reservation for a domain"
+mem_set_help = "mem-set <DomId> <Mem>            Adjust the current memory usage for a domain"
+migrate_help = "migrate <DomId> <Host>           Migrate a domain to another machine"
+pause_help =   "pause <DomId>                    Pause execution of a domain"
+reboot_help =  "reboot <DomId> [-w][-a]          Reboot a domain"
+restore_help = "restore <File>                   Create a domain from a saved state file"
+save_help =    "save <DomId> <File>              Save domain state (and config) to file"
+shutdown_help ="shutdown <DomId> [-w][-a][-R|-H] Shutdown a domain"
+top_help =     "top                              Monitor system and domains in real-time"
+unpause_help = "unpause <DomId>                  Unpause a paused domain"
+
+help_spacer = """
+   """
+
+# Strings for longhelp
+sysrq_help =   "sysrq   <DomId> <letter>         Send a sysrq to a domain"
+domid_help =   "domid <DomName>                  Converts a domain name to a domain id"
+domname_help = "domname <DomId>                  Convert a domain id to a domain name"
+set_vcpus_help = """set-vcpus <DomId> <VCPUs>        Enable the specified number of VCPUs in a
+                                    domain"""
+vcpu_list_help = "vcpu-list <DomId>                List the VCPUs for a domain (or all domains)"
+vcpu_pin_help = "vcpu-pin <DomId> <VCPU> <CPUs>   Set which cpus a VCPU can use" 
+dmesg_help =   "dmesg [--clear]                  Read or clear Xen's message buffer"
+info_help =    "info                             Get information about the xen host"
+log_help = "log      Print the xend log"
+sched_bvt_help = """sched-bvt <Parameters>           Set Borrowed Virtual Time scheduler
+                                    parameters"""
+sched_bvt_ctxallow_help = """sched-bvt-ctxallow <Allow>       Set the BVT scheduler context switch
+                                    allowance"""
+sched_sedf_help = "sched-sedf <Parameters>          Set simple EDF parameters"
+block_attach_help = """block-attach <DomId> <BackDev> <FrontDev> <Mode>
+                [BackDomId]         Create a new virtual block device"""
+block_detach_help = """block-detach  <DomId> <DevId>    Destroy a domain's virtual block device,
+                                    where <DevId> may either be the device ID
+                                    or the device name as mounted in the guest"""
+
+block_list_help = "block-list <DomId>               List virtual block devices for a domain"
+network_attach_help = """network-attach  <DomID> [script=<script>] [ip=<ip>] [mac=<mac>]
+                           [bridge=<bridge>] [backend=<backDomID>]
+                                    Create a new virtual network device """
+network_detach_help = """network-detach  <DomId> <DevId>  Destroy a domain's virtual network
+                                    device, where <DevId> is the device ID."""
+
+network_limit_help = """network-limit <DomId> <Vif>
+                 <Credit> <Period>  Limit the transmission rate of a virtual
+                                    network interface"""
+                                 
+network_list_help = "network-list <DomId>             List virtual network interfaces for a domain"
+vnet_list_help = "vnet-list [-l|--long]            list vnets"
+vnet_create_help = "vnet-create <config>             create a vnet from a config file"
+vnet_delete_help = "vnet-delete <vnetid>             delete a vnet"
+
 
 shorthelp = """Usage: xm <subcommand> [args]
     Control, list, and manipulate Xen guest instances
 
-xm common subcommands:
-    console <DomId>         attach to console of DomId
-    create <CfgFile>        create a domain based on Config File
-    destroy <DomId>         terminate a domain immediately
-    help                    display this message
-    list [DomId, ...]       list information about domains
-    mem-max <DomId> <Mem>   set the maximum memory reservation for a domain
-    mem-set <DomId> <Mem>   adjust the current memory usage for a domain
-    migrate <DomId> <Host>  migrate a domain to another machine
-    pause <DomId>           pause execution of a domain
-    reboot <DomId>          reboot a domain
-    restore <File>          create a domain from a saved state file
-    save <DomId> <File>     save domain state (and config) to file
-    shutdown <DomId>        shutdown a domain
-    top                     monitor system and domains in real-time
-    unpause <DomId>         unpause a paused domain
+xm common subcommands:"""  + help_spacer \
++ console_help + help_spacer \
++ create_help + help_spacer \
++ destroy_help + help_spacer \
++ help_help    + help_spacer \
++ list_help    + help_spacer \
++ mem_max_help + help_spacer \
++ mem_set_help + help_spacer \
++ migrate_help + help_spacer \
++ pause_help   + help_spacer \
++ reboot_help  + help_spacer \
++ restore_help + help_spacer \
++ save_help    + help_spacer \
++ shutdown_help + help_spacer \
++ top_help     + help_spacer \
++ unpause_help + """
 
 <DomName> can be substituted for <DomId> in xm subcommands.
 
@@ -72,66 +131,103 @@
 
 xm full list of subcommands:
 
-  Domain Commands:
-    console <DomId>           attach to console of DomId
-    create  <ConfigFile>      create a domain
-    destroy <DomId>           terminate a domain immediately
-    domid   <DomName>         convert a domain name to a domain id
-    domname <DomId>           convert a domain id to a domain name
-    list                      list information about domains
-    mem-max <DomId> <Mem>     set domain maximum memory limit
-    mem-set <DomId> <Mem>     set the domain's memory dynamically
-    migrate <DomId> <Host>    migrate a domain to another machine
-    pause   <DomId>           pause execution of a domain
-    reboot   [-w|-a] <DomId>  reboot a domain
-    restore <File>            create a domain from a saved state file
-    save    <DomId> <File>    save domain state (and config) to file
-    shutdown [-w|-a] <DomId>  shutdown a domain
-    sysrq   <DomId> <letter>  send a sysrq to a domain
-    unpause <DomId>           unpause a paused domain
-    set-vcpus <DomId> <VCPUs> enable the specified number of VCPUs in a domain
-    vcpu-list <DomId>         list the VCPUs for a domain
-    vcpu-pin <DomId> <VCPU> <CPUs>    set which cpus a VCPU can use. 
-
-  Xen Host Commands:
-    dmesg   [--clear]         read or clear Xen's message buffer
-    info                      get information about the xen host
-    log                       print the xend log
-    top                       monitor system and domains in real-time
-
-  Scheduler Commands:
-    sched-bvt <options>       set BVT scheduler parameters
-    sched-bvt-ctxallow <Allow>
-        Set the BVT scheduler context switch allowance
-    sched-sedf <options>      set simple EDF parameters
-
-  Virtual Device Commands:
-    block-attach  <DomId> <BackDev> <FrontDev> <Mode> [BackDomId]
-        Create a new virtual block device 
-    block-detach  <DomId> <DevId>  Destroy a domain's virtual block device,
-                                   where <DevId> may either be the device ID
-                                   or the device name as mounted in the guest.
-    block-list    <DomId>          List virtual block devices for a domain
-
-    network-attach  <DomID> [script=<script>] [ip=<ip>] [mac=<mac>]
-                            [bridge=<bridge>] [backend=<backDomID>]
-        Create a new virtual network device 
-    network-detach  <DomId> <DevId>  Destroy a domain's virtual network
-                                     device, where <DevId> is the device ID.
-    network-limit   <DomId> <Vif> <Credit> <Period>
-        Limit the transmission rate of a virtual network interface
-    network-list    <DomId>        List virtual network interfaces for a domain
-
-  Vnet commands:
-    vnet-list   [-l|--long]    list vnets
-    vnet-create <config>       create a vnet from a config file
-    vnet-delete <vnetid>       delete a vnet
+  Domain Commands: """ + help_spacer \
++ console_help + help_spacer \
++ create_help + help_spacer \
++ destroy_help + help_spacer \
++ domid_help   + help_spacer \
++ domname_help   + help_spacer \
++ list_help    + help_spacer \
++ mem_max_help + help_spacer \
++ mem_set_help + help_spacer \
++ migrate_help + help_spacer \
++ pause_help   + help_spacer \
++ reboot_help  + help_spacer \
++ restore_help + help_spacer \
++ save_help    + help_spacer \
++ shutdown_help + help_spacer \
++ sysrq_help + help_spacer \
++ top_help     + help_spacer \
++ unpause_help + help_spacer \
++ set_vcpus_help + help_spacer \
++ vcpu_pin_help + """
+
+   Xen Host Commands: """ + help_spacer \
++ dmesg_help + help_spacer \
++ info_help + help_spacer \
++ log_help  + help_spacer \
++ top_help  + """
+
+  Scheduler Commands: """ + help_spacer \
++ sched_bvt_help + help_spacer \
++ sched_bvt_ctxallow_help + help_spacer \
++ sched_sedf_help + """
+
+  Virtual Device Commands:"""  + help_spacer \
++ block_attach_help + help_spacer \
++ block_detach_help + help_spacer \
++ block_list_help + help_spacer \
++ network_attach_help + help_spacer \
++ network_detach_help + help_spacer \
++ network_limit_help + help_spacer \
++ network_list_help + """
+
+  Vnet commands: """ + help_spacer \
++ vnet_list_help + help_spacer \
++ vnet_create_help + help_spacer \
++ vnet_delete_help + """
 
 <DomName> can be substituted for <DomId> in xm subcommands.
 
 For a short list of subcommands run 'xm help'
 For more help on xm see the xm(1) man page
 For more help on xm create, see the xmdomain.cfg(5) man page"""
+
+# array for xm help <command>
+help = {
+    "--long": longhelp,
+    "console": console_help,
+    "create": create_help,
+    "destroy": destroy_help,
+    "domid ": domid_help,
+    "domname": domname_help,
+    "list": list_help,
+    "mem-max": mem_max_help,
+    "mem-set": mem_set_help,
+    "migrate": migrate_help,
+    "pause": pause_help,
+    "reboot": reboot_help,
+    "restore": restore_help,
+    "save":  save_help,
+    "shutdown": shutdown_help,
+    "sysrq": sysrq_help,
+    "unpause": unpause_help,
+    "set-vcpus": set_vcpus_help,
+    "vcpu-list": vcpu_list_help,
+    "vcpu-pin": vcpu_pin_help,
+#  Xen Host Commands:
+    "dmesg": dmesg_help,
+    "info":  info_help,
+    "log":   log_help,
+    "top":  top_help,
+#  Scheduler Commands:
+    "sched-bvt": sched_bvt_help,
+    "sched-bvt-ctxallow": sched_bvt_ctxallow_help,
+    "sched-sedf":  sched_sedf_help,
+
+#  Virtual Device Commands:
+    "block-attach": block_attach_help,
+    "block-detach": block_detach_help,
+    "block-list": block_list_help,
+    "network-attach": network_attach_help,
+    "network-detach": network_detach_help,
+    "network-limit": network_limit_help,
+    "network-list":  network_list_help,
+# Vnet commands:
+    "vnet-list": vnet_list_help,
+    "vnet-create": vnet_create_help,
+    "vnet-delete": vnet_delete_help
+   }
 
 ####################################################################
 #
@@ -745,10 +841,6 @@
     "vbd-list": "block-list",
     }
 
-help = {
-    "--long": longhelp
-   }
-
 
 def xm_lookup_cmd(cmd):
     if commands.has_key(cmd):
@@ -770,7 +862,7 @@
 
 def usage(cmd=None):
     if help.has_key(cmd):
-        print help[cmd]
+        print "   " + help[cmd]
     else:
         print shorthelp
     sys.exit(1)

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

                 reply	other threads:[~2005-11-15 20:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=437A40EB.4050201@xensource.com \
    --to=ken@xensource.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.