X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/1d079163df57b9ba8d4f19fa1b80c07c46f3b2ef..9d93e8953885dee5fdd5cc11249bbf0faf5e65cc:/code/main.py diff --git a/code/main.py b/code/main.py index 24fe062..e5fdfa9 100755 --- a/code/main.py +++ b/code/main.py @@ -105,8 +105,9 @@ class Defaults: cdrom = '' autoinstall = '' name = '' + type = 'linux-hvm' + def __init__(self, max_memory=None, max_disk=None, **kws): - self.type = Type.get('linux-hvm') if max_memory is not None: self.memory = min(self.memory, max_memory) if max_disk is not None: @@ -576,8 +577,9 @@ def infoDict(user, machine): checkpoint.checkpoint('Got mem') max_disk = validation.maxDisk(user, machine) defaults = Defaults() - for name in 'machine_id name administrator owner memory contact type'.split(): + for name in 'machine_id name administrator owner memory contact'.split(): setattr(defaults, name, getattr(machine, name)) + defaults.type = machine.type.type_id defaults.disk = "%0.2f" % (machine.disks[0].size/1024.) checkpoint.checkpoint('Got defaults') d = dict(user=user,