X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/2cd57935fb39398e28281b9e8a6714453d430376..b330d95bd2b2f5fe7724d470856e58ebe75df1ab:/code/controls.py diff --git a/code/controls.py b/code/controls.py index 0acca3a..0889d4c 100644 --- a/code/controls.py +++ b/code/controls.py @@ -94,7 +94,7 @@ def bootMachine(machine, cdtype): raise CodeError('"%s" on "control %s create %s' % (err, machine.name, cdtype)) -def createVm(username, state, owner, contact, name, description, memory, disksize, machine_type, nic_type, cdrom, autoinstall): +def createVm(username, state, owner, contact, name, description, memory, disksize, machine_type, cdrom, autoinstall): """Create a VM and put it in the database""" # put stuff in the table session.begin() @@ -119,7 +119,6 @@ def createVm(username, state, owner, contact, name, description, memory, disksiz "Contact %s." % config.contact) nic.machine = machine nic.hostname = name - nic.nic_type = nic_type session.add(nic) session.add(disk) cache_acls.refreshMachine(machine) @@ -224,6 +223,7 @@ def deleteVM(machine): def commandResult(username, state, command_name, machine_id, fields): start_time = 0 + result = None machine = validation.Validate(username, state, machine_id=machine_id).machine action = command_name cdrom = fields.get('cdrom') or None @@ -275,10 +275,14 @@ def commandResult(username, state, command_name, machine_id, fields): raise CodeError('ERROR on remctl') elif action == 'delete': deleteVM(machine) + elif action == 'renumber': + result = remctl('control', machine.name, 'renumber') d = dict(user=username, command=action, machine=machine) + if result: + d['result'] = result return d def resizeDisk(machine_name, disk_name, new_size):