}
function make_bm_hosts {
- while IFS=',' read -r name ipmi_username ipmi_password ipmi_address os_username os_password os_image_name; do
+ while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do
create_userdata $name $os_username $os_password
apply_userdata_credential $name
create_networkdata $name
-address "ipmi://$ipmi_address" \
-password "$ipmi_password" \
-user "$ipmi_username" \
+ -boot-mac "$boot_mac" \
"$name" > $name-bm-node.yaml
printf " image:" >> $name-bm-node.yaml
}
function remove_bm_hosts {
- while IFS=',' read -r name ipmi_username ipmi_password ipmi_address os_username os_password os_image_name; do
+ while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do
deprovision_compute_node $name
done
}
function cleanup {
- while IFS=',' read -r name ipmi_username ipmi_password ipmi_address os_username os_password os_image_name; do
+ while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do
kubectl delete --ignore-not-found=true bmh $name -n metal3
kubectl delete --ignore-not-found=true secrets $name-bmc-secret -n metal3
kubectl delete --ignore-not-found=true secrets $name-user-data -n metal3
declare -i prev_host_state=0
declare -i j=0
echo "Baremetal state: 1 means provisioned & 0 means not yet provisioned"
- while IFS=',' read -r name ipmi_username ipmi_password ipmi_address os_username os_password os_image_name; do
+ while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do
declare -i current_host_state=0
state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state')
echo "Baremetal host metal3 state - "$name" : "$state
declare -i prev_host_state=0
declare -i j=0
echo "Baremetal state: 1 means deprovisioned & 0 means not yet deprovisioned"
- while IFS=',' read -r name ipmi_username ipmi_password ipmi_address os_username os_password os_image_name; do
+ while IFS=',' read -r name ipmi_username ipmi_password ipmi_address boot_mac os_username os_password os_image_name; do
declare -i current_host_state=0
if kubectl get baremetalhost $name -n metal3 &>/dev/null; then
state=$(kubectl get baremetalhosts $name -n metal3 -o json | jq -r '.status.provisioning.state')
exit 1
fi
- cat "$NODES_FILE" | \
- jq -r '.nodes[] | [
- .name,
- .ipmi_driver_info.username,
- .ipmi_driver_info.password,
- .ipmi_driver_info.address,
- .os.username,
- .os.password,
- .os.image_name
- ] | @csv' | \
- sed 's/"//g'
+ # The boot MAC address must be specified when a port is included
+ # in the IPMI driver address (i.e when using the VirtualBMC
+ # controller). Note that the below is a bit of a hack as it only
+ # checks the first entry in NODES_FILE for the port.
+ if cat "$NODES_FILE" |
+ jq -r '.nodes[0].ipmi_driver_info.address' | grep -c ':[0-9]\+$' >/dev/null; then
+ BOOT_LINK=$(cat "$NODES_FILE" |
+ jq -r '.nodes[0].net.links | map(.id=="provisioning_nic") | index(true)')
+ cat "$NODES_FILE" |
+ jq -r --argjson BOOT_LINK $BOOT_LINK '.nodes[] | [
+ .name,
+ .ipmi_driver_info.username,
+ .ipmi_driver_info.password,
+ .ipmi_driver_info.address,
+ .net.links[$BOOT_LINK].ethernet_mac_address,
+ .os.username,
+ .os.password,
+ .os.image_name
+ ] | @csv' |
+ sed 's/"//g'
+ else
+ cat "$NODES_FILE" |
+ jq -r '.nodes[] | [
+ .name,
+ .ipmi_driver_info.username,
+ .ipmi_driver_info.password,
+ .ipmi_driver_info.address,
+ "",
+ .os.username,
+ .os.password,
+ .os.image_name
+ ] | @csv' |
+ sed 's/"//g'
+ fi
}
function node_networkdata {