source: trunk/packages/sipb-xen-database/sipb-xen-database/client/etc/xen/sipb-database @ 99

Last change on this file since 99 was 99, checked in by nelhage, 17 years ago

v5, change the host to sipb-xen-dev

File size: 1.3 KB
Line 
1import sipb_xen_database.models as models
2from sipb_xen_database import connect
3
4connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen')
5# `machine_name' should get passed in from the xm create call
6
7machine = models.Machine.get_by(name=machine_name)
8machine_type = models.Type.get_by(type_id=machine.type_id)
9
10memory = machine.memory
11maxmem = memory
12name = machine.name
13uuid = machine.uuid
14
15vcpus = machine.cpus
16
17diskioemu = ""
18viftype = ""
19
20if machine_type.hvm:
21    ioemu = "ioemu:"
22    viftype = "type=ioemu"
23
24    kernel = 'hvmloader'
25    builder = 'hvm'
26    vnc = 1
27    device_model = 'qemu-dm'
28else:
29    kernel  = '/boot/vmlinuz-2.6.18-4-xen-amd64'
30    ramdisk = '/boot/initrd.img-2.6.18-4-xen-amd64'
31    builder = 'linux'
32
33pae = machine_type.pae
34acpi = machine_type.acpi
35apic = machine_type.apic
36
37vif = []
38
39for n in machine.nics:
40    d = '%s, mac=%s, ip=%s, bridge=xenbr0, script=vif-sipbroute' % (viftype, n.mac_addr, n.ip)
41    vif.append(d)
42
43disk = []
44
45for 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)
48    disk.append(dspec)
49
50restart = 'destroy'
51if machine.autorestart:
52    restart = 'restart'
53
54on_poweroff = 'destroy'
55on_reboot = 'restart'
56on_crash = restart
Note: See TracBrowser for help on using the repository browser.