summaryrefslogtreecommitdiffstats
path: root/core/modules/run-virt/data/opt/openslx/scripts
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-28 11:33:02 +0100
committerSimon Rettberg2019-10-28 11:33:02 +0100
commit01f8b005ca8fd211b43fdace4a7c86e1fac5ab3d (patch)
tree6723d2b9c77ce5af25fb4eb899ca89679e89acd2 /core/modules/run-virt/data/opt/openslx/scripts
parent[vmware-common] Remove any existing usb autoconnect entries (diff)
downloadmltk-01f8b005ca8fd211b43fdace4a7c86e1fac5ab3d.tar.gz
mltk-01f8b005ca8fd211b43fdace4a7c86e1fac5ab3d.tar.xz
mltk-01f8b005ca8fd211b43fdace4a7c86e1fac5ab3d.zip
[run-virt] Make dhcpd its own service
Closes #3540 Closes #3501
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/scripts')
-rwxr-xr-xcore/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env b/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
index 8306c2b1..30a37fb1 100755
--- a/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
+++ b/core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env
@@ -32,6 +32,7 @@ export PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin
VMCHOOSER_DIR="/opt/openslx/vmchooser"
VMCHOOSER_CONF_DIR="${VMCHOOSER_DIR}/config"
VMCHOOSER_VIRT_CONF="${VMCHOOSER_CONF_DIR}/virtualization.conf"
+# Same as in service file for udhcpd
DHCP_NAT_CONF="${VMCHOOSER_CONF_DIR}/udhcpd-nat1.conf"
# setup more scratch space for virtual machines, if configured
@@ -209,16 +210,25 @@ if [ -z "${SLX_NET_WINS}" ]; then
[ -z "$DC" ] && DC=$(grep -m1 -i '^ldap_search_base\s*=\s*DC=' "/etc/sssd/sssd.conf" | grep -o -i 'DC=.*' | sed -r 's/\s*,\s*DC=/./gI;s/^\s*DC=//I')
[ -n "$DC" ] && SLX_NET_WINS=$(getips "$DC")
fi
+# NTP - default to pool.ntp.org
+NTPSRV=
+[ -z "$SLX_NTP_SERVER" ] && SLX_NTP_SERVER="pool.ntp.org"
+for ips in $SLX_NTP_SERVER; do
+ if ! printf "%s" "$ips" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'; then
+ ips="$( getips "$ips" )"
+ [ -z "$ips" ] && continue
+ fi
+ NTPSRV="$NTPSRV $ips"
+done
+[ -z "$NTPSRV" ] && NTPSRV="0.0.0.0"
[ -z "${SLX_NET_WINS}" ] && SLX_NET_WINS=$(getips "$SLX_NET_DOMAIN")
[ -z "${SLX_NET_WINS}" ] && SLX_NET_WINS="0.0.0.0"
-sed -i "s#%DNSSERVER%#${SLX_DNS}#;s#%DOMAIN%#${SLX_NET_DOMAIN}#;s#%SEARCH%#${SLX_NET_SEARCH}#;s#%WINS%#${SLX_NET_WINS}#" "${DHCP_NAT_CONF}"
+sed "s#%DNSSERVER%#${SLX_DNS}#;s#%DOMAIN%#${SLX_NET_DOMAIN}#;s#%SEARCH%#${SLX_NET_SEARCH}#;s#%WINS%#${SLX_NET_WINS}#;s#%NTPSERVER%#${NTPSRV}#" "${DHCP_NAT_CONF}.template" > "${DHCP_NAT_CONF}"
# Make sure the primary vm running (we most likely never run more than one at a time anyways) always gets the same ip
echo "static_lease $(echo "$MACADDRPREFIX:$MACADDRSUFFIX" | sed 's/%VMID%/01/') 192.168.101.20" >> "${DHCP_NAT_CONF}"
mkdir -p /var/lib/udhcpd
-# TODO: systemd
-udhcpd -S "${DHCP_NAT_CONF}"
# creating and configuring vsw2
brctl addbr vsw2