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 | |
---|
1 | import sipb_xen_database.models as models |
---|
2 | from sipb_xen_database import connect |
---|
3 | |
---|
4 | connect('postgres://sipb-xen@sipb-xen-dev.mit.edu/sipb_xen') |
---|
5 | # `machine_name' should get passed in from the xm create call |
---|
6 | |
---|
7 | machine = models.Machine.get_by(name=machine_name) |
---|
8 | machine_type = models.Type.get_by(type_id=machine.type_id) |
---|
9 | |
---|
10 | memory = machine.memory |
---|
11 | maxmem = memory |
---|
12 | name = machine.name |
---|
13 | uuid = machine.uuid |
---|
14 | |
---|
15 | vcpus = machine.cpus |
---|
16 | |
---|
17 | diskioemu = "" |
---|
18 | viftype = "" |
---|
19 | |
---|
20 | if 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' |
---|
28 | else: |
---|
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 | |
---|
33 | pae = machine_type.pae |
---|
34 | acpi = machine_type.acpi |
---|
35 | apic = machine_type.apic |
---|
36 | |
---|
37 | vif = [] |
---|
38 | |
---|
39 | for 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 | |
---|
43 | disk = [] |
---|
44 | |
---|
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) |
---|
48 | disk.append(dspec) |
---|
49 | |
---|
50 | restart = 'destroy' |
---|
51 | if machine.autorestart: |
---|
52 | restart = 'restart' |
---|
53 | |
---|
54 | on_poweroff = 'destroy' |
---|
55 | on_reboot = 'restart' |
---|
56 | on_crash = restart |
---|
Note: See
TracBrowser
for help on using the repository browser.