Browse Source

Use right way to skip fuelmenu

Use virtualbox built-in keyboardputscancode instead of using
ssh to master node and kill fuelmenu.

Change-Id: Ie3a12b7ca54e4c606f4c88145cc3cbad5822480a
Closes-bug: #1501796
Stanislav Makar 3 years ago
parent
commit
ebabd4604b
3 changed files with 16 additions and 60 deletions
  1. 5
    4
      actions/master-node-create-and-install.sh
  2. 0
    56
      functions/product.sh
  3. 11
    0
      functions/vm.sh

+ 5
- 4
actions/master-node-create-and-install.sh View File

@@ -48,14 +48,15 @@ if [ ${headless} -eq 1 ]; then
48 48
   enable_vrde $name ${RDPport}
49 49
 fi
50 50
 
51
+if [ "$skipfuelmenu" = "yes" ]; then
52
+  # " vmlinuz initrd=initrd.img biosdevname=0 ks=cdrom:/ks.cfg ip=10.20.0.2 gw=10.20.0.1 dns1=10.20.0.1 netmask=255.255.255.0 hostname=fuel.domain.tld showmenu=no" line is coded
53
+   boot_line=" 39 b9 2f af 32 b2 26 a6 17 97 31 b1 16 96 2c ac 39 b9 17 97 31 b1 17 97 14 94 13 93 20 a0 0d 8d 17 97 31 b1 17 97 14 94 13 93 20 a0 34 b4 17 97 32 b2 22 a2 39 b9 30 b0 17 97 18 98 1f 9f 20 a0 12 92 2f af 31 b1 1e 9e 32 b2 12 92 0d 8d 0b 8b 39 b9 25 a5 1f 9f 0d 8d 2e ae 20 a0 13 93 18 98 32 b2 2a 27 a7 aa 35 b5 25 a5 1f 9f 34 b4 2e ae 21 a1 22 a2 39 b9 17 97 19 99 0d 8d 02 82 0b 8b 34 b4 03 83 0b 8b 34 b4 0b 8b 34 b4 03 83 39 b9 22 a2 11 91 0d 8d 02 82 0b 8b 34 b4 03 83 0b 8b 34 b4 0b 8b 34 b4 02 82 39 b9 20 a0 31 b1 1f 9f 02 82 0d 8d 02 82 0b 8b 34 b4 03 83 0b 8b 34 b4 0b 8b 34 b4 02 82 39 b9 31 b1 12 92 14 94 32 b2 1e 9e 1f 9f 25 a5 0d 8d 03 83 06 86 06 86 34 b4 03 83 06 86 06 86 34 b4 03 83 06 86 06 86 34 b4 0b 8b 39 b9 23 a3 18 98 1f 9f 14 94 31 b1 1e 9e 32 b2 12 92 0d 8d 21 a1 16 96 12 92 26 a6 34 b4 20 a0 18 98 32 b2 1e 9e 17 97 31 b1 34 b4 14 94 26 a6 20 a0 39 b9 1f 9f 23 a3 18 98 11 91 32 b2 12 92 31 b1 16 96 0d 8d 31 b1 18 98 1c 9c"
54
+fi
55
+
51 56
 # Start virtual machine with the master node
52 57
 echo
53 58
 start_vm $name
54 59
 
55
-if [ "$skipfuelmenu" = "yes" ]; then
56
-  wait_for_fuel_menu $vm_master_ip $vm_master_username $vm_master_password "$vm_master_prompt"
57
-fi
58
-
59 60
 # Wait until the machine gets installed and Puppet completes its run
60 61
 wait_for_product_vm_to_install $vm_master_ip $vm_master_username $vm_master_password "$vm_master_prompt"
61 62
 

+ 0
- 56
functions/product.sh View File

@@ -22,62 +22,6 @@ source ./functions/shell.sh
22 22
 
23 23
 ssh_options='-oConnectTimeout=5 -oStrictHostKeyChecking=no -oCheckHostIP=no -oUserKnownHostsFile=/dev/null -oRSAAuthentication=no -oPubkeyAuthentication=no'
24 24
 
25
-wait_for_fuel_menu() {
26
-    ip=$1
27
-    username=$2
28
-    password=$3
29
-    prompt=$4
30
-
31
-    echo "Waiting for Fuel Menu so it can be skipped. Please do NOT abort the script..."
32
-
33
-    # Loop until master node gets successfully installed
34
-    maxdelay=3000
35
-    while ! skip_fuel_menu $ip $username $password "$prompt"; do
36
-        sleep 5
37
-        ((waited += 5))
38
-        if (( waited >= maxdelay )); then
39
-          echo "Installation timed out! ($maxdelay seconds)" 1>&2
40
-          exit 1
41
-        fi
42
-    done
43
-}
44
-
45
-skip_fuel_menu() {
46
-    ip=$1
47
-    username=$2
48
-    password=$3
49
-    prompt=$4
50
-
51
-    # Log in into the VM, see if Fuel Setup is running or puppet already started
52
-    # Looks a bit ugly, but 'end of expect' has to be in the very beginning of the line
53
-    result=$(
54
-        execute expect << ENDOFEXPECT
55
-        spawn ssh $ssh_options $username@$ip
56
-        expect "connect to host" exit
57
-        expect "*?assword:*"
58
-        send "$password\r"
59
-        expect "$prompt"
60
-        send "pgrep 'fuelmenu|puppet';echo \"returns $?\"\r"
61
-        expect "$prompt"
62
-ENDOFEXPECT
63
-    )
64
-    if [[ "$result" =~ "returns 0" ]]; then
65
-      echo "Skipping Fuel Setup..."
66
-      execute expect << ENDOFEXPECT
67
-        spawn ssh $ssh_options $username@$ip
68
-        expect "connect to host" exit
69
-        expect "*?assword:*"
70
-        send "$password\r"
71
-        expect "$prompt"
72
-        send "killall -w -SIGUSR1 fuelmenu\r"
73
-        expect "$prompt"
74
-ENDOFEXPECT
75
-      return 0
76
-    else
77
-      return 1
78
-    fi
79
-}
80
-
81 25
 is_product_vm_operational() {
82 26
     ip=$1
83 27
     username=$2

+ 11
- 0
functions/vm.sh View File

@@ -207,6 +207,17 @@ start_vm() {
207 207
     else
208 208
         execute VBoxManage startvm $name
209 209
     fi
210
+
211
+    if [ -n "$boot_line" ]; then
212
+        sleep 3
213
+        # Pressing/releasing escape key
214
+        execute VBoxManage controlvm ${name} keyboardputscancode 01 81
215
+
216
+        for letter in ${boot_line}; do
217
+            execute VBoxManage controlvm ${name} keyboardputscancode ${letter}
218
+        done
219
+    fi
220
+
210 221
 }
211 222
 
212 223
 mount_iso_to_vm() {

Loading…
Cancel
Save