id of the CD (e.g. 'gutsy_i386')
"""
if cdtype is not None:
- remctl('web', 'vmboot', machine.name,
+ remctl('control', machine.name, 'create',
cdtype)
else:
- remctl('web', 'vmboot', machine.name)
+ remctl('control', machine.name, 'create')
def registerMachine(machine):
"""Register a machine to be controlled by the web interface"""
Gets and parses xm list --long
"""
- value_string, err_string = remctl('list-long', machine.name, err=True)
+ value_string, err_string = remctl('control', machine.name, 'list-long', err=True)
if 'Unknown command' in err_string:
raise CodeError("ERROR in remctl list-long %s is not registered" % (machine.name,))
elif 'does not exist' in err_string:
def deleteVM(machine):
"""Delete a VM."""
- remctl('destroy', machine.name, err=True)
+ remctl('control', machine.name, 'destroy', err=True)
transaction = ctx.current.create_transaction()
delete_disk_pairs = [(machine.name, d.guest_device_name) for d in machine.disks]
try:
raise CodeError("Invalid action '%s'" % action)
if action == 'Reboot':
if cdrom is not None:
- remctl('reboot', machine.name, cdrom)
+ remctl('control', machine.name, 'reboot', cdrom)
else:
- remctl('reboot', machine.name)
+ remctl('control', machine.name, 'reboot')
elif action == 'Power on':
if maxMemory(user) < machine.memory:
raise InvalidInput('action', 'Power on',
"You don't have enough free RAM quota to turn on this machine")
bootMachine(machine, cdrom)
elif action == 'Power off':
- remctl('destroy', machine.name)
+ remctl('control', machine.name, 'destroy')
elif action == 'Shutdown':
- remctl('shutdown', machine.name)
+ remctl('control', machine.name, 'shutdown')
elif action == 'Delete VM':
deleteVM(machine)
print >> sys.stderr, time.time()-start_time