Changeset 629 for trunk/packages/sipb-xen-www/code/controls.py
- Timestamp:
- Jun 21, 2008, 9:23:59 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-www/code/controls.py
r626 r629 70 70 lvcreate(machine, disk) 71 71 72 def getswap(disksize, memsize): 73 """Returns the recommended swap partition size.""" 74 return int(min(disksize / 4, memsize * 1.5)) 75 76 def lvinstall(machine, autoinstall): 77 disksize = machine.disks[0].size 78 memsize = machine.memory 79 imagesize = disksize - getswap(disksize, memsize) 80 ip = machine.nics[0].ip 81 remctl('web', 'install', machine.name, autoinstall.distribution, 82 autoinstall.mirror, str(imagesize), ip) 83 72 84 def lvcopy(machine_orig_name, machine, rootpw): 73 85 """Copy a golden image onto a machine's disk""" … … 93 105 % (err, machine.name, cdtype)) 94 106 95 def createVm(username, state, owner, contact, name, description, memory, disksize, machine_type, cdrom, clone_from):107 def createVm(username, state, owner, contact, name, description, memory, disksize, machine_type, cdrom, autoinstall): 96 108 """Create a VM and put it in the database""" 97 109 # put stuff in the table … … 131 143 raise 132 144 makeDisks(machine) 133 if clone_from:134 lv copy(clone_from, machine, 'password')145 if autoinstall: 146 lvinstall(machine, autoinstall) 135 147 # tell it to boot with cdrom 136 148 bootMachine(machine, cdrom)
Note: See TracChangeset
for help on using the changeset viewer.