diff options
| author | Simon Rettberg | 2013-11-28 11:51:19 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2013-11-28 11:51:19 +0100 |
| commit | fdf5fe0fc823565634fb4cc64ce77ec0b2bcc597 (patch) | |
| tree | 21c1ec3990ac1e00536b41889088cc8a05bfd6af | |
| parent | <blacklist stage4> exclude /etc/update-motd.d/ (diff) | |
| parent | [vmware] Add slxlog to run-virt.include (diff) | |
| download | tm-scripts-fdf5fe0fc823565634fb4cc64ce77ec0b2bcc597.tar.gz tm-scripts-fdf5fe0fc823565634fb4cc64ce77ec0b2bcc597.tar.xz tm-scripts-fdf5fe0fc823565634fb4cc64ce77ec0b2bcc597.zip | |
Merge branch 'master' of dnbd3:openslx-ng/tm-scripts
| -rwxr-xr-x | remote/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env | 91 | ||||
| -rw-r--r-- | remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include | 16 |
2 files changed, 58 insertions, 49 deletions
diff --git a/remote/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env b/remote/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env index 5f26eadd..dc60e3d5 100755 --- a/remote/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env +++ b/remote/modules/vmware/data/opt/openslx/scripts/systemd-vmware_env @@ -22,7 +22,7 @@ done #source config file . "/opt/openslx/config" -. "${VMWARE_CONF_DIR}/vmware.conf" +. "${VMWARE_CONF_DIR}/vmware.conf" || slxlog "vmware-conf" "Could not source '${VMWARE_CONF_DIR}/vmware.conf' in $0" "${VMWARE_CONF_DIR}/vmware.conf" vm_dhcpd() { @@ -145,20 +145,22 @@ setup_network() { # they are not created automatically via module load for i in "/dev/vmnet0 c 119 0" "/dev/vmnet1 c 119 1" \ "/dev/vmnet8 c 119 8" "/dev/vmmon c 10 165"; do - mknod "$i" + mknod $i # no "" done chmod 0700 /dev/vmnet* } -load_modules () { +load_modules () { + local FAILED="" # VMplayer common stuff - insmod /lib/modules/vmware/vmmon.ko - insmod /lib/modules/vmware/vmnet.ko + insmod /lib/modules/vmware/vmmon.ko || FAILED="$FAILED vmmon" + insmod /lib/modules/vmware/vmnet.ko || FAILED="$FAILED vmnet" # VMplayer 3.X specific stuff - insmod /lib/modules/vmware/vmci.ko - insmod /lib/modules/vmware/vmblock.ko - insmod /lib/modules/vmware/vsock.ko + insmod /lib/modules/vmware/vmci.ko || FAILED="$FAILED vmci" + insmod /lib/modules/vmware/vmblock.ko || FAILED="$FAILED vmblock" + insmod /lib/modules/vmware/vsock.ko || FAILED="$FAILED vsock" + [ -n "$FAILED" ] && slxlog "vmware-insmod" "Error loading vmware kernel module(s) $FAILED" } unload_modules () { @@ -166,44 +168,47 @@ unload_modules () { } vmnetif () { -# let point the path directly to the directory where the binary lives -location="/usr/bin" -if [ -n "$vmnet0" ] ; then - # the path might be directly point to the plugin dir - $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid -n 0 -fi -if [ -n "$vmnet1" ] ; then - $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid \ - /dev/vmnet1 vmnet1 - ip addr add $vmnet1 dev vmnet1 - ip link set vmnet1 up - if [ -n "$vmnet1nat" ] ; then - echo "1" >/proc/sys/net/ipv4/conf/vmnet1/forwarding - echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null - fi - /opt/openslx/usr/sbin/udhcpd \ - -S /etc/vmware/udhcpd/udhcpd-vmnet1.conf -fi -if [ -n "$vmnet8" ] ; then - $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet8.pid \ - /dev/vmnet8 vmnet8 - ip addr add $vmnet8 dev vmnet8 - ip link set vmnet8 up - echo "1" >/proc/sys/net/ipv4/conf/vmnet8/forwarding - echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null - iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE - # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 - $location/vmnet-natd -d /var/run/vmnet-natd-8.pid \ - -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf # or logfile - /opt/openslx/usr/sbin/udhcpd \ - -S /etc/vmware/udhcpd/udhcpd-vmnet8.conf -fi - + # let point the path directly to the directory where the binary lives + location="/usr/bin" + if [ -n "$vmnet0" ] ; then + # the path might be directly point to the plugin dir + if ! $location/vmnet-bridge -d /var/run/vmnet-bridge-0.pid -n 0; then + slxlog "vmware-bridge" "Launching $location/vmnet-bridge failed." + fi + fi + if [ -n "$vmnet1" ] ; then + if ! $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet1.pid /dev/vmnet1 vmnet1; then + slxlog "vmware-netifup" "Launching $location/vmnet-netifup for vmnet1 failed." + fi + ip addr add $vmnet1 dev vmnet1 + ip link set vmnet1 up + if [ -n "$vmnet1nat" ] ; then + echo "1" >/proc/sys/net/ipv4/conf/vmnet1/forwarding + echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null + fi + /opt/openslx/usr/sbin/udhcpd -S /etc/vmware/udhcpd/udhcpd-vmnet1.conf + fi + if [ -n "$vmnet8" ] ; then + if ! $location/vmnet-netifup -d /var/run/vmnet-netifup-vmnet8.pid /dev/vmnet8 vmnet8; then + slxlog "vmware-netifup" "Launching $location/vmnet-netifup for vmnet8 failed." + fi + ip addr add $vmnet8 dev vmnet8 + ip link set vmnet8 up + echo "1" >/proc/sys/net/ipv4/conf/vmnet8/forwarding + echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null + iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE + # /etc/vmware/vmnet-natd-8.mac simply contains a mac like 00:50:56:F1:30:50 + if ! $location/vmnet-natd -d /var/run/vmnet-natd-8.pid -m /etc/vmware/vmnet-natd-8.mac -c /etc/vmware/nat.conf; then + slxlog "vmware-natd" "Launching $location/vmnet-natd for vmnet8 failed." + fi + /opt/openslx/usr/sbin/udhcpd -S /etc/vmware/udhcpd/udhcpd-vmnet8.conf + fi } vmblock () { -# let point the path directly to the directory where the binary lives - /usr/bin/vmware-usbarbitrator + if ! /usr/bin/vmware-usbarbitrator; then + slxlog "vmware-usbarb" "Launching /usr/bin/vmware-usbarbitrator failed." + fi } diff --git a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include index 2e7aeaf5..2de41d77 100644 --- a/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include +++ b/remote/modules/vmware/data/opt/openslx/vmchooser/vmware/run-virt.include @@ -543,6 +543,9 @@ case "${hddrv}" in ide="FALSE" scsi="TRUE" ;; + *) + slxlog "virt-vmware-hdd" "vmware: Unknown HDD adapter type $hddrv" + ;; esac # write configuration files @@ -564,12 +567,13 @@ runvmwareconfheader ln -s "$conffile" "$redodir/run-vmware.conf" >/dev/null 2>&1 # sync is needed to ensure that data is really written to virtual disk +# TODO: Move to general run-virt, right before exec of vm sync # own nvram. We need it for floppy drive b, default nvram has just drive a -# TODO: optimize, currently kinda inefficient, too much copys, but we -# don't know which one is installed... -cp "/opt/openslx/vmchooser/vmware/nvram" "$confdir/nvram" 2>/dev/null +if ! cp "/opt/openslx/vmchooser/vmware/nvram" "$confdir/nvram"; then + slxlog "virt-vmware-nvram" "Could not copy nvram from '/opt/openslx/vmchooser/vmware/nvram' '$confdir/nvram'" +fi # logging and stdout @@ -588,11 +592,10 @@ writelog "\tConfdir:\t${confdir}" writelog "\tConffile:\t${conffile}" writelog "\tRedodir:\t${redodir}" writelog "\tVMhome:\t\t${vmhome}" -writelog "\t/tmp info: \ -$(grep "/tmp " /proc/mounts) $(df -h | grep " /tmp$" | awk '{print $2}')" +writelog "\t/tmp info: $(grep "/tmp " /proc/mounts) $(df -h | grep " /tmp$" | awk '{print $2}')" # hw setup writelog "Hardware:" -writelog "\tMAC:\t\t00:50:56:${VM_ID}:${machostpart}" +writelog "\tMAC:\t\t00:50:56:$macaddrsuffix" # TODO: Make var at top for this, it's hard coded twice if [ -n "${network_card}" ]; then writelog "\tNet Adaptor:\t${network_card}" fi @@ -642,3 +645,4 @@ cp "$conffile" "/tmp/vmware-last-config" VIRTCMD="/opt/openslx/bin/vmplayer" VIRTCMDOPTS="${vmopt} ${conffile}" RMDIRS="${redodir} ${conffile}" + |
