summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Janczyk2010-04-01 21:35:54 +0200
committerMichael Janczyk2010-04-01 21:35:54 +0200
commit46fbdd6d0a6dd5896a2b798deb95aa61a089a355 (patch)
treedf83b52870688d683bcd054233a8a88a56ee8f6c
parentxen bridge change + xennet TODO: load xennet (diff)
downloadcore-46fbdd6d0a6dd5896a2b798deb95aa61a089a355.tar.gz
core-46fbdd6d0a6dd5896a2b798deb95aa61a089a355.tar.xz
core-46fbdd6d0a6dd5896a2b798deb95aa61a089a355.zip
xen nfs boot, xen boot
-rwxr-xr-xinitramfs/stage3-stuff/bin/hwautocfg4
-rw-r--r--os-plugins/plugins/qemukvm/files/run-virt.include43
-rw-r--r--os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm8
-rw-r--r--os-plugins/plugins/virtualbox/files/machine.include4
-rw-r--r--os-plugins/plugins/virtualbox/files/run-virt.include71
-rw-r--r--os-plugins/plugins/virtualbox/files/virtualbox.include2
-rw-r--r--os-plugins/plugins/vmgrid/files/run-vmgrid.sh24
-rw-r--r--os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm55
-rw-r--r--os-plugins/plugins/xen/XX_xen.sh48
-rw-r--r--os-plugins/plugins/xen/files/run-virt.include48
-rw-r--r--os-plugins/plugins/xen/init-hooks/10-have-nw-modules/xennet.sh4
11 files changed, 230 insertions, 81 deletions
diff --git a/initramfs/stage3-stuff/bin/hwautocfg b/initramfs/stage3-stuff/bin/hwautocfg
index 9cd0f8a4..fee54a16 100755
--- a/initramfs/stage3-stuff/bin/hwautocfg
+++ b/initramfs/stage3-stuff/bin/hwautocfg
@@ -29,7 +29,9 @@ echo "0 0 0 0" >/proc/sys/kernel/printk
echo "/sbin/mdev" >/proc/sys/kernel/hotplug
modprobe -a ${MODPRV} usbhid hid-bright 2>/dev/null &
nwcardlist=$(echo ${slxconf_listnwmod}|sed "s/\ /|/g")
-hwinfo --netcard --usb-ctrl | grep modprobe | grep -E "$nwcardlist|hcd" | \
+# save results for later info and for Xen plugin when starting Xen VM
+hwinfo --netcard --usb-ctrl >/etc/hwinfo.netcard-usbctrl
+grep modprobe /etc/hwinfo.netcard-usbctrl | grep -E "$nwcardlist|hcd" | \
grep -v ehci | sed 's/.* Cmd: "//;s/"//' | sort -u >/etc/modprobe.base
# virtio hack
if [ $(grep -ic "virtio_pci" /etc/modprobe.base) -ge 1 ]; then
diff --git a/os-plugins/plugins/qemukvm/files/run-virt.include b/os-plugins/plugins/qemukvm/files/run-virt.include
index 84e534e8..7db2bfc9 100644
--- a/os-plugins/plugins/qemukvm/files/run-virt.include
+++ b/os-plugins/plugins/qemukvm/files/run-virt.include
@@ -46,7 +46,7 @@ diskfile=${vmpath}
# check the file type
if echo ${imgname} | grep -iE "img|qcow|vmdk" >/dev/null 2>&1; then
- imgtype=$(echo ${imgname#*.} | tr [a-z] [A-Z])
+ imgtype=$(echo ${imgname##*.} | tr [a-z] [A-Z])
else
writelog "${imgname} is not a valid image type (img|qcow*|vmdk), exiting!"
exit 1
@@ -115,7 +115,7 @@ VIRTCMDOPTS="${VIRTCMDOPTS} -m ${mem}"
# network adaptor alternatives: rtl8139, pcnet, e1000
network_card=${network_card:=pcnet}
-VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,model=${network_card}"
+VIRTCMDOPTS="${VIRTCMDOPTS} -net nic,macaddr=${macaddr},model=${network_card}"
# define net kind and apply script
qemu_ifscripts="script=${PLUGINDIRQK}/ifup,downscript=${PLUGINDIRQK}/ifdown"
@@ -135,6 +135,25 @@ case "${network_kind}" in
;;
esac
+# translate boot, use if set else set to HardDisk
+if [ -n "${boot}" ]; then
+ case ${boot} in
+ n*) # usually support for a,c,d,n, stands for Floppy, HD, CD-ROM, Network
+ boot="n"
+ # TODO: does not work yet, can be removed if tap1 solution better
+ if [ "${network_kind}" = "user" ] && [ -n "${virtualbox_tftpdir}" ]; then
+ VIRTCMDOPTS="${VIRTCMDOPTS},tftp=${virtualbox_tftpdir}"
+ fi
+ ;;
+ # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
+ *)
+ boot="c"
+ ;;
+ esac
+else
+ boot="c"
+fi
+
# external GUI port
vncport="590${VM_ID}"
@@ -237,17 +256,15 @@ writelog "\tNetwork kind:\t\t${network_kind}"
#-show-cursor show cursor
# check for kvm modules
-if [ -n "${kvm}" ]; then
- if [ -e /dev/kvm ]; then
- for tool in kvm qemu-kvm; do
- VIRTCMD=$(which ${tool} 2>/dev/null)
- [ -n "$VIRTCMD" ] && break
- done
- else
- VIRTCMD=$(which qemu 2>/dev/null)
- writelog "KVM available but /dev/kvm not found!"
- writelog "Trying fallback to QEMU emulation."
- fi
+if [ -c /dev/kvm ]; then
+ for tool in kvm qemu-kvm; do
+ VIRTCMD=$(which ${tool} 2>/dev/null)
+ [ -n "$VIRTCMD" ] && break
+ done
+else
+ VIRTCMD=$(which qemu 2>/dev/null)
+ writelog "KVM available but /dev/kvm not found!"
+ writelog "Trying fallback to QEMU emulation."
fi
if [ -z "${VIRTCMD}" ]; then
diff --git a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
index 5d8206cd..f8fad1ba 100644
--- a/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
+++ b/os-plugins/plugins/virtualbox/OpenSLX/OSPlugin/virtualbox.pm
@@ -84,6 +84,8 @@ sub getAttrInfo
},
# attribute 'bridge' defines if bridged network mode should be
# switched on
+ # TODO: change to net -> nat, bridge, hostonly?
+ # TODO: since we use def in XML maybe use to override
'virtualbox::bridge' => {
applies_to_systems => 1,
applies_to_clients => 1,
@@ -139,7 +141,7 @@ sub installationPhase
{
my $self = shift;
my $info = shift;
-
+
$self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
$self->{pluginTempPath} = $info->{'plugin-temp-path'};
$self->{openslxBasePath} = $info->{'openslx-base-path'};
@@ -147,7 +149,7 @@ sub installationPhase
$self->{attrs} = $info->{'plugin-attrs'};
my $engine = $self->{'os-plugin-engine'};
-
+
# Different names of the tool (should be unified somehow!?)
if (!isInPath('VirtualBox')) {
# todo: fix this
@@ -170,7 +172,7 @@ sub installationPhase
foreach my $file ( qw( run-virt.include virtualbox.include machine.include
empty-diff.vdi.gz rwimg.vdi.gz ) ) {
copyFile("$pluginBasePath/$file", "$self->{pluginRepositoryPath}/");
- chmod 0755, "$self->{pluginRepositoryPath}/$file";
+ chmod 0644, "$self->{pluginRepositoryPath}/$file";
}
return;
diff --git a/os-plugins/plugins/virtualbox/files/machine.include b/os-plugins/plugins/virtualbox/files/machine.include
index 78c4bee8..a76c7e6f 100644
--- a/os-plugins/plugins/virtualbox/files/machine.include
+++ b/os-plugins/plugins/virtualbox/files/machine.include
@@ -2,7 +2,7 @@
cat << EOF > "${machconfig}"
<?xml version="1.0"?>
<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.9-linux">
- <Machine uuid="{${machineuuid}}" name="${vm_name}" OSType="${vmostype}"> <!-- stateFile="Snapshots/{1e5f5eb0-6b13-4407-9906-36114eca1e61}.sav" lastStateChange="2010-03-09T19:48:32Z"> -->
+ <Machine uuid="{${machineuuid}}" name="${vm_name}" OSType="${vmostype}">
<ExtraData>
<ExtraDataItem name="GUI/AutoresizeGuest" value="on"/>
<ExtraDataItem name="GUI/Fullscreen" value="on"/>
@@ -15,7 +15,7 @@ cat << EOF > "${machconfig}"
</ExtraData>
<Hardware version="2">
<CPU count="1">
- <HardwareVirtEx enabled="false" exclusive="true"/>
+ <HardwareVirtEx enabled="true" exclusive="true"/>
<HardwareVirtExNestedPaging enabled="false"/>
<HardwareVirtExVPID enabled="false"/>
<PAE enabled="true"/>
diff --git a/os-plugins/plugins/virtualbox/files/run-virt.include b/os-plugins/plugins/virtualbox/files/run-virt.include
index f904b5f2..abf1e0be 100644
--- a/os-plugins/plugins/virtualbox/files/run-virt.include
+++ b/os-plugins/plugins/virtualbox/files/run-virt.include
@@ -185,16 +185,21 @@ else
fi
# translate network cards
-if [ "${network_card}" = "e1000" ]; then
- vb_network_card="82540EM"
-else
- network_card="pcnet"
- vb_network_card="Am79C973"
-fi
+case "${network_card}" in
+ e1000)
+ vb_network_card="82540EM"
+ ;;
+ virtio)
+ vb_network_card="virtio"
+ ;;
+ *)
+ network_card="pcnet"
+ vb_network_card="Am79C973"
+esac
# translate network kinds (nat, bridged, host-only)
case "${network_kind}" in
- bridged)
+ bridge*)
network_kind='BridgedInterface name="br0"'
;;
hostonly|host-only)
@@ -204,6 +209,33 @@ case "${network_kind}" in
network_kind="NAT"
esac
+# translate boot, use if set else set to HardDisk
+# usually support for a,c,d,n, stands for Floppy, HD, CD-ROM, Network
+# support nfs and tftp as well
+if [ -n "${boot}" ]; then
+ case ${boot} in
+ n*|tftp)
+ boot="Network"
+ if [ "${network_kind}" = "NAT" ] && [ -n "${virtualbox_tftpdir}" ]; then
+ # remove spaces from VM name to avoid Problems /w TFTP in NAT
+ vm_name=$(echo ${vm_name} | sed -e "s, ,-,g")
+ # link TFTP dir for NAT TFTP boots
+ mkdir -p ${confdir}/TFTP
+ cp ${virtualbox_tftpdir}/pxelinux.0 ${confdir}/TFTP/${vm_name}.pxe
+ for i in $(ls ${virtualbox_tftpdir}); do
+ ln -sf ${virtualbox_tftpdir}/${i} ${confdir}/TFTP/${i}
+ done
+ fi
+ ;;
+ # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
+ *)
+ boot="HardDisk"
+ ;;
+ esac
+else
+ boot="HardDisk"
+fi
+
# external GUI
vrdpport="590${VM_ID}"
@@ -232,31 +264,6 @@ cdrom1=${cdtest:-"FALSE"}
ide="TRUE"
hddrv="ide"
-# translate boot, use if set else set to HardDisk
-if [ -n "${boot}" ]; then
- case ${boot} in
- n*) # usually support for a,c,d,n, stands for Floppy, HD, CD-ROM, Network
- boot="Network"
- if [ "${network_kind}" = "NAT" ] && [ -n "${virtualbox_tftpdir}" ]; then
- # remove spaces from VM name to avoid Problems /w TFTP in NAT
- vm_name=$(echo ${vm_name} | sed -e "s, ,-,g")
- # link TFTP dir for NAT TFTP boots
- mkdir -p ${confdir}/TFTP
- cp ${virtualbox_tftpdir}/pxelinux.0 ${confdir}/TFTP/${vm_name}.pxe
- for i in $(ls ${virtualbox_tftpdir}); do
- ln -sf ${virtualbox_tftpdir}/${i} ${confdir}/TFTP/${i}
- done
- fi
- ;;
- # later maybe c|disk|hd*|sd*) for HD and d|cd*) for CD-ROM
- *)
- boot="HardDisk"
- ;;
- esac
-else
- boot="HardDisk"
-fi
-
[ ${diskless} -eq 0 ] && writelog "\tSnapshots dir:\t\t$snapshotdir"
writelog "Diskimage:"
[ ${diskless} -eq 0 ] && writelog "\tDisk file:\t\t$diskfile"
diff --git a/os-plugins/plugins/virtualbox/files/virtualbox.include b/os-plugins/plugins/virtualbox/files/virtualbox.include
index 49b3ce61..09a2f33b 100644
--- a/os-plugins/plugins/virtualbox/files/virtualbox.include
+++ b/os-plugins/plugins/virtualbox/files/virtualbox.include
@@ -13,7 +13,7 @@ cat << EOF > "${confdir}/VirtualBox.xml"
<ExtraDataItem name="GUI/SuppressMessages" value=",remindAboutAutoCapture,confirmInputCapture,remindAboutWrongColorDepth,confirmGoingFullscreen,remindAboutMouseIntegrationOn,remindAboutMouseIntegrationOff,showRuntimeError.warning.DevATA_DISKFULL,remindAboutPausedVMInput,confirmVMReset"/>
<ExtraDataItem name="GUI/TrayIcon/Enabled" value="false"/>
<ExtraDataItem name="GUI/UpdateCheckCount" value="2"/>
- <ExtraDataItem name="GUI/UpdateDate" value="never"/> <!-- value="1 d, DATE, stable" -->
+ <ExtraDataItem name="GUI/UpdateDate" value="never"/>
</ExtraData>
<MachineRegistry>
<MachineEntry uuid="{${machineuuid}}" src="Machines/${vm_shortname}/${vm_shortname}.xml"/>
diff --git a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
index 4c5ecbb9..716371d5 100644
--- a/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
+++ b/os-plugins/plugins/vmgrid/files/run-vmgrid.sh
@@ -103,7 +103,13 @@ echo "Starting to log at $(date)" \
# test how many instances running
runningvms=$(ps aux | grep "run-vmgrid.sh " | grep -v grep | wc -l)
+# 2 steps, /w only one is seems not to work
runningvms=$(expr ${runningvms} - 1)
+# if Xen use different method
+if [ "${vmgrid_virt}" = "xen" ]; then
+ runningvms=$(xm list 2>/dev/null | grep -vE "Domain-0|Name.*ID" | wc -l)
+ runningvms=$(expr ${runningvms} + 1)
+fi
# check value
if [ $runningvms -le 0 ]; then
writelog "Error in value: Running VMs: ${runningvms}. Exit!"
@@ -189,7 +195,7 @@ elif [ "${boot}" = "n" ] && [ -z "${imgname}" ]; then
diskless=1
vmpath="{diskless boot}"
# imagename /w full path
-elif echo ${imgname} 2>/dev/null | grep -q '/' >/dev/null 2>&1; then
+elif echo ${imgname} 2>/dev/null | grep -q '^/' >/dev/null 2>&1; then
imgpath=$(dirname ${imgname})
imgname=$(basename ${imgname})
vmpath=${imgpath}/${imgname}
@@ -209,19 +215,12 @@ fi
# name of the virt machine, sed because of Windows formatting
vm_name=$(grep -o 'short_description param=.*"' ${xmlfile} \
| sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}')
+# if ${vm_name} not defined use ${xmlfile}
+vm_name=${vm_name:-${xmlfile%.xml}}
# define vm_shortname since vm_name can be very long
-if [ -n "${imgname}" ]; then
- # if ${vm_name} not defined use ${imgname}
- vm_name=${vm_name:-"${imgname%.*}"}
- vm_shortname=$(basename ${imgname%.*} | sed -e "s, ,-,g")
-elif [ -n "${vm_name}" ]; then
- vm_shortname=$(echo ${vm_name} | awk '{print $1"-"$2"-"$3}' \
- | sed -e "s,-$,,;s,-$,,")
-else
- vm_name=$(date | md5sum | awk '{print $1}')
- vm_shortname=${vm_name}
-fi
+vm_shortname=$(basename ${xmlfile%.xml} | sed -e "s, ,-,g")
+
# vm_name = displayname, define for old scripts
displayname=${vm_name}
@@ -376,6 +375,7 @@ else
exit 1
fi
+# remove config dirs when finished
if echo "${RMDIRS}" 2>/dev/null | grep -q ${vmgrid_virt}; then
writelog "${vmgrid_virt} exited. Cleanning up... \c"
rm -rf ${RMDIRS} >/dev/null 2>&1
diff --git a/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm b/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm
index 99993e23..8af752b4 100644
--- a/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm
+++ b/os-plugins/plugins/xen/OpenSLX/OSPlugin/xen.pm
@@ -62,9 +62,63 @@ sub getAttrInfo
# set active to 0, later set specially created Xen system to 1
default => '0',
},
+ # attribute 'imagesrc' defines where we can find xen images
+ 'xen::imagesrc' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Where do we store our xen images? NFS? Filesystem?
+ End-of-Here
+ content_regex => qr{^(/|nfs://)},
+ content_descr => 'local path or URI or "-" (unset)',
+ default => undef,
+ },
+ # attribute 'tftpdir' defines TFTP dir for network boots /w NAT
+ 'xen::tftpdir' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ Do you want to define a stage 4 TFTP dir for netwoork boots?
+ Needed to boot Xen via NFS, we only need the initramfs
+ Hint: Mount your TFTP ro via NFS to a local dir
+ End-of-Here
+ content_regex => qr{^(/)},
+ content_descr => 'local path or "-" (unset)',
+ default => undef,
+ },
};
}
+sub installationPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
+ $self->{openslxBasePath} = $info->{'openslx-base-path'};
+
+ # Copy run-virt.include and template files to the appropriate place for
+ # inclusion in stage4
+ my $pluginName = $self->{'name'};
+ my $pluginBasePath =
+ "$self->{openslxBasePath}/lib/plugins/$pluginName/files";
+
+ foreach my $file ( qw( run-virt.include machine.include hvm.include ) ) {
+ copyFile("$pluginBasePath/$file", "$self->{pluginRepositoryPath}/");
+ chmod 0644, "$self->{pluginRepositoryPath}/$file";
+ }
+
+ return;
+}
+
+sub removalPhase
+{
+ my $self = shift;
+ my $info = shift;
+
+ return;
+}
+
sub suggestAdditionalKernelModules
{
my $self = shift;
@@ -74,7 +128,6 @@ sub suggestAdditionalKernelModules
# Xen needs bridge module, for guests xennet and maybe xenblk
# earlier versions needed netloop
- # TODO: xennet laden
push @suggestedModules, qw( bridge xennet xenblk );
return @suggestedModules;
diff --git a/os-plugins/plugins/xen/XX_xen.sh b/os-plugins/plugins/xen/XX_xen.sh
index 610a3cfb..af3f6cc4 100644
--- a/os-plugins/plugins/xen/XX_xen.sh
+++ b/os-plugins/plugins/xen/XX_xen.sh
@@ -18,18 +18,56 @@
. /etc/openslx.conf
CONFFILE=/initramfs/plugin-conf/xen.conf
+PLUGINCONFDIR=/mnt/${OPENSLX_DEFAULT_CONFDIR}/plugins/xen
+PLUGINDIR=/mnt/${OPENSLX_DEFAULT_DIR}/plugin-repo/xen
+VIRTDIR=/mnt/${OPENSLX_DEFAULT_VIRTDIR}/xen
+# check if the configuration file is available
if [ -e ${CONFFILE} ]; then
+
+ # load needed variables
. ${CONFFILE}
- if [ $xen_active -ne 0 ]; then
+
+ # Test if this plugin is activated... more or less useless with the
+ # new plugin system
+ if [ $xen_active -ne 0 2>/dev/null ]; then
+
+ [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'xen' os-plugin ...";
+
+ # load general configuration
+ . /etc/initramfs-setup
+
+ # get source of xen image server (get type, server and path)
+ if strinstr "/" "${xen_imagesrc}" ; then
+ vbimgprot=$(uri_token ${xen_imagesrc} prot)
+ vbimgserv=$(uri_token ${xen_imagesrc} server)
+ vbimgpath="$(uri_token ${xen_imagesrc} path)"
+ fi
+ if [ -n "${vbimgserv}" ] ; then
+ # directory where qemu images are expected in
+ mnttarget=${VIRTDIR}
+ # mount the xen image source readonly (ro)
+ fsmount ${vbimgprot} ${vbimgserv} ${vbimgpath} ${mnttarget} ro
+ else
+ [ $DEBUGLEVEL -gt 1 ] && \
+ error " * Incomplete information in variable ${xen_imagesrc}." \
+ nonfatal
+ fi
+
+ # copy virtualization include files to config dir
+ testmkd ${PLUGINCONFDIR}
testmkd /mnt/var/log/xen
testmkd /mnt/var/run/xend
testmkd /mnt/var/run/xenstored
+ cp ${PLUGINDIR}/*.include ${PLUGINCONFDIR}
+ # copy ${CONFFILE} to ${PLUGINCONFDIR} just in case
+ cp ${CONFFILE} ${PLUGINCONFDIR}
-# TODO: disable for testing purposes. suse 11.0 kills network
-# rllinker "xendomains" 14 8
-# rllinker "xend" 13 9
+ # activate init files
# TODO: in xen-slx start
- modprobe loop max_loop=64
+ # increase loop devices for loop images
+ modprobe -q loop max_loop=64 >/tmp/xen.log 2>&1
+ rllinker "xendomains" 14 8
+ rllinker "xend" 13 9
fi
fi
diff --git a/os-plugins/plugins/xen/files/run-virt.include b/os-plugins/plugins/xen/files/run-virt.include
index aeadf68e..40cca17a 100644
--- a/os-plugins/plugins/xen/files/run-virt.include
+++ b/os-plugins/plugins/xen/files/run-virt.include
@@ -36,19 +36,19 @@ mkdir -m 1777 /tmp/${self} 2>/dev/null
# dir for configs
confdir="/tmp/${self}/${USER}/${VM_ID}"
# use vm_shortname for VM name since vm_name can be very long
-vm_name=${vm_shortname}
+# add id so we can start more tahn one of the same image
+vm_name="${vm_shortname}-${VM_ID}"
conffile=${confdir}/${vm_name}
# define dirs and files which can be removed after exit, be carefull!
-RMDIRS="${confdir}" 2>/dev/null
-rm -rf ${RMDIRS} 2>/dev/null
+rm -rf ${confdir} 2>/dev/null
+mkdir -p ${confdir} 2>/dev/null
# TODO: read from XML file
-xen_kernel=/boot/vmlinuz-xen
-xen_ramdisk=/initrd-xen
-xen_root=/dev/sda1
-xen_extra=3
-xen_disk="file:${vmpath},sda1,r"
-xen_vif="mac=$macaddr, bridge=xenbr0"
+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
writelog "Directories:"
@@ -99,8 +99,33 @@ else
fi
fi
+xen::tftpdir
+# 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} \
+ | awk -F " --- " '{print $2}' | awk '{print $1}')"
+ xen_ramdisk="${xen_tftpdir}/$(echo ${tftp_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
+
writelog "Diskimage:"
-writelog "\tMachine diskfile:\t\t$vmpath"
+writelog "\tMachine diskfile:\t$vmpath"
writelog "Virtual Hardware:"
writelog "\tGuest RAM:\t\t${mem} MB"
# echo nur wenn memhost gesetzt
@@ -119,7 +144,8 @@ writelog "\tMAC address:\t\t$macaddr"
# set the variables appropriately (several interfaces with different names)
VIRTCMD=$(which xm 2>/dev/null)
-VIRTCMDOPTS="create ${conffile}"
+# '-c' for console, no graphical output available, later vnc possible
+VIRTCMDOPTS="create -c ${conffile}"
# set headless mode
VIRTCMDHL=$(which xm 2>/dev/null)
diff --git a/os-plugins/plugins/xen/init-hooks/10-have-nw-modules/xennet.sh b/os-plugins/plugins/xen/init-hooks/10-have-nw-modules/xennet.sh
new file mode 100644
index 00000000..d514b68d
--- /dev/null
+++ b/os-plugins/plugins/xen/init-hooks/10-have-nw-modules/xennet.sh
@@ -0,0 +1,4 @@
+# load xennet if necessary, usualy within a NFS VM
+if grep -q "Xen Virtual Ethernet Card" /etc/hwinfo.netcard-usbctrl; then
+ modprobe xennet >/tmp/xennet.log 2>&1
+fi