Ignore:
Timestamp:
Apr 21, 2008, 7:14:17 PM (16 years ago)
Author:
ecprice
Message:

Cleaner HVM/paravm validation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-www/code/validation.py

    r431 r437  
    55import re
    66import string
    7 from sipb_xen_database import Machine, NIC
     7from sipb_xen_database import Machine, NIC, Type
    88from webcommon import InvalidInput, g
    99
     
    124124                           "Minimum %s GiB" % MIN_DISK_SINGLE)
    125125    return disk
    126            
     126
     127def validVmType(vm_type):
     128    if vm_type == 'hvm':
     129        return Type.get('linux-hvm')
     130    elif vm_type == 'paravm':
     131        return Type.get('linux')
     132    else:
     133        raise CodeError("Invalid vm type '%s'"  % vm_type)
     134
    127135def testMachineId(user, machine_id, exists=True):
    128136    """Parse, validate and check authorization for a given user and machine.
Note: See TracChangeset for help on using the changeset viewer.