1 # -*- mode: python; -*-
2 import sipb_xen_database.models as models
3 from sipb_xen_database import connect
5 connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
6 # `machine_name' should get passed in from the xm create call
8 machine = models.Machine.get_by(name=machine_name)
9 machine_type = models.Type.get_by(type_id=machine.type_id)
11 memory = machine.memory
23 viftype = "type=ioemu, "
28 device_model = 'qemu-dm'
30 kernel = '/boot/vmlinuz-2.6.18-4-xen-amd64'
31 ramdisk = '/boot/initrd.img-2.6.18-4-xen-amd64'
34 pae = machine_type.pae
35 acpi = machine_type.acpi
36 apic = machine_type.apic
40 for n in machine.nics:
41 d = '%smac=%s, ip=%s, bridge=xenbr0, script=vif-sipbroute' % (viftype, n.mac_addr, n.ip)
46 for d in machine.disks:
47 device = 'xenvg/' + machine.name + '_' + d.guest_device_name
48 dspec = 'phy:%s,%s%s,w' % (device, diskioemu, d.guest_device_name)
52 if machine.autorestart:
55 on_poweroff = 'destroy'