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, "
29 device_model = '/usr/sbin/qemu-dm-sipb'
31 kernel = '/boot/vmlinuz-2.6.18-4-xen-amd64'
32 ramdisk = '/boot/initrd.img-2.6.18-4-xen-amd64'
35 pae = machine_type.pae
36 acpi = machine_type.acpi
37 apic = machine_type.apic
41 for n in machine.nics:
42 d = '%smac=%s, ip=%s, bridge=xenbr0, script=vif-sipbroute' % (viftype, n.mac_addr, n.ip)
47 for d in machine.disks:
48 device = '/dev/xenvg/' + machine.name + '_' + d.guest_device_name
49 dspec = 'phy:%s,%s%s,w' % (device, diskioemu, d.guest_device_name)
53 if machine.autorestart:
56 on_poweroff = 'destroy'