# `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
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'