[615] | 1 | #!/usr/bin/python |
---|
| 2 | """ |
---|
| 3 | Help on using the Invirt remctl functions. |
---|
| 4 | """ |
---|
| 5 | import sys |
---|
[830] | 6 | from invirt.config import structs as config |
---|
[615] | 7 | |
---|
| 8 | help = [ |
---|
| 9 | ('list', 'show your VM\'s state (with xm list)'), |
---|
[663] | 10 | ('listhost', 'show on what host, if any, your VM is running'), |
---|
[615] | 11 | ('list-long', 'show your VM\'s state as an sexp (with xm list --long)'), |
---|
| 12 | ('vcpu-list', 'show your VM\'s state (with xm vcpu-list)'), |
---|
| 13 | ('uptime', 'show your VM\'s state (with xm uptime)'), |
---|
| 14 | ('destroy', 'shut down your VM, hard (with xm destroy)'), |
---|
| 15 | ('shutdown', 'shut down your VM, softly if paravm (with xm shutdown)'), |
---|
| 16 | ('create', 'start up your VM (with xm create)'), |
---|
| 17 | ('reboot', 'reboot your VM (with xm destroy and xm create)'), |
---|
[1088] | 18 | ('install', 'autoinstall your VM (takes a series of key=value pairs; \n\t\tvalid arguments include mirror, dist, arch, imagesize,\n\t\tand noinstall)'), |
---|
[615] | 19 | #also CD images on create/reboot |
---|
| 20 | ] |
---|
| 21 | helpdict = dict(help) |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | def print_help(name, text): |
---|
| 25 | print ' %-9s : %s' % (name, text) |
---|
| 26 | |
---|
| 27 | def main(args): |
---|
| 28 | args = [n for n in args if n in helpdict] |
---|
[830] | 29 | print 'remctl %s control <machine> <command>' % config.remote.hostname |
---|
[615] | 30 | if args: |
---|
| 31 | for name in args: |
---|
| 32 | print_help(name, helpdict[name]) |
---|
| 33 | else: |
---|
| 34 | for name, text in help: |
---|
| 35 | print_help(name, text) |
---|
| 36 | |
---|
| 37 | return 0 |
---|
| 38 | |
---|
| 39 | if __name__ == '__main__': |
---|
| 40 | sys.exit(main(sys.argv[1:])) |
---|
| 41 | |
---|
| 42 | # vim:et:sw=4:ts=4 |
---|