From a2188dbd9864cf4def14741866a48a4dfc0e2357 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 27 Nov 2013 17:29:34 +0100 Subject: [dnbd3] Add slxlog --- .../modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'remote/modules') diff --git a/remote/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 b/remote/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 index f424e3b9..d41fe57e 100755 --- a/remote/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 +++ b/remote/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 @@ -1,9 +1,16 @@ #!/bin/sh -insmod /lib/modules/dnbd3/dnbd3.ko || exit 1 +if ! insmod /lib/modules/dnbd3/dnbd3.ko; then + slxlog "dnbd3-kernel" "Error loading dnbd3 client kernel module" + exit 1 +fi + [ -e "/dev/dnbd0" ] || exit 1 for i in /dev/dnbd*; do echo 8192 > "/sys/block/dnbd${i#/dev/dnbd}/queue/nr_requests" done + exec -- dnbd3-client --daemon +slxlog "dnbd3-daemon" "Error launching dnbd3-client daemon" +exit 1 -- cgit v1.2.3-55-g7522 From 7f75f14a06255fad86151a5273bee619a313a594 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 27 Nov 2013 17:37:16 +0100 Subject: [vmchooser] Add slxlog to run-virt --- .../data/opt/openslx/scripts/vmchooser-run_virt | 94 ++++++++++++---------- 1 file changed, 51 insertions(+), 43 deletions(-) (limited to 'remote/modules') diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt index 5c85dfcd..0030eda1 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt @@ -180,18 +180,22 @@ DO_PROFILE="$(grep -c -E -i '<\s*profile\s*param="?(true|yes)"?' "$xmlfile")" # test if the xml file is valid if ! [ -r "${xmlfile}" ]; then writelog "${xmlfile} not a readable XML file!" + slxlog "virt-nonreadable-xml" "XML file not readable: $xmlfile" exit 1 fi # test if XML file -if ! grep '/dev/null 2>&1; then +if ! grep -q '/dev/null | grep -q '^/' >/dev/null 2>&1; then +if echo "${imgname}" | grep -q '^/'; then imgpath="$(dirname "${imgname}")" imgname="$(basename "${imgname}")" vmpath="${imgpath}/${imgname}" # If old vmchooser binary stuff # We do not need folder name as it is already included by vmchooser -elif echo "${xmlfile}" 2>/dev/null | grep -q '^/tmp/' >/dev/null 2>&1; then +elif echo "${xmlfile}" | grep -q '^/tmp/'; then vmpath="$imgname" imgname="$(basename "${imgname}")" ## Added for persistent support. @@ -265,9 +269,7 @@ xmlvirt=$(grep -o 'virtualmachine param=.*"' "${xmlfile}" \ | sed -e "s/&.*;/; /g" | awk -F '"' '{print $2}') # choose the proper virtualization/emulator plugin -[ "x${xmlvirt}" != "x" -a "x${xmlvirt}" != "xqemukvm" -a \ -"x${xmlvirt}" != "xvirtualbox" -a "x${xmlvirt}" != "xvmware" ] && \ -xmlvirt="emufe" +[ "x${xmlvirt}" != "x" -a "x${xmlvirt}" != "xqemukvm" -a "x${xmlvirt}" != "xvirtualbox" -a "x${xmlvirt}" != "xvmware" ] && xmlvirt="emufe" # make a guess from the filename extension if ${xmlvirt} is empty # (not set within the XML file) @@ -308,23 +310,18 @@ if [ -z "${xmlvirt}" ] && [ -n "${additional_config}" ]; then fi # Definition of the client system -vmostype=$(grep -io '/dev/null | \ -awk -F '=' {'print $2'} | tr "[A-Z]" "[a-z]") +enable3d=$(grep -i "/dev/null | awk -F '=' '{print $2}' | tr "[A-Z]" "[a-z]") # Add rw share sharepath="${HOME}/PERSISTENT" @@ -427,19 +424,12 @@ else VOL="80%" fi # Adjust sound volume -#writelog "Unmuting sound...\c " amixer -q sset Master "$VOL" unmute 2>/dev/null amixer -q sset PCM "$VOL" unmute 2>/dev/null amixer -q sset CD "$VOL" unmute 2>/dev/null amixer -q sset Headphone "$VOL" unmute 2>/dev/null amixer -q sset Front "$VOL" unmute 2>/dev/null # in SUSE 11.0 it's headphone amixer -q sset Speaker "$VOL" unmute 2>/dev/null # annoying built-in speaker -#writelog "finished\n" - -# Load kvm modules -if [ "$vtflag" = "1" -a -n "$kvm_module" ]; then - modprobe "$kvm_module" -fi # # # # # # Start printer daemon # # # # # # # @@ -449,13 +439,12 @@ QUEUE="STANDARD" # Start the lpdaemon listening on the given port tcpsvd -E 0.0.0.0 5515 \ - lpd "$SPOOLDIR" \ - sh -c "printergui $USER $SPOOLDIR/$QUEUE/\$DATAFILE" & + lpd "$SPOOLDIR" \ + sh -c "printergui $USER $SPOOLDIR/$QUEUE/\$DATAFILE" & # PID to kill the process PID_LPD="$!" - # Copy guest configuration (with added information) config.xml to be accessed # via virtual floppy cp "$xmlfile" "$VMCHOOSER_DIR/fd-loop/config.xml" @@ -483,7 +472,10 @@ if [ -n "$SLX_DNBD3_SERVERS" -o -n "$SLX_DNBD3_PRIO_SERVERS" ] && [ "x$SLX_VM_DN break fi done - [ -z "$vm_diskfile" ] && writelog "No working dnbd3 server found :-(" + if [ -z "$vm_diskfile" ]; then + slxlog "virt-dnbd3" "No dnbd3 server for ${vmpath#/mnt/vmstore/} found ($SLX_DNBD3_PRIO_SERVERS $TMP_SERVERS), trying NFS..." + writelog "No working dnbd3 server found :-(" + fi else writelog "Won't use dnbd3 as it's not loaded, or the daemon is not running..." fi @@ -499,20 +491,27 @@ fi # Check if virtual machine container file exists if ! [ -e "${vmpath}" ]; then + slxlog "virt-missing-image" "VM image $vmpath not found!" writelog "Virtual machine image ${vmpath} not found!" - exit 1 + cleanexit 1 fi writelog "Used diskfile: $vm_diskfile" # Get all virtual machine specific stuff from the respective include file if [ ! -e "$VMCHOOSER_DIR/$xmlvirt/run-virt.include" ] ; then + # TODO: Tell user + slxlog "virt-plugin-missing" "Could not find run-virt.include for $xmlvirt" writelog "Failed because of missing ${xmlvirt} plugin." cleanexit 1 fi self="${xmlvirt}" -. "$VMCHOOSER_DIR/$xmlvirt/run-virt.include" || writelog "Erroneous run-virt.include for $xmlvirt" +if ! . "$VMCHOOSER_DIR/$xmlvirt/run-virt.include"; then + slxlog "virt-plugin-error" "run-virt.include for $xmlvirt could not be sourced (contains syntax errors?)" "$xmlvirt" + writelog "Erroneous run-virt.include for $xmlvirt" +fi + # start a windowmanager for easier handling # (expect problems w/ windows opening in background w/ vmware without wm) for dm in openbox kwin xfwm4 metacity blackbox twm fvwm2 ; do @@ -526,13 +525,22 @@ for dm in openbox kwin xfwm4 metacity blackbox twm fvwm2 ; do break fi done + # Start poolvideoswitch if we find the autostarter file #if [ -e /etc/xdg/autostart/pvsgui.desktop ]; then # /usr/local/bin/pvsgui -p 2 -b >/dev/null 2>&1 & #fi + if [[ "$DO_PROFILE" -ge "1" ]]; then - wget "http://132.230.8.113/profile/do.php?action=start" + wget "http://132.230.8.113/profile/do.php?action=start" & +fi + +# Check if tcpsvd is running. Do this down here so we do not check immediately after trying to spawn it, +# as this could result in success even if it's not really working +if ! kill -0 "$PID_LPD"; then + slxlog "virt-lpd" "Could not start tcpsvd/lpd for virtual machine session" fi + # This will start the VM eval ${VIRTCMD} ${VIRTCMDOPTS} # -- cgit v1.2.3-55-g7522 From c3fdedac4699304c698d5452a0acdc6dd3fa8211 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 27 Nov 2013 18:06:50 +0100 Subject: [vmware] bump version to 10.0.1 --- remote/modules/vmware/vmware.build | 4 +++- remote/modules/vmware/vmware.conf | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'remote/modules') diff --git a/remote/modules/vmware/vmware.build b/remote/modules/vmware/vmware.build index 85929c17..29b7491f 100644 --- a/remote/modules/vmware/vmware.build +++ b/remote/modules/vmware/vmware.build @@ -40,7 +40,9 @@ build() { cp -r ./$SRCDIR/vmware-usbarbitrator/bin "$MODULE_BUILD_DIR/usr/" || perror "Could not copy bin from vmware-usbarbitrator." cp -r ./$SRCDIR/vmware-vmx/{bin,etc,sbin} "$MODULE_BUILD_DIR/usr/" || perror "could not copy bin,etc,sbin to usr for vmare-vmx." cp -r ./$SRCDIR/vmware-vmx/lib/{bin,icu,lib,libconf,scripts} "$TARGET" || perror "Could not copy many things from vmware-vmx." - [ -d "./$SRCDIR/vmware-workstation-server" ] && cp -r ./$SRCDIR/vmware-workstation-server/{bin,lib} "$TARGET" || perror "Could not copy many things from vmware-workstation-server." + if [ -d "./$SRCDIR/vmware-workstation-server" ]; then + cp -r ./$SRCDIR/vmware-workstation-server/{bin,lib} "$TARGET" || perror "Could not copy many things from vmware-workstation-server." + fi [ ! -L "$TARGET/bin/vmplayer" ] && { ln -s /usr/lib/vmware/bin/appLoader "$TARGET/bin/vmplayer" || perror "Could not link vmplayer to appLoader."; } chmod +x "$TARGET"/bin/* chmod u+s "$TARGET"/bin/vmware-vmx* || perror "Error setting suid-bit on vmware-vmx*" diff --git a/remote/modules/vmware/vmware.conf b/remote/modules/vmware/vmware.conf index 11b7ca71..b040152e 100644 --- a/remote/modules/vmware/vmware.conf +++ b/remote/modules/vmware/vmware.conf @@ -1,4 +1,4 @@ REQUIRED_DIRECTORIES="/etc /usr" -REQUIRED_DOWNLOAD_BASE="http://softwareupdate.vmware.com/cds/vmw-desktop/ws/10.0.0/1295980/linux/core/" +REQUIRED_DOWNLOAD_BASE="http://softwareupdate.vmware.com/cds/vmw-desktop/ws/10.0.1/1379776/linux/core/" REQUIRED_TYPE="workstation" -- cgit v1.2.3-55-g7522 From d369b10c0e1191a95d4396aa2db4206480a21465 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 27 Nov 2013 18:22:14 +0100 Subject: [vmware] vmware_env: add slxlog, fix mknod call I broke yesterday --- .../data/opt/openslx/scripts/systemd-vmware_env | 91 ++++++++++++---------- 1 file changed, 48 insertions(+), 43 deletions(-) (limited to 'remote/modules') 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 } -- cgit v1.2.3-55-g7522 From 5a587d02294c2216fc7ad6bf5a1ac9059ae5c595 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 27 Nov 2013 18:48:57 +0100 Subject: [vmware] Add slxlog to run-virt.include --- .../data/opt/openslx/vmchooser/vmware/run-virt.include | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'remote/modules') 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}" + -- cgit v1.2.3-55-g7522