Last change
on this file since 65 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
|
Rev | Line | |
---|
[24] | 1 | import sipb_xen_database.models as models |
---|
| 2 | |
---|
| 3 | # `name' gets passed in from the xm create call |
---|
| 4 | |
---|
| 5 | machine = models.Machine.get_by(name=name) |
---|
[65] | 6 | machine_type = models.Type.get_by(type_id=machine.type_id) |
---|
[24] | 7 | |
---|
| 8 | memory = machine.memory |
---|
| 9 | maxmem = memory |
---|
| 10 | name = machine.name |
---|
| 11 | uuid = machine.uuid |
---|
| 12 | |
---|
| 13 | vcpus = machine.cpus |
---|
| 14 | |
---|
[65] | 15 | diskioemu = "" |
---|
| 16 | viftype = "" |
---|
[24] | 17 | |
---|
[65] | 18 | if 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' |
---|
| 26 | else: |
---|
| 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 | |
---|
| 31 | pae = machine_type.pae |
---|
| 32 | acpi = machine_type.acpi |
---|
| 33 | apic = machine_type.apic |
---|
| 34 | |
---|
| 35 | vif = [] |
---|
| 36 | |
---|
| 37 | for n in machine.nics: |
---|
| 38 | d = '%s, mac=%s, ip=%s, bridge=xenbr0' % (viftype, n.mac_addr, n.ip) |
---|
| 39 | vif.append(disk) |
---|
| 40 | |
---|
[24] | 41 | disk = [] |
---|
| 42 | |
---|
| 43 | for d in machine.disks: |
---|
[65] | 44 | device = 'xenvg/' + machine.name + '_' + d.guest_device_name |
---|
| 45 | dspec = 'phy:%s,%s%s,w' % (device, diskioemu, d.guest_device_name) |
---|
[24] | 46 | disk.append(dspec) |
---|
| 47 | |
---|
| 48 | restart = 'destroy' |
---|
| 49 | if machine.autorestart: |
---|
| 50 | restart = 'restart' |
---|
| 51 | |
---|
| 52 | on_poweroff = 'destroy' |
---|
| 53 | on_reboot = 'restart' |
---|
| 54 | on_crash = restart |
---|
Note: See
TracBrowser
for help on using the repository browser.