+if machine_type.hvm:
+ codepath = 'hvm'
+else:
+ codepath = 'paravm'
+
+if 'mirror' in locals(): #Installer
+ disk.append('phy:/dev/xenvg/s_install_hda,hdb,r')
+
+ kernel = '/boot/vmlinuz-2.6.24-19-xen' #From hardy
+ ramdisk = '/boot/initrd.img-2.6.24-19-xen'
+
+ if not machine.nics:
+ raise RuntimeError('You must have a nic to autoinstall')
+ n = machine.nics[0]
+ extra = 'ro noresume'
+ extra += (' ip=%s::%s:%s:%s:eth0:off'
+ % (n.ip, config.dhcp.gateway, config.dhcp.netmask, machine.name))
+ extra += ' mirror=%s dist=%s' % (mirror, dist)
+ extra += ' imagesize=%s' % imagesize
+ if 'noinstall' in locals():
+ extra += ' noinstall'
+ root = '/dev/hdb1'
+ codepath = None
+elif cdrom is not None:
+ disk.append('phy:/etc/xenvg/image_' + cdrom.cdrom_id + ',hdc:cdrom,r')
+ boot = 'd'
+ codepath = 'hvm'
+
+if codepath == 'hvm':
+ ioemu = "ioemu:"
+ viftype = "type=ioemu, "
+ kernel = '/usr/lib/xen/boot/hvmloader'
+ builder = 'hvm'
+ vnc = 1
+ vncpasswd = 'moocow'
+ device_model = '/usr/sbin/qemu-dm-sipb'
+ serial = "pty"
+elif codepath == 'paravm':
+ bootloader = '/usr/lib/xen-default/bin/pygrub'
+
+
+for n in machine.nics:
+ check(re.match('^[0-9a-fA-F:]+$', n.mac_addr) and re.match('^[0-9.]*$', n.ip))
+ d = '%smac=%s, ip=%s, bridge=xenbr0, script=vif-sipbroute' % (viftype, n.mac_addr, n.ip)
+ vif.append(d)
+