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:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-remote-server/debian/changelog

    r1011 r1088  
     1sipb-xen-remote-server (0.9.2) unstable; urgency=low
     2
     3  * Expose an interface to the autoinstaller over remctl
     4  * Validate options to be passed to the autoinstaller on the remctl
     5    server
     6
     7 -- Evan Broder <broder@mit.edu>  Thu, 09 Oct 2008 02:06:00 -0400
     8
    19sipb-xen-remote-server (0.9.1) unstable; urgency=low
    210
  • 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.