Commit e19aa98e authored by Dan Reading's avatar Dan Reading
Browse files

Handle case where HD serial number not in inventory files. Add/Delete dubugging code.

parent 578c9ad5
...@@ -157,7 +157,7 @@ gentbsql_main() { ...@@ -157,7 +157,7 @@ gentbsql_main() {
# we need a diff file that has SN in it, check the .diff directory # we need a diff file that has SN in it, check the .diff directory
# for the info # for the info
# so try and find the SN in any .full/* file with serial numbers # so try and find the SN in any .full/* file with serial numbers
echo "# $(pwd)" # debugging echo "# $(pwd)"
dotDiffFiles=$(ls -t .diff) dotDiffFiles=$(ls -t .diff)
for dDF in $dotDiffFiles ; do for dDF in $dotDiffFiles ; do
SNinfo=$(grep 'DISKs:' .diff/$dDF | grep -v UNKNOWN) SNinfo=$(grep 'DISKs:' .diff/$dDF | grep -v UNKNOWN)
...@@ -257,7 +257,7 @@ gentbsql_main() { ...@@ -257,7 +257,7 @@ gentbsql_main() {
found_blockstoreattr_idx=$(get_sn_from_bsidx $found_blockstores_idx) found_blockstoreattr_idx=$(get_sn_from_bsidx $found_blockstores_idx)
if [ "$found_blockstores_idx" ] ; then if [ "$found_blockstores_idx" ] ; then
echo -n "# drive${hdnum} already used @ $found_blockstores_idx" echo -n "# $host drive${hdnum} already used @ bsidx=$found_blockstores_idx"
break break
else else
echo "# drive${hdnum} already used, bumping hdnum again" echo "# drive${hdnum} already used, bumping hdnum again"
...@@ -297,16 +297,16 @@ gentbsql_main() { ...@@ -297,16 +297,16 @@ gentbsql_main() {
if [ "$i" == "UNKNOWN" ] ; then if [ "$i" == "UNKNOWN" ] ; then
x=$(get_bsidx_from_hostAnddrive $host ${hdnum}) x=$(get_bsidx_from_hostAnddrive $host ${hdnum})
if [ -n "$x" ] ; then if [ -n "$x" ] ; then
echo -n "# Missing Serial Number for disk${hdnum} on $host" echo -n "# Can not locate Serial Number for disk${hdnum} on $host"
# so try and find the SN in any .full/* file with serial numbers # so try and find the SN in any .full/* file with serial numbers
pwd
dotFullFiles=$(ls .full) dotFullFiles=$(ls .full)
for dFF in $dotFullFiles ; do for dFF in $dotFullFiles ; do
SNinfo=$(grep -v 'SN="UNKNOWN"' .full/$dFF | grep DISKUNIT) SNinfo=$(grep -v 'SN="UNKNOWN"' .full/$dFF | grep DISKUNIT)
[[ $SNinfo ]] && break # found some stop [[ $SNinfo ]] && break # found some stop
done done
exit
echo " but found $(get_drive_from_bsidx $x) $(get_host_from_bsidx $x) @ bsidx=$x SN=$(get_sn_from_bsidx $x)" echo " but found $(get_drive_from_bsidx $x) $(get_host_from_bsidx $x) @ bsidx=$x SN=$(get_sn_from_bsidx $x)"
else
echo ""
fi fi
((++hdnum)) ((++hdnum))
else else
...@@ -338,7 +338,7 @@ gentbsql_main() { ...@@ -338,7 +338,7 @@ gentbsql_main() {
printf "#BYHAND mysql -e \"insert into interfaces set node_id='%s',mac='%s',card=X,port=X,interface_type='?',iface='ethX',role='?',uuid='$uuid';\" tbdb\n" "$host" "$toadd" printf "#BYHAND mysql -e \"insert into interfaces set node_id='%s',mac='%s',card=X,port=X,interface_type='?',iface='ethX',role='?',uuid='$uuid';\" tbdb\n" "$host" "$toadd"
else else
toadd="ID=\"$i\"" toadd="ID=\"$i\""
printf "#BYHAND mysql -e \"delete from interfaces where node_id='%s' and %s;\" tbdb\n" "$host" "$toadd" # printf "#BYHAND mysql -e \"delete from interfaces where node_id='%s' and %s;\" tbdb\n" "$host" "$toadd"
fi fi
done done
else else
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment