Merge "Add ability to write CSV file"
This commit is contained in:
commit
1dbbec87b4
@ -17,6 +17,9 @@
|
|||||||
# # Create 3 nodes with base name of 'junk'
|
# # Create 3 nodes with base name of 'junk'
|
||||||
# sudo NODEBASE=junk NODECOUNT=3 create_nodes.sh
|
# sudo NODEBASE=junk NODECOUNT=3 create_nodes.sh
|
||||||
#
|
#
|
||||||
|
# # Write out the csv file
|
||||||
|
# sudo OUTFILE=/path/to/file.csv create_nodes.sh
|
||||||
|
#
|
||||||
# THANKS
|
# THANKS
|
||||||
# Thanks to the author(s) of the Ironic supporting code within devstack,
|
# Thanks to the author(s) of the Ironic supporting code within devstack,
|
||||||
# from which all of this is derived.
|
# from which all of this is derived.
|
||||||
@ -47,7 +50,6 @@ VM_LOGDIR=/var/log/libvirt/baremetal_logs
|
|||||||
|
|
||||||
CSV_OUTPUT="CSV entries:"
|
CSV_OUTPUT="CSV entries:"
|
||||||
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
# FUNCTION
|
# FUNCTION
|
||||||
# create_node
|
# create_node
|
||||||
@ -213,12 +215,19 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CSV_LINES=()
|
||||||
|
IFS=$'\n'
|
||||||
for (( i=1; i<=${NODECOUNT}; i++ ))
|
for (( i=1; i<=${NODECOUNT}; i++ ))
|
||||||
do
|
do
|
||||||
name=${NODEBASE}${i}
|
name=${NODEBASE}${i}
|
||||||
mac=$(create_node $name $VM_CPU $VM_RAM $VM_DISK amd64 $VM_NET_BRIDGE $VM_EMULATOR $VM_LOGDIR)
|
mac=$(create_node $name $VM_CPU $VM_RAM $VM_DISK amd64 $VM_NET_BRIDGE $VM_EMULATOR $VM_LOGDIR)
|
||||||
|
|
||||||
CSV_OUTPUT="${CSV_OUTPUT}\n$mac,root,undefined,192.168.122.1,$VM_CPU,$VM_RAM,$VM_DISK,flavor,type,a8cb6624-0d9f-c882-affc-046ebb96ec0${i},$name,192.168.122.$((i+1))"
|
CSV_LINES+=("$mac,root,undefined,192.168.122.1,$VM_CPU,$VM_RAM,$VM_DISK,flavor,type,a8cb6624-0d9f-c882-affc-046ebb96ec0${i},$name,192.168.122.$((i+1))")
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -e "${CSV_OUTPUT}"
|
echo ${CSV_OUTPUT}
|
||||||
|
echo -e "${CSV_LINES[*]}"
|
||||||
|
|
||||||
|
if [ $OUTFILE ]; then
|
||||||
|
echo -e "${CSV_LINES[*]}" > $OUTFILE
|
||||||
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user