Browse code

baremetal: Allow BM_SECOND_MAC to be unset

Currently DevStack registers the second nic of the baremetal
node even if BM_SECOND_MAC is not set or empty. However
an interface with an empty mac address causes dhcp to fail
(bug 1238595). And such operation will get to return a error
after the bug is resolved. So we should not register the
second nic if BM_SECOND_MAC is not set.

Related-Bug: #1238595
Change-Id: Ib3cc77686b72311403ccacbd70ae9cf43e6eb4c9

Arata Notsu authored on 2013/10/11 21:56:56
Showing 1 changed files
... ...
@@ -449,8 +449,10 @@ function add_baremetal_node() {
449 449
        "$mac_1" \
450 450
        | grep ' id ' | get_field 2 )
451 451
     [ $? -eq 0 ] || [ "$id" ] || die $LINENO "Error adding baremetal node"
452
-    id2=$(nova baremetal-interface-add "$id" "$mac_2" )
453
-    [ $? -eq 0 ] || [ "$id2" ] || die $LINENO "Error adding interface to barmetal node $id"
452
+    if [ -n "$mac_2" ]; then
453
+        id2=$(nova baremetal-interface-add "$id" "$mac_2" )
454
+        [ $? -eq 0 ] || [ "$id2" ] || die $LINENO "Error adding interface to barmetal node $id"
455
+    fi
454 456
 }
455 457
 
456 458