import getafsgroups
import re
import string
-from sipb_xen_database import Machine, NIC
+from sipb_xen_database import Machine, NIC, Type
from webcommon import InvalidInput, g
MAX_MEMORY_TOTAL = 512
raise InvalidInput('disk', disk,
"Minimum %s GiB" % MIN_DISK_SINGLE)
return disk
-
+
+def validVmType(vm_type):
+ if vm_type == 'hvm':
+ return Type.get('linux-hvm')
+ elif vm_type == 'paravm':
+ return Type.get('linux')
+ else:
+ raise CodeError("Invalid vm type '%s'" % vm_type)
+
def testMachineId(user, machine_id, exists=True):
"""Parse, validate and check authorization for a given user and machine.