network_manager_main: add force-sync-mac option
For the platform has modulized flash (ex: Bletchley), the BMC flash is
not embedded on the board where the MAC address stored. When the
original board get replaced by service, BMC won't sync MAC address
again from new board because the first boot file is existed,and it
cause BMC continue using old MAC address form old board.
Add a force-sync-mac option to force check MAC address regardless first
boot file is exist or not.
Tested on Bletchley, MAC address updated after replacing chassis
controller board.
Signed-off-by: Potin Lai <potin.lai@quantatw.com>
Change-Id: I37785f25b3ce0d95d0dd7d9e2f1ad3cd731b83c7
diff --git a/src/network_manager_main.cpp b/src/network_manager_main.cpp
index 8f8a89e..80276b3 100644
--- a/src/network_manager_main.cpp
+++ b/src/network_manager_main.cpp
@@ -218,12 +218,15 @@
bool registeredSignals = false;
for (const auto& interfaceString : configJson.items())
{
- if (!std::filesystem::exists(firstBootPath + interfaceString.key()) &&
+ if ((FORCE_SYNC_MAC_FROM_INVENTORY ||
+ !std::filesystem::exists(firstBootPath + interfaceString.key())) &&
!registeredSignals)
{
-
- log<level::INFO>(
- "First boot file is not present, check VPD for MAC");
+ auto msg = fmt::format("{}, check VPD for MAC",
+ (FORCE_SYNC_MAC_FROM_INVENTORY)
+ ? "Force sync enabled"
+ : "First boot file is not present");
+ log<level::INFO>(msg.c_str());
EthInterfaceMatch = std::make_unique<sdbusplus::bus::match_t>(
bus,
"interface='org.freedesktop.DBus.ObjectManager',type='signal',"