Skip to content

Commit 4f889bd

Browse files
author
Sheng Yang
committed
CLOUDSTACK-985: Make sure RvR would always have same MAC address
Even with newly created RvR using "restartNetwork&cleanup=false" API.
1 parent c32dbec commit 4f889bd

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,13 @@ protected List<Pair<NetworkVO, NicProfile>> createRouterNetworks(Account owner,
16991699
}
17001700
NetworkOfferingVO publicOffering = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemPublicNetwork).get(0);
17011701
List<NetworkVO> publicNetworks = _networkMgr.setupNetwork(_systemAcct, publicOffering, plan, null, null, false);
1702+
String publicIp = defaultNic.getIp4Address();
1703+
// We want to use the identical MAC address for RvR on public interface if possible
1704+
NicVO peerNic = _nicDao.findByIp4AddressAndNetworkId(publicIp, publicNetworks.get(0).getId());
1705+
if (peerNic != null) {
1706+
s_logger.info("Use same MAC as previous RvR, the MAC is " + peerNic.getMacAddress());
1707+
defaultNic.setMacAddress(peerNic.getMacAddress());
1708+
}
17021709
networks.add(new Pair<NetworkVO, NicProfile>(publicNetworks.get(0), defaultNic));
17031710
}
17041711

0 commit comments

Comments
 (0)