Skip to content

Commit 7e4c8df

Browse files
committed
NSX: Fix VR public NIC allocation
1 parent 20cb9f5 commit 7e4c8df

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,10 @@ public void createTier1Gateway(String name, String tier0Gateway, String edgeClus
294294
public void deleteTier1Gateway(String tier1Id) {
295295
com.vmware.nsx_policy.infra.tier_1s.LocaleServices localeService = (com.vmware.nsx_policy.infra.tier_1s.LocaleServices)
296296
nsxService.apply(com.vmware.nsx_policy.infra.tier_1s.LocaleServices.class);
297+
if (getTier1Gateway(tier1Id) == null) {
298+
LOGGER.warn(String.format("The Tier 1 Gateway %s does not exist, cannot be removed", tier1Id));
299+
return;
300+
}
297301
removeTier1GatewayNatRules(tier1Id);
298302
localeService.delete(tier1Id, Tier_1_LOCALE_SERVICE_ID);
299303
Tier1s tier1service = (Tier1s) nsxService.apply(Tier1s.class);

server/src/main/java/com/cloud/network/router/VpcVirtualNetworkApplianceManagerImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,8 @@ public boolean finalizeCommandsOnStart(final Commands cmds, final VirtualMachine
387387
_routerDao.update(routerVO.getId(), routerVO);
388388
}
389389
}
390-
final PlugNicCommand plugNicCmd = new PlugNicCommand(_nwHelper.getNicTO(domainRouterVO, publicNic.getNetworkId(), publicNic.getBroadcastUri().toString()),
390+
String broadcastURI = publicNic.getBroadcastUri() != null ? publicNic.getBroadcastUri().toString() : null;
391+
final PlugNicCommand plugNicCmd = new PlugNicCommand(_nwHelper.getNicTO(domainRouterVO, publicNic.getNetworkId(), broadcastURI),
391392
domainRouterVO.getInstanceName(), domainRouterVO.getType(), details);
392393
cmds.addCommand(plugNicCmd);
393394
final VpcVO vpc = _vpcDao.findById(domainRouterVO.getVpcId());

0 commit comments

Comments
 (0)