1 import sipb_xen_database.models as models
2 from sipb_xen_database import connect
4 connect('postgres://sipb-xen@sipb-vm-1/sipb_xen')
5 # `machine_name' should get passed in from the xm create call
7 machine = models.Machine.get_by(name=machine_name)
8 machine_type = models.Type.get_by(type_id=machine.type_id)
10 memory = machine.memory
22 viftype = "type=ioemu"
27 device_model = 'qemu-dm'
29 kernel = '/boot/vmlinuz-2.6.18-4-xen-amd64'
30 ramdisk = '/boot/initrd.img-2.6.18-4-xen-amd64'
33 pae = machine_type.pae
34 acpi = machine_type.acpi
35 apic = machine_type.apic
39 for n in machine.nics:
40 d = '%s, mac=%s, ip=%s, bridge=xenbr0, script=vif-sipbroute' % (viftype, n.mac_addr, n.ip)
45 for d in machine.disks:
46 device = 'xenvg/' + machine.name + '_' + d.guest_device_name
47 dspec = 'phy:%s,%s%s,w' % (device, diskioemu, d.guest_device_name)
51 if machine.autorestart:
54 on_poweroff = 'destroy'