Ignore:
Timestamp:
Oct 9, 2008, 2:12:32 AM (16 years ago)
Author:
broder
Message:

Expose an interface to the autoinstaller over remctl and validate options

Location:
trunk/packages/sipb-xen-remote-server/files/usr/sbin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remctl-help

    r830 r1088  
    1616    ('create',    'start up your VM (with xm create)'),
    1717    ('reboot',    'reboot your VM (with xm destroy and xm create)'),
    18     #also install
     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)'),
    1919    #also CD images on create/reboot
    2020]
  • trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remote-create

    r816 r1088  
    2121
    2222def main(argv):
    23     if len(argv) < 2:
    24         print >> sys.stderr, "usage: sipb-xen-remote-create <machine> [<other args...>]"
     23    if len(argv) < 3:
     24        print >> sys.stderr, "usage: sipb-xen-remote-create <operation> <machine> [<other args...>]"
    2525        return 2
    26     machine_name = argv[1]
    27     args = argv[2:]
     26    operation = argv[1]
     27    machine_name = argv[2]
     28    args = argv[3:]
     29   
     30    if operation == 'install':
     31        options = dict(arg.split('=', 1) for arg in args)
     32        valid_keys = set(('mirror', 'dist', 'arch', 'imagesize', 'noinstall'))
     33        if not set(options.keys()).issubset(valid_keys):
     34            print >> sys.stderr, "Invalid argument. Use the help command to see valid arguments to install"
     35            return 1
     36        if any(' ' in val for val in options.values()):
     37            print >> sys.stderr, "Arguments to the autoinstaller cannot contain spaces"
     38            return 1
    2839
    2940    p = Popen(['/usr/sbin/sipb-xen-remote-proxy-web', 'listvms'], stdout=PIPE)
     
    4455    sys.stdout.flush()
    4556    return call(['remctl', host, 'remote', 'control',
    46                  machine_name, 'create'] + args)
     57                 machine_name, operation] + args)
    4758
    4859if __name__ == '__main__':
  • trunk/packages/sipb-xen-remote-server/files/usr/sbin/sipb-xen-remote-proxy

    r830 r1088  
    1515    web/listvms )
    1616        sipb-xen-remote-listvms "$@" ;;
    17     control/create )
    18         sipb-xen-remote-create "$MACHINE" "$@" ;;
     17    control/create|control/install )
     18        sipb-xen-remote-create "$SERVICE" "$MACHINE" "$@" ;;
    1919    control/listhost )
    2020        sipb-xen-remote-listhost "$MACHINE" "$@" ;;
Note: See TracChangeset for help on using the changeset viewer.