X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/e37dd15bbf8683bab8454ea0eec8e9968ce982b2..fa88b9bd09fdc75e26422604bb2b74821e3a9b07:/code/main.py diff --git a/code/main.py b/code/main.py index a3c84ee..df2ef4e 100755 --- a/code/main.py +++ b/code/main.py @@ -136,7 +136,7 @@ def hasVnc(status): def parseCreate(user, fields): name = fields.getfirst('name') if not validation.validMachineName(name): - raise InvalidInput('name', name, 'You must provide a machine name.') + raise InvalidInput('name', name, 'You must provide a machine name. Max 22 chars, alnum plus \'-\' and \'_\'.') name = name.lower() if Machine.get_by(name=name): @@ -152,15 +152,18 @@ def parseCreate(user, fields): disk_size = validation.validDisk(owner, disk_size) vm_type = fields.getfirst('vmtype') - if vm_type not in ('hvm', 'paravm'): - raise CodeError("Invalid vm type '%s'" % vm_type) - is_hvm = (vm_type == 'hvm') + vm_type = validation.validVmType(vm_type) cdrom = fields.getfirst('cdrom') if cdrom is not None and not CDROM.get(cdrom): raise CodeError("Invalid cdrom type '%s'" % cdrom) + + clone_from = fields.getfirst('clone_from') + if clone_from and clone_from != 'ice3': + raise CodeError("Invalid clone image '%s'" % clone_from) + return dict(contact=user, name=name, memory=memory, disk_size=disk_size, - owner=owner, is_hvm=is_hvm, cdrom=cdrom) + owner=owner, machine_type=vm_type, cdrom=cdrom, clone_from=clone_from) def create(user, fields): """Handler for create requests.""" @@ -205,6 +208,9 @@ def getListDict(user): owner=user, cdrom='gutsy-i386') checkpoint.checkpoint('Got defaults') + def sortkey(machine): + return (machine.owner != user, machine.owner, machine.name) + machines = sorted(machines, key=sortkey) d = dict(user=user, cant_add_vm=validation.cantAddVm(user), max_memory=max_memory, @@ -339,9 +345,9 @@ def command(user, fields): return templates.list(searchList=[d]) elif back == 'info': machine = validation.testMachineId(user, fields.getfirst('machine_id')) - d = infoDict(user, machine) - d['result'] = result - return templates.info(searchList=[d]) + return ({'Status': '302', + 'Location': '/info?machine_id=%d' % machine.machine_id}, + "You shouldn't see this message.") else: raise InvalidInput('back', back, 'Not a known back page.') @@ -421,9 +427,10 @@ def helpHandler(user, fields): subjects = fields.getlist('subject') help_mapping = dict(paravm_console=""" -ParaVM machines do not support console access over VNC. To access -these machines, you either need to boot with a liveCD and ssh in or -hope that the sipb-xen maintainers add support for serial consoles.""", +ParaVM machines do not support local console access over VNC. To +access the serial console of these machines, you can SSH with Kerberos +to sipb-xen-console.mit.edu, using the name of the machine as your +username.""", hvm_paravm=""" HVM machines use the virtualization features of the processor, while ParaVM machines use Xen's emulation of virtualization features. You @@ -435,17 +442,23 @@ The owner field is used to determine quotas. It must be the name of a locker that you are an AFS administrator of. In particular, you or an AFS group you are a member of must have AFS rlidwka bits on the -locker. You can check see who administers the LOCKER locker using the -command 'fs la /mit/LOCKER' on Athena.) See also administrator.""", administrator=""" The administrator field determines who can access the console and power on and off the machine. This can be either a user or a moira group.""", quotas=""" -Quotas are determined on a per-locker basis. Each quota may have a +Quotas are determined on a per-locker basis. Each locker may have a maximum of 512 megabytes of active ram, 50 gigabytes of disk, and 4 -active machines.""" +active machines.""", + console=""" +Framebuffer: At a Linux boot prompt in your VM, try +setting fb=false to disable the framebuffer. If you don't, +your machine will run just fine, but the applet's display of the +console will suffer artifacts. +""" ) if not subjects: @@ -602,7 +615,7 @@ def main(operation, user, fields): output_string = str(output) checkpoint.checkpoint('output as a string') print output_string - print '
%s
' % checkpoint + print '' % checkpoint except Exception, err: if not fields.has_key('js'): if isinstance(err, CodeError):