X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-web.git/blobdiff_plain/251a74f2ce55741ee63f8d5b6c732f5631912b79..d2b87d29c70394a4d15ab17ce8caee91f835acb9:/code/controls.py diff --git a/code/controls.py b/code/controls.py index 68e911c..d4afab0 100644 --- a/code/controls.py +++ b/code/controls.py @@ -11,7 +11,7 @@ import sys import time import re import cache_acls -import cPickle +import yaml # ... and stolen from xend/uuid.py def randomUUID(): @@ -119,7 +119,7 @@ def createVm(owner, contact, name, memory, disk_size, machine_type, cdrom, clone open_nics = NIC.select_by(machine_id=None) if not open_nics: #No IPs left! raise CodeError("No IP addresses left! " - "Contact sipb-xen@mit.edu.") + "Contact xvm@mit.edu.") nic = open_nics[0] nic.machine_id = machine.machine_id nic.hostname = name @@ -137,13 +137,11 @@ def createVm(owner, contact, name, memory, disk_size, machine_type, cdrom, clone bootMachine(machine, cdrom) return machine -def getList(machines): - """Return a dictionary mapping machine to dicts.""" - value_string = remctl('web', 'listvms', '--pickle') - value_dict = cPickle.loads(value_string) - - d = dict((m, value_dict[m.name]) for m in machines if m.name in value_dict) - return d +def getList(): + """Return a dictionary mapping machine names to dicts.""" + value_string = remctl('web', 'listvms') + value_dict = yaml.load(value_string, yaml.CSafeLoader) + return value_dict def parseStatus(s): """Parse a status string into nested tuples of strings.