X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/dc5962060920e5b064064f10e539d49a68c9da68..45cc4357dad4c486b8f67a937fb3afa91fcfa09d:/code/controls.py diff --git a/code/controls.py b/code/controls.py index 013e04c..d21eb7a 100644 --- a/code/controls.py +++ b/code/controls.py @@ -78,10 +78,13 @@ def getswap(disksize, memsize): def lvinstall(machine, autoinstall): disksize = machine.disks[0].size memsize = machine.memory - imagesize = disksize - getswap(disksize, memsize) + swapsize = getswap(disksize, memsize) + imagesize = disksize - swapsize ip = machine.nics[0].ip - remctl('web', 'install', machine.name, autoinstall.distribution, - autoinstall.mirror, str(imagesize), ip) + remctl('control', machine.name, 'install', + 'dist=%s' % autoinstall.distribution, + 'mirror=%s' % autoinstall.mirror, + 'imagesize=%s' % imagesize) def lvcopy(machine_orig_name, machine, rootpw): """Copy a golden image onto a machine's disk""" @@ -141,8 +144,9 @@ def createVm(username, state, owner, contact, name, description, memory, disksiz makeDisks(machine) if autoinstall: lvinstall(machine, autoinstall) - # tell it to boot with cdrom - bootMachine(machine, cdrom) + else: + # tell it to boot with cdrom + bootMachine(machine, cdrom) return machine def getList(): @@ -226,7 +230,7 @@ def commandResult(username, state, fields): machine = validation.Validate(username, state, machine_id=fields.getfirst('machine_id')).machine action = fields.getfirst('action') cdrom = fields.getfirst('cdrom') - if cdrom is not None and not CDROM.get(cdrom): + if cdrom is not None and not CDROM.query().filter_by(cdrom_id=cdrom).one(): raise CodeError("Invalid cdrom type '%s'" % cdrom) if action not in ('Reboot', 'Power on', 'Power off', 'Shutdown', 'Delete VM'):