Skip to content

Commit

Permalink
Merge pull request #509 from manfrednde/bufix/IME-63-1.2.0
Browse files Browse the repository at this point in the history
IME-63 To allow Setting up two network devices. These devices can be …
  • Loading branch information
yyscamper committed Oct 24, 2016
2 parents 1ed6fa6 + 61e7d09 commit 6abc0ec
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
25 changes: 20 additions & 5 deletions data/templates/esx-ks
Expand Up @@ -34,6 +34,7 @@ rootpw <%=rootPlainPassword%>
reboot

%firstboot --interpreter=busybox

postLookup () {
echo "Attempting postLookup operation on $1" >> /vmfs/volumes/datastore1/firstboot.log
mac=`esxcli --debug --formatter=csv network ip interface list | grep $1 | awk -F, '{print $3}'`
Expand All @@ -47,7 +48,18 @@ postLookup () {
BODY=$BODY"}"
BODYLEN=$(echo -n ${BODY} | wc -c )
echo ${BODY} >> /vmfs/volumes/datastore1/firstboot.log
echo -ne "POST /api/1.1/lookups HTTP/1.0\r\nHost: $2\r\nContent-Type: application/json\r\nContent-Length: ${BODYLEN}\r\n\r\n${BODY}" | nc -i 3 <%=server%> <%=port%>
result=`echo -ne "POST /api/current/lookups HTTP/1.0\r\nHost: $2\r\nContent-Type: application/json\r\nContent-Length: ${BODYLEN}\r\n\r\n${BODY}" | nc -i 3 <%=server%> <%=port%> | grep -oE 'HTTP/1.1 [0-9]{3}' | awk '{print $2}'`
if [ "$result" -ge "400" ]; then
# Make an attempt to PATCH if we can find the node id. This is to handle the case where the
# ARP poller added the lookup entry when we tried to POST above causing a collision.
id=`wget http://<%=server%>:<%=port%>/api/current/lookups?q=$2 -qO - | grep -oE '\"id\":\"(.)*\"'`
if [ "$?" -eq "0" ]; then
id=`echo $id | awk -F: '{gsub(/"/,"",$2); print $2}'`
result=`echo -ne "PATCH /api/current/lookups/$id HTTP/1.0\r\nHost: $2\r\nContent-Type: application/json\r\nContent-Length: ${BODYLEN}\r\n\r\n${BODY}" | nc -i 3 <%=server%> <%=port%> | grep -oE 'HTTP/1.1 [0-9]{3}' | awk '{print $2}'`
echo "Patch result: $result to id: $id" >> /vmfs/volumes/datastore1/firstboot.log
fi
fi
wget http://<%=server%>:<%=port%>/api/current/lookups?q=$2 -qO - >> /vmfs/volumes/datastore1/firstboot.log
}

# enable VHV (Virtual Hardware Virtualization to run nested 64bit Guests + Hyper-V VM)
Expand Down Expand Up @@ -171,6 +183,9 @@ cp /var/log/esxi_install.log "/vmfs/volumes/datastore1/firstboot-esxi_install.lo
esxcli network ip interface remove -i <%=vmkname%>
esxcli network ip interface add -i <%=vmkname%> -p <%=n.device%>
esxcli network ip interface ipv4 set -i <%=vmkname%> -t dhcp
sleep 60
ip=`esxcli network ip interface ipv4 get | grep <%=vmkname%> | awk '{print $2}'`
postLookup <%=vmkname%> "$ip"
<% } %>
<% }); %>
<% } %>
Expand All @@ -181,10 +196,10 @@ cp /var/log/esxi_install.log "/vmfs/volumes/datastore1/firstboot-esxi_install.lo
<% }); %>
<% } %>

# signify ORA the installation completed, the 60s sleep is to wait for the LRU to timeout
# the stale entries that it latched prior to the lookups loading above being set. Without
# the sleep, the completionUri hit below will not publish to the correct AMQP channel
sleep 60
# signify ORA the installation completed, the 60s sleep is to wait for the LRU to timeout
# the stale entries that it latched prior to the lookups loading above being set. Without
# the sleep, the completionUri hit below will not publish to the correct AMQP channel
sleep 60

# Download the service to callback to RackHD after OS installation/reboot completion
# %firstboot ends with a reboot, this script will run afterwards to signify completion
Expand Down
7 changes: 5 additions & 2 deletions static/DSP8010_1.0.0/json-schema-oem/RackHD.BootImage.json
Expand Up @@ -17,7 +17,7 @@
"description": "This property shall specify a valid odata or Redfish property."
}
},
"additionalProperties": false,
"additionalProperties": true,
"properties": {
"rootSshKey": {
"type": "string"
Expand Down Expand Up @@ -132,6 +132,9 @@
},
"ipv6": {
"$ref": "http://redfish.dmtf.org/schemas/v1/RackHD.BootImage.json#/definitions/NetworkAddress"
},
"esxSwitchName": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -195,4 +198,4 @@
}
},
"copyright": "Copyright 2016 EMC, Inc."
}
}

0 comments on commit 6abc0ec

Please sign in to comment.