source: trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remctl-help @ 1099

Last change on this file since 1099 was 1088, checked in by broder, 16 years ago

Expose an interface to the autoinstaller over remctl and validate options

  • Property svn:executable set to *
File size: 1.4 KB
RevLine 
[615]1#!/usr/bin/python
2"""
3Help on using the Invirt remctl functions.
4"""
5import sys
[830]6from invirt.config import structs as config
[615]7
8help = [
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]
21helpdict = dict(help)
22
23
24def print_help(name, text):
25    print %-9s : %s' % (name, text)
26
27def 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
39if __name__ == '__main__':
40    sys.exit(main(sys.argv[1:]))
41
42# vim:et:sw=4:ts=4
Note: See TracBrowser for help on using the repository browser.