diff options
author | Simon Rettberg | 2017-08-11 13:00:11 +0200 |
---|---|---|
committer | Simon Rettberg | 2017-08-11 13:00:11 +0200 |
commit | f0ddb185b3cf4071a31958bd517217395d694f0a (patch) | |
tree | 24cc234bf81e8144e651926a95dc32abe181756c /core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env | |
parent | [rfs-stage32] Clean up split addon handling (diff) | |
download | mltk-f0ddb185b3cf4071a31958bd517217395d694f0a.tar.gz mltk-f0ddb185b3cf4071a31958bd517217395d694f0a.tar.xz mltk-f0ddb185b3cf4071a31958bd517217395d694f0a.zip |
[run-virt] Speed up network setup
DNS dependency solved via systemd instead of busy-wait loop.
nslookup timeout set to 1 second.
Diffstat (limited to 'core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env')
-rwxr-xr-x | core/modules/run-virt/data/opt/openslx/scripts/systemd-run_virt_env | 24 |
1 files changed, 8 insertions, 16 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 32cf492f..fcce04d6 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 @@ -61,7 +61,7 @@ chmod a+rwxt /tmp/virt #EOF ################################################################################ -### Determine host's hardware configuration +echo "Determine host's hardware configuration" ################################################################################ # estimate free mem @@ -150,7 +150,7 @@ echo "SERIAL_PORTS='$(dmesg | grep -Eo 'ttyS[0-9]+' | sed 's,^,/dev/,' | tr '\n' modprobe parport_pc ################################################################################ -### Setup VM networking +echo "Setup VM networking" ################################################################################ # there will be three types of network interfaces for virtual machines available @@ -177,22 +177,12 @@ ip addr add 192.168.101.1/24 dev nat1 echo "1" >/proc/sys/net/ipv4/conf/nat1/forwarding echo "1" >/proc/sys/net/ipv4/conf/br0/forwarding 2>/dev/null # iptables masquerade rule is now inserted by /opt/openslx/iptables/rules.d/50-virt-nat1-masquerading -### iptables -t nat -A POSTROUTING -o br0 -s 192.168.0.0/16 -j MASQUERADE - -for wait in 1 1 2 2 3 end; do - [ -n "$SLX_DNS" ] && [ -n "$SLX_NET_SEARCH" ] && break - if [ "$wait" == "end" ]; then - echo "No DNS config found, using google dns" - break - fi - echo "Waiting for DNS & search-domain config.." - sleep "$wait" - . /opt/openslx/config -done getips () { - # Output in one line by using echo without quotes - echo $(nslookup "$1" 2>/dev/null | grep -A 3 '^Name:' | grep '^Address .*: ' | awk '{print $3}') + if [ -n "$1" ]; then + # Output in one line by using echo without quotes + echo $(timeout -t 1 nslookup "$1" 2>/dev/null | grep -A 3 '^Name:' | grep '^Address .*: ' | awk '{print $3}') + fi } # read the DNS configuration and configure the udhcpd @@ -221,3 +211,5 @@ brctl addbr vsw2 ip link set dev vsw2 up echo "1" >/proc/sys/net/ipv4/conf/vsw2/forwarding +exit 0 + |