Filling in the gaps in conf.py. This is completely untested.
authorNelson Elhage <nelhage@mit.edu>
Wed, 8 Aug 2007 03:08:38 +0000 (23:08 -0400)
committerNelson Elhage <nelhage@mit.edu>
Wed, 8 Aug 2007 03:08:38 +0000 (23:08 -0400)
svn path=/trunk/packages/sipb-xen-database/sipb-xen-database/; revision=65

conf.py

diff --git a/conf.py b/conf.py
index c7656b6..174fb6b 100644 (file)
--- a/conf.py
+++ b/conf.py
@@ -3,7 +3,7 @@ import sipb_xen_database.models as models
 # `name' gets passed in from the xm create call
 
 machine = models.Machine.get_by(name=name)
-
+machine_type = models.Type.get_by(type_id=machine.type_id)
 
 memory = machine.memory
 maxmem = memory
@@ -12,12 +12,37 @@ uuid = machine.uuid
 
 vcpus = machine.cpus
 
-# XXX TODO deal with vifs
+diskioemu = ""
+viftype = ""
+
+if machine_type.hvm:
+    ioemu = "ioemu:"
+    viftype = "type=ioemu"
+
+    kernel = 'hvmloader'
+    builder = 'hvm'
+    vnc = 1
+    device_model = 'qemu-dm'
+else:
+    kernel  = '/boot/vmlinuz-2.6.18-4-xen-amd64'
+    ramdisk = '/boot/initrd.img-2.6.18-4-xen-amd64'
+    builder = 'linux'
+
+pae = machine_type.pae
+acpi = machine_type.acpi
+apic = machine_type.apic
+
+vif = []
+
+for n in machine.nics:
+    d = '%s, mac=%s, ip=%s, bridge=xenbr0' % (viftype, n.mac_addr, n.ip)
+    vif.append(disk)
 
 disk = []
 
 for d in machine.disks:
-    dspec = 'phy:xenvg/%s,%s,w' % (???, d.guest_device_name)
+    device = 'xenvg/' + machine.name + '_' + d.guest_device_name
+    dspec = 'phy:%s,%s%s,w' % (device, diskioemu, d.guest_device_name)
     disk.append(dspec)
 
 restart = 'destroy'