[615] | 1 | #!/usr/bin/python |
---|
| 2 | """ |
---|
| 3 | Help on using the Invirt remctl functions. |
---|
| 4 | """ |
---|
| 5 | import sys |
---|
| 6 | |
---|
| 7 | |
---|
| 8 | help = [ |
---|
| 9 | ('list', 'show your VM\'s state (with xm list)'), |
---|
| 10 | ('list-long', 'show your VM\'s state as an sexp (with xm list --long)'), |
---|
| 11 | ('vcpu-list', 'show your VM\'s state (with xm vcpu-list)'), |
---|
| 12 | ('uptime', 'show your VM\'s state (with xm uptime)'), |
---|
| 13 | ('destroy', 'shut down your VM, hard (with xm destroy)'), |
---|
| 14 | ('shutdown', 'shut down your VM, softly if paravm (with xm shutdown)'), |
---|
| 15 | ('create', 'start up your VM (with xm create)'), |
---|
| 16 | ('reboot', 'reboot your VM (with xm destroy and xm create)'), |
---|
| 17 | #also install |
---|
| 18 | #also CD images on create/reboot |
---|
| 19 | ] |
---|
| 20 | helpdict = dict(help) |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | def print_help(name, text): |
---|
| 24 | print ' %-9s : %s' % (name, text) |
---|
| 25 | |
---|
| 26 | def main(args): |
---|
| 27 | args = [n for n in args if n in helpdict] |
---|
| 28 | print 'remctl remote control <machine> <command>' |
---|
| 29 | if args: |
---|
| 30 | for name in args: |
---|
| 31 | print_help(name, helpdict[name]) |
---|
| 32 | else: |
---|
| 33 | for name, text in help: |
---|
| 34 | print_help(name, text) |
---|
| 35 | |
---|
| 36 | return 0 |
---|
| 37 | |
---|
| 38 | if __name__ == '__main__': |
---|
| 39 | sys.exit(main(sys.argv[1:])) |
---|
| 40 | |
---|
| 41 | # vim:et:sw=4:ts=4 |
---|