1 ##############################################################################
2 # Copyright (c) 2015 Ericsson AB and others.
3 # stefan.k.berg@ericsson.com
4 # jonas.bjurel@ericsson.com
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
11 fuelIp=`dea getFuelIp` || error_exit "Could not get fuel IP"
12 fuelNodeId=`dha getFuelNodeId` || error_exit "Could not get fuel node id"
15 if dha nodeCanZeroMBR $fuelNodeId; then
16 echo "Node $fuelNodeId capable of zeroing MBR so doing that..."
17 dha nodeZeroMBR $fuelNodeId || error_exit "Failed to zero Fuel MBR"
18 dha nodeSetBootOrder $fuelNodeId "disk iso"
19 elif dha nodeCanSetBootOrderLive; then
20 echo "Node can change ISO boot order live"
21 dha nodeSetBootOrder $fuelNodeId "iso disk"
23 error_exit "No way to install Fuel node"
27 dha nodeEjectIso $fuelNodeId
28 dha nodeInsertIso $fuelNodeId $isofile
31 dha nodePowerOn $fuelNodeId
33 # Switch back boot order to disk, hoping that node is now up
35 # FIXME: Can we do a smarter and more generic detection of when the
36 # FIXME: kickstart procedure has started? Then th dha_waitForIsoBoot
37 # FIXME: can be removed. Setting and IP already in the kickstart install
38 # FIXME: and ping-wait for that?
41 dha nodeSetBootOrder $fuelNodeId "disk iso"
44 echo "Waiting for Fuel master to accept SSH"
47 ssh root@${fuelIp} date 2>/dev/null
54 # Wait until fuelmenu is up
55 echo "Waiting for fuelmenu to come up"
57 while [ -z "$menuPid" ]
59 menuPid=`ssh root@${fuelIp} "ps -ef" 2>&1 | grep fuelmenu | grep -v grep | awk '{ print $2 }'`
63 # This is where we inject our own astute.yaml settings
64 scp -q $deafile root@${fuelIp}:. || error_exit "Could not copy DEA file to Fuel"
65 echo "Uploading build tools to Fuel server"
66 ssh root@${fuelIp} rm -rf tools || error_exit "Error cleaning old tools structure"
67 scp -qrp $topdir/tools root@${fuelIp}:. || error_exit "Error copying tools"
68 echo "Running transplant #0"
69 ssh root@${fuelIp} "cd tools; ./transplant0.sh ../`basename $deafile`" \
70 || error_exit "Error running transplant sequence #0"
74 # Let the Fuel deployment continue
75 echo "Found menu as PID $menuPid, now killing it"
76 ssh root@${fuelIp} "kill $menuPid" 2>/dev/null
78 # Wait until installation complete
79 echo "Waiting for bootstrap of Fuel node to complete"
82 ssh root@${fuelIp} "ps -ef" 2>/dev/null \
83 | grep -q /usr/local/sbin/bootstrap_admin_node
90 echo "Waiting for one minute for Fuel to stabilize"