diff options
author | Michael Janczyk | 2010-04-02 20:50:29 +0200 |
---|---|---|
committer | Michael Janczyk | 2010-04-02 20:50:29 +0200 |
commit | 5dd09617cd77f2a616c770152c4cd8319803a05f (patch) | |
tree | 09f9a8d21be95907c0ce8cebeb2d47456a291778 /os-plugins/plugins/xen/files | |
parent | xen nfs boot, xen boot (diff) | |
download | core-5dd09617cd77f2a616c770152c4cd8319803a05f.tar.gz core-5dd09617cd77f2a616c770152c4cd8319803a05f.tar.xz core-5dd09617cd77f2a616c770152c4cd8319803a05f.zip |
qemu tap coniguration hell
Diffstat (limited to 'os-plugins/plugins/xen/files')
-rw-r--r-- | os-plugins/plugins/xen/files/machine.include | 2 | ||||
-rw-r--r-- | os-plugins/plugins/xen/files/run-virt.include | 59 |
2 files changed, 33 insertions, 28 deletions
diff --git a/os-plugins/plugins/xen/files/machine.include b/os-plugins/plugins/xen/files/machine.include index a1573578..06848949 100644 --- a/os-plugins/plugins/xen/files/machine.include +++ b/os-plugins/plugins/xen/files/machine.include @@ -58,7 +58,7 @@ vif = [ '${xen_vif}' ] # where UNAME is the device, DEV is the device name the domain will see, # and MODE is r for read-only, w for read-write. # disk = [ 'phy:hda1,hda1,w' ] -disk = [ '${xen_disk}' ] +${xen_disk} #---------------------------------------------------------------------------- # Define frame buffer device. diff --git a/os-plugins/plugins/xen/files/run-virt.include b/os-plugins/plugins/xen/files/run-virt.include index 40cca17a..43213e34 100644 --- a/os-plugins/plugins/xen/files/run-virt.include +++ b/os-plugins/plugins/xen/files/run-virt.include @@ -43,13 +43,10 @@ conffile=${confdir}/${vm_name} rm -rf ${confdir} 2>/dev/null mkdir -p ${confdir} 2>/dev/null -# TODO: read from XML file xen_kernel=${kernel:-"/boot/vmlinuz-xen"} xen_ramdisk=${initramfs:-"/boot/initrd-xen"} xen_extra="xencons=tty 3" -xen_disk="file:${vmpath},hda1,r" -xen_vif="mac=$macaddr, bridge=br0" -xen_dhcp="dhcp" # off +[ -n "${imgname}" ] && xen_disk="disk = [ 'file:${vmpath},hda1,r' ]" writelog "Directories:" writelog "\tConfig dir:\t\t$confdir" @@ -99,33 +96,41 @@ else fi fi -xen::tftpdir +# translate network kinds (nat, bridged, host-only) +case "${network_kind}" in + bridge*) + xen_vif="mac=$macaddr, bridge=br0" + ;; + *) + xen_vif="mac=$macaddr" +esac +xen_dhcp="dhcp" # off + # translate boot, use if set else set to disk -if [ -n "${boot}" ]; then - case ${boot} in - n*|tftp) - if [ -n "${imgname}" ] && [ -n "${xen_tftpdir}" ]; then - root=/dev/nfs - tftp_label=$(grep -A 3 "^LABEL *${imgname}" \ - ${xen_tftpdir}/pxelinux.cfg/default 2>/dev/null \ - | grep "^ *KERNEL ") - xen_kernel="${xen_tftpdir}/$(echo ${tftp_label} \ +xen_root=/dev/hda1 +case ${boot} in + n*|tftp) + pxe_label=$(grep -o 'pxe_label param=.*"' ${xmlfile} \ + | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}') + pxe_label=$(grep -A 3 "^LABEL *${pxe_label}" \ + ${xen_tftpdir}/pxelinux.cfg/default 2>/dev/null \ + | grep "^ *KERNEL ") + if [ -n "${pxe_label}" ] && [ -n "${xen_tftpdir}" ]; then + xen_root=/dev/nfs + xen_kernel="${xen_tftpdir}/$(echo ${pxe_label} \ | awk -F " --- " '{print $2}' | awk '{print $1}')" - xen_ramdisk="${xen_tftpdir}/$(echo ${tftp_label} \ + xen_ramdisk="${xen_tftpdir}/$(echo ${pxe_label} \ | awk -F " --- " '{print $3}')" - fi - ;; - # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM - *) - xen_root=/dev/hda1 - ;; - esac -else - xen_root=/dev/hda1 -fi + fi + ;; + # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM + *) + xen_root=/dev/hda1 + ;; +esac -writelog "Diskimage:" -writelog "\tMachine diskfile:\t$vmpath" +[ ${diskless} -eq 0 ] && writelog "Diskimage:" +[ ${diskless} -eq 0 ] && writelog "\tMachine diskfile:\t$vmpath" writelog "Virtual Hardware:" writelog "\tGuest RAM:\t\t${mem} MB" # echo nur wenn memhost gesetzt |