From af15d35414abea1e0dd9792d3fffcffab47afc1c Mon Sep 17 00:00:00 2001 From: Arata Notsu Date: Fri, 11 Oct 2013 21:56:56 +0900 Subject: [PATCH] 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 --- lib/baremetal | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/baremetal b/lib/baremetal index 52af420853..f4d8589628 100644 --- a/lib/baremetal +++ b/lib/baremetal @@ -449,8 +449,10 @@ function add_baremetal_node() { "$mac_1" \ | grep ' id ' | get_field 2 ) [ $? -eq 0 ] || [ "$id" ] || die $LINENO "Error adding baremetal node" - id2=$(nova baremetal-interface-add "$id" "$mac_2" ) - [ $? -eq 0 ] || [ "$id2" ] || die $LINENO "Error adding interface to barmetal node $id" + if [ -n "$mac_2" ]; then + id2=$(nova baremetal-interface-add "$id" "$mac_2" ) + [ $? -eq 0 ] || [ "$id2" ] || die $LINENO "Error adding interface to barmetal node $id" + fi }