X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/36097be5e255b54e405def8be29c780ecaa42764..c8c25d005cebfe1189f3ae69ab1440a236490eca:/code/main.py diff --git a/code/main.py b/code/main.py index 31465f6..d17ed97 100755 --- a/code/main.py +++ b/code/main.py @@ -159,8 +159,13 @@ def parseCreate(user, fields): 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, is_hvm=is_hvm, cdrom=cdrom, clone_from=clone_from) def create(user, fields): """Handler for create requests.""" @@ -339,9 +344,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.') @@ -443,7 +448,7 @@ 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.""", console=""" @@ -608,7 +613,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):