Browse Source

Additional verification of network interface settings

In some cases, VBoxManage utility can't assign network interface parameters
on the first try. This commit adds additional checks of network interface
settings and re-assigns the network settings if the first attempt was
unsuccessful.

Change-Id: If8a24ec44257b47e221477c46e93e3f62e63a07d
Closes-Bug: #1535742
tags/10.0.0rc1
Serhiy Ovsianikov 3 years ago
parent
commit
cc86e3997f
1 changed files with 12 additions and 3 deletions
  1. 12
    3
      functions/network.sh

+ 12
- 3
functions/network.sh View File

@@ -153,10 +153,19 @@ create_hostonly_interfaces() {
153 153
   echo "Configuring IP address $ip and network mask $mask on interface: $name..."
154 154
   execute VBoxManage hostonlyif ipconfig "$id" --ip $ip --netmask $mask
155 155
   # Check what we have created actually.
156
-  # Sometimes VBox occasionally fails to apply settings to the last IFace under Windows
157
-  if !(check_if_iface_settings_applied "$id" $ip $mask); then
156
+  # Sometimes VBox occasionally fails to apply settings to the last IFace under Windows and CentOS
157
+  local count_set=3;
158
+  while [[ $count_set > 0 ]] && !(check_if_iface_settings_applied "$id" $ip $mask); do
159
+    count_set=$(($count_set-1));
160
+    echo
158 161
     echo "Looks like VirtualBox failed to apply settings for interface $name"
159
-    echo "Sometimes such error happens under Windows."
162
+    echo "Trying to apply network settings for interface $name one more time..."
163
+    echo "Configuring IP address $ip and network mask $mask on interface: $name..."
164
+    sleep ${net_sleep}
165
+    execute VBoxManage hostonlyif ipconfig "$id" --ip $ip --netmask $mask
166
+  done
167
+  if [[ $count_set == 0 ]] && !(check_if_iface_settings_applied "$id" $ip $mask); then
168
+    echo "Sometimes such error happens under Windows and CentOS."
160 169
     echo "Please run launch.sh one more time."
161 170
     echo "If this error remains after several attempts, then something really went wrong."
162 171
     echo "Aborting."

Loading…
Cancel
Save