-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add script to generate multiple fake nodes
- Loading branch information
Showing
7 changed files
with
125 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
# for node in $(jq -c '.[]' nodes.json); do | ||
# uuid=$(echo ${node} | jq -r '.uuid') | ||
# node_name=$(echo ${node} | jq -r '.name') | ||
# baremetal node create --driver redfish --driver-info \ | ||
# redfish_address=http://192.168.111.1:8000 --driver-info \ | ||
# redfish_system_id=/redfish/v1/Systems/${uuid} --driver-info \ | ||
# redfish_username=admin --driver-info redfish_password=password \ | ||
# --uuid ${uuid} \ | ||
# --name ${node_name} | ||
# done | ||
# | ||
# sleep 10 | ||
nodes=$(baremetal node list -f json) | ||
n_nodes=$(echo ${nodes} | jq -c '.[]' | wc -l) | ||
inspected_nodes="" | ||
while true; do | ||
nodes=$(baremetal node list -f json) | ||
for row in $(echo $nodes | jq -c -r '.[] | @base64'); do | ||
node=$(echo ${row} | base64 --decode) | ||
node_name=$(echo ${node} | jq -r '.Name') | ||
provisioning_state=$(echo ${node} | jq -r '."Provisioning State"') | ||
if [[ $provisioning_state == "enroll" ]]; then | ||
baremetal node manage ${node_name} | ||
continue | ||
fi | ||
if [[ $provisioning_state == "verifying" ]]; then | ||
continue | ||
fi | ||
power_state=$(echo ${node} | jq -r '."Power State"') | ||
if [[ $power_state == "power off" ]]; then | ||
baremetal node power on ${node_name} | ||
continue | ||
fi | ||
if [[ $provisioning_state == "inspect wait" ]]; then | ||
continue | ||
fi | ||
if [[ $provisioning_state == "manageable" ]]; then | ||
inspection_info=$(baremetal node show $node_name -f json | jq -r '.inspection_finished_at') | ||
if [[ $inspection_info == "null" ]]; then | ||
baremetal node inspect ${node_name} | ||
else | ||
if [[ $inspected_nodes == *$node_name* ]]; then | ||
continue | ||
fi | ||
inspected_nodes="${inspected_nodes} ${node_name}" | ||
echo "${node_name} was inspected at ${inspection_info}" | ||
if [[ $(echo $inspected_nodes | wc -w) == $n_nodes ]]; then | ||
exit 0 | ||
fi | ||
fi | ||
fi | ||
if [[ $provisioning_state == "inspect failed" ]]; then | ||
inspected_nodes="${inspected_nodes} ${node_name}" | ||
echo "Failed to inspect ${node_name}" | ||
if [[ $(echo $inspected_nodes | wc -w) == $n_nodes ]]; then | ||
exit 0 | ||
fi | ||
fi | ||
done | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
# | ||
NS="baremetal-operator-system" | ||
podName=$(kubectl -n $NS get pod -o json | jq -r '.items | .[].metadata.name' | grep "ironic" ) | ||
|
||
rm -f ironic.log | ||
kubectl -n $NS logs $podName -c ironic > ironic.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"uuid": "foo-uuid", | ||
"name": "foo-name", | ||
"power_state": "Off", | ||
"nics": [ | ||
{"mac": "foo-address", "ip": "172.0.0.100"} | ||
] | ||
} |