source: trunk/packages/sipb-xen-database/sipb-xen-database/conf.py @ 70

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

Filling in the gaps in conf.py. This is completely untested.

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