diff options
Diffstat (limited to 'remote/modules')
18 files changed, 100 insertions, 33 deletions
diff --git a/remote/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service b/remote/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service new file mode 100644 index 00000000..97f6703d --- /dev/null +++ b/remote/modules/dnbd3/data/etc/systemd/system/setup-dnbd3.service @@ -0,0 +1,12 @@ +[Unit] +Description=Setup dnbd3 kernel module and user space daemon +After=sysinit.target +Before=shutdown.target +DefaultDependencies=no + +[Service] +Type=service +ExecStart=/opt/openslx/scripts/systemd-setup_dnbd3 +ExecStop=/opt/openslx/bin/dnbd3-client --kill +ExecStopPost=/bin/rm /var/run/dnbd3.socket +Restart=on-abort diff --git a/remote/modules/dnbd3/data/etc/systemd/system/sysinit.target.wants/setup-dnbd3.service b/remote/modules/dnbd3/data/etc/systemd/system/sysinit.target.wants/setup-dnbd3.service new file mode 120000 index 00000000..05dd4ac2 --- /dev/null +++ b/remote/modules/dnbd3/data/etc/systemd/system/sysinit.target.wants/setup-dnbd3.service @@ -0,0 +1 @@ +../setup-dnbd3.service
\ No newline at end of file diff --git a/remote/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 b/remote/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 new file mode 100755 index 00000000..9c76bfa6 --- /dev/null +++ b/remote/modules/dnbd3/data/opt/openslx/scripts/systemd-setup_dnbd3 @@ -0,0 +1,9 @@ +#!/bin/sh + +insmod /lib/modules/dnbd3/dnbd3.ko +[ -e "/dev/dnbd0" ] || exit 1 +for i in 0 1 2 3 4 5 6 7; do + echo 8192 > "/sys/block/dnbd${i}/queue/nr_requests" +done +exec -- dnbd3-client --daemon + diff --git a/remote/modules/dnbd3/dnbd3.build b/remote/modules/dnbd3/dnbd3.build index 5dd2769f..e285788b 100644 --- a/remote/modules/dnbd3/dnbd3.build +++ b/remote/modules/dnbd3/dnbd3.build @@ -32,6 +32,8 @@ build() { cd "$MODULE_BUILD_DIR/opt/openslx/bin" || perror "Could not cd to build dir for client binary" cmake "$MODULE_DIR/src/dnbd3" || perror "Could not cmake" make dnbd3-client || perror "Could not make dnbd3-client" + chown root:root "dnbd3-client" + chmod +xs "dnbd3-client" cd "$MODULE_DIR" } diff --git a/remote/modules/dnbd3/dnbd3.conf b/remote/modules/dnbd3/dnbd3.conf index c1a3eb2e..31c411d0 100644 --- a/remote/modules/dnbd3/dnbd3.conf +++ b/remote/modules/dnbd3/dnbd3.conf @@ -2,7 +2,7 @@ #REQUIRED_CONTENT_PACKAGES="libgconf-2-4 fontconfig-config" REQUIRED_MODULES="kernel" REQUIRED_GIT="git://git.openslx.org/dnbd3.git" -REQUIRED_COMMIT="37868b9e5f7c26c61a928a61b7cc705eedb7e5a6" +REQUIRED_COMMIT="89a7af0ceb1cdc13f7d3a4ffac54f32576e1138d" REQUIRED_BINARIES=" dnbd3-client " diff --git a/remote/modules/kdm/data/etc/tmpfiles.d/kdm.conf b/remote/modules/kdm/data/etc/tmpfiles.d/kdm.conf new file mode 100644 index 00000000..64f02ed3 --- /dev/null +++ b/remote/modules/kdm/data/etc/tmpfiles.d/kdm.conf @@ -0,0 +1,2 @@ +D /var/run/kdm 0755 root root + diff --git a/remote/modules/kdm/kdm.build b/remote/modules/kdm/kdm.build index b5d1be08..feac30cb 100644 --- a/remote/modules/kdm/kdm.build +++ b/remote/modules/kdm/kdm.build @@ -16,7 +16,6 @@ build () { post_copy() { #create static kdm folders in stage3.2 mkdir -p "${TARGET_BUILD_DIR}/var/lib/kdm" - mkdir -p "${TARGET_BUILD_DIR}/var/run/kdm" # link kdm config as opensuse wants in in another place ln -s "/etc/kde4" "$TARGET_BUILD_DIR/usr/share/kde4/config" diff --git a/remote/modules/pam/data/etc/tmpfiles.d/pipefs.conf b/remote/modules/pam/data/etc/tmpfiles.d/pipefs.conf new file mode 100644 index 00000000..7c422623 --- /dev/null +++ b/remote/modules/pam/data/etc/tmpfiles.d/pipefs.conf @@ -0,0 +1,2 @@ +D /var/run/rpc_pipefs 0755 root root + diff --git a/remote/modules/pam/pam.build b/remote/modules/pam/pam.build index 063c0065..34319ce8 100644 --- a/remote/modules/pam/pam.build +++ b/remote/modules/pam/pam.build @@ -23,18 +23,5 @@ build() { } post_copy() { - if [ ! -d "${TARGET_BUILD_DIR}/run/rpc_pipefs" ]; then - mkdir -p "${TARGET_BUILD_DIR}/run/rpc_pipefs" || pwarning "Could not mkdir ${TARGET_BUILD_DIR}/run/rpc_pipefs" - fi - - # find libnfsidmap run-time library directory - #local COPYLIST="$MODULE_BUILD_DIR/list_packet_files" - #local SEARCH=$(grep "/libsnfsidmap/" "$COPYLIST" | head -1) - #[ -z "$SEARCH" ] && perror "Hä" - #SEARCH=$(dirname "$SEARCH") - #if [ -d "${SEARCH}" ]; then - # tarcopy "${SEARCH}" "${TARGET_BUILD_DIR}" || pinfo "Something went wrong copying $SEARCH" - #fi - - + : } diff --git a/remote/modules/plymouth/data/etc/tmpfiles.d/plymouth.conf b/remote/modules/plymouth/data/etc/tmpfiles.d/plymouth.conf new file mode 100644 index 00000000..211c61f6 --- /dev/null +++ b/remote/modules/plymouth/data/etc/tmpfiles.d/plymouth.conf @@ -0,0 +1,2 @@ +D /var/run/plymouth 0755 root root + diff --git a/remote/modules/plymouth/plymouth.conf b/remote/modules/plymouth/plymouth.conf index 26e123e4..ec6f8571 100644 --- a/remote/modules/plymouth/plymouth.conf +++ b/remote/modules/plymouth/plymouth.conf @@ -9,5 +9,6 @@ REQUIRED_DIRECTORIES=" /etc /lib /sbin - /var + /var/lib + /var/spool " diff --git a/remote/modules/sshd/data/etc/tmpfiles.d/sshd.conf b/remote/modules/sshd/data/etc/tmpfiles.d/sshd.conf new file mode 100644 index 00000000..d4aa9a67 --- /dev/null +++ b/remote/modules/sshd/data/etc/tmpfiles.d/sshd.conf @@ -0,0 +1,2 @@ +D /var/run/sshd 0755 root root + diff --git a/remote/modules/sshd/sshd.build b/remote/modules/sshd/sshd.build index 89dcd386..ebf42c12 100644 --- a/remote/modules/sshd/sshd.build +++ b/remote/modules/sshd/sshd.build @@ -14,7 +14,6 @@ build() { } post_copy() { - mkdir -p "${TARGET_BUILD_DIR}/var/run/sshd" # ubuntu mkdir -p "${TARGET_BUILD_DIR}/var/lib/empty" # suse chmod go-rwx "${TARGET_BUILD_DIR}/etc/ssh/"* # no space, " before * diff --git a/remote/modules/systemd/data/etc/systemd/system/network-interface@.service b/remote/modules/systemd/data/etc/systemd/system/network-interface@.service index 13a30bbc..77bbd287 100644 --- a/remote/modules/systemd/data/etc/systemd/system/network-interface@.service +++ b/remote/modules/systemd/data/etc/systemd/system/network-interface@.service @@ -5,4 +5,5 @@ Before=udhcpc@%i.service [Service] Type=simple -ExecStart=/opt/openslx/bin/ip link set dev %I up +ExecStart=/opt/openslx/sbin/ip link set dev %I up + diff --git a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env index 50eace20..4119ad9c 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/systemd-vmchooser_env @@ -91,7 +91,11 @@ if grep -q ^flags.*\\\<vmx\\\> /proc/cpuinfo; then fi # write mac -echo "hostmacaddr=${SLX_PXE_MAC}" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf +if [ -n "$SLX_PXE_MAC" ]; then + echo "hostmacaddr=${SLX_PXE_MAC}" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf +else ## Fallback: + echo "hostmacaddr=$(ip a | grep ether | grep -o -E -i '([0-9a-f]{2}:){5}[0-9a-f]{2}' | head -n 1)" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf +fi # ip addr echo "hostip=${SLX_PXE_CLIENT_IP}" >> ${VMCHOOSER_CONF_DIR}/virtualization.conf # hostname 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 979db35a..f6e4e491 100755 --- a/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt +++ b/remote/modules/vmchooser/data/opt/openslx/scripts/vmchooser-run_virt @@ -23,11 +23,11 @@ ################################################################################ # include general configuration from vmchooser -[ -f /opt/openslx/etc/vmchooser/vmchooser.conf ] && \ -. /opt/openslx/etc/vmchooser/vmchooser.conf +[ -f /opt/openslx/etc/vmchooser/vmchooser.conf ] && . /opt/openslx/etc/vmchooser/vmchooser.conf # load general virtualization information -[ -f /opt/openslx/etc/vmchooser/virtualization.conf ] && \ -. /opt/openslx/etc/vmchooser/virtualization.conf +[ -f /opt/openslx/etc/vmchooser/virtualization.conf ] && . /opt/openslx/etc/vmchooser/virtualization.conf +# Load general openslx config +[ -f /opt/openslx/config ] && . /opt/openslx/config ################################################################################ ### Functions used throughout the script @@ -359,8 +359,9 @@ hostmem="$[ $totalmem - $mem ]" # last two bytes are taken from the bridge of the host # define one MAC per guest macguestpart="00:50:56:${VM_ID}" -machostpart=$(echo ${hostmacaddr} | awk -F ":" '{print $(NF-1)":"$NF}') +machostpart=$(echo "${hostmacaddr}" | awk -F ":" '{print $(NF-1)":"$NF}') macaddr=$(echo "${macguestpart}:${machostpart}" | tr "[a-z]" "[A-Z]") +macaddrsuffix=$(echo "${VM_ID}:${machostpart}" | tr "[a-z]" "[A-Z]") # Virtual fd/cd/dvd and drive devices, floppy b: for configuration # if $floppy_0 from run-virt.include set then fdtest="TRUE" @@ -432,6 +433,32 @@ cp "$xmlfile" "/opt/openslx/etc/vmchooser/fd-loop/config.xml" # Add another file with resolution information xrandr | grep -o -E 'current\s*[0-9]+\s*x\s*[0-9]+' | cut -c 8- | sed -r 's/(\s|\t|\n)//g' | head -n 1 > "/opt/openslx/etc/vmchooser/fd-loop/hostres.txt" +# Try to use dnbd3 to access the image +unset vm_diskfile +unset vm_revision +unset dnbd3 +if [ -n "$SLX_DNBD3_SERVERS" ]; then + if [ -e "/dev/dnbd0" -a -e "/var/run/dnbd3.socket" ]; then + for SRV in $SLX_DNBD3_SERVERS; do + dnbd3=$(dnbd3-client -h "$SRV" -i "${vmpath#/mnt/vmstore/}" -r 0) + RET=$? + if [ "$RET" = "0" ]; then + vm_diskfile="$dnbd3" + vm_revision=$(cat "/sys/block/${dnbd3#/dev/}/net/rid") + writelog "DNBD3: $vm_diskfile on $dnbd3 with rid $vm_revision" + break + fi + done + [ -z "$vm_diskfile" ] && writelog "No working dnbd3 server found :-(" + else + writelog "Won't use dnbd3 as it's not loaded, or the daemon is not running..." + fi +else + writelog "Won't use dnbd3 as no servers are given in config" +fi +[ -z "$vm_diskfile" ] && vm_diskfile="$vmpath" +writelog "Used diskfile: $vm_diskfile" + # Get all virtual machine specific stuff from the respective include file if [ -e /opt/openslx/etc/"${xmlvirt}"/run-virt.include ] ; then self="${xmlvirt}" @@ -463,6 +490,15 @@ if [ -e /opt/openslx/etc/"${xmlvirt}"/run-virt.include ] ; then if [ -n "${POSTRUN}" ]; then eval ${POSTRUN} >/dev/null 2>&1 fi + + # Disconnect dnbd3 device + if [ -n "$dnbd3" ]; then + for timeout in 1 1 2; do + dnbd3-client -c "$dnbd3" && break + writelog "dnbd3 still busy...." + sleep "$timeout" + done + fi cleanexit 0 else diff --git a/remote/modules/vmplayer/data/addon-init b/remote/modules/vmplayer/data/addon-init new file mode 100755 index 00000000..01acb3b4 --- /dev/null +++ b/remote/modules/vmplayer/data/addon-init @@ -0,0 +1,5 @@ +#!/bin/sh + +systemctl daemon-reload +systemctl start vmware + diff --git a/remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include b/remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include index 084828ff..b755133f 100755 --- a/remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include +++ b/remote/modules/vmplayer/data/opt/openslx/etc/vmware/run-virt.include @@ -229,7 +229,7 @@ MemTrimRate = "-1" # ide-disks ide0:0.present = "$ide" -ide0:0.fileName = "$diskfile" +ide0:0.fileName = "$vm_diskfile" ## Edited for persistent mode. ide0:0.mode = "independent-${diskmode}" ## @@ -245,7 +245,7 @@ ide1:1.deviceType = "cdrom-raw" # scsi-disks scsi0.present = "$scsi" scsi0:0.present = "$scsi" -scsi0:0.fileName = "$diskfile" +scsi0:0.fileName = "$vm_diskfile" scsi0.virtualDev = "$hddrv" ## Edited for persistent mode. scsi0:0.mode = "independent-${diskmode}"$stateFileConfiguration @@ -270,7 +270,7 @@ $network_virtualDev ethernet0.connectionType = "$network_kind" #ethernet1.connectionType = "custom" #ethernet1.vnet = "/dev/vmnet2" -ethernet0.address = "00:50:56:$VM_ID:$machostpart" +ethernet0.address = "00:50:56:$macaddrsuffix" ethernet0.wakeOnPcktRcv = "FALSE" # sound @@ -627,11 +627,14 @@ writelog "" ################################################################################ # configure and start samba service to provide user's home directory -if [ -f /usr/sbin/smbd ] ; then - sudo /opt/openslx/bin/sed -i /etc/vmware/smb.conf -e "s,USER,$USER," - sudo /usr/sbin/nmbd -s /etc/vmware/smb.conf - sudo /usr/sbin/smbd -s /etc/vmware/smb.conf -fi +#if [ -f /usr/sbin/smbd ] ; then +# sudo /opt/openslx/bin/sed -i /etc/vmware/smb.conf -e "s,USER,$USER," +# sudo /usr/sbin/nmbd -s /etc/vmware/smb.conf +# sudo /usr/sbin/smbd -s /etc/vmware/smb.conf +#fi + +# For debugging +cp "$conffile" "/tmp/vmware-last-config" # using the modified version of the wrapper script VIRTCMD="/opt/openslx/bin/vmplayer" |
