@@ -255,7 +255,7 @@ public Network implement(Network network, NetworkOffering offering, DeployDestin
255255 VpcDetailVO detail = _vpcDetailsDao .findDetail (network .getVpcId (), NuageVspManager .nuageDomainTemplateDetailName );
256256 if (detail != null && network .getNetworkACLId () != null ) {
257257 s_logger .error ("Pre-configured DT are used in combination with ACL lists. Which is not supported." );
258- throw new IllegalArgumentException ("CloudStack ACLs are not supported with Nuage Preconfigured Domain Template" );
258+ throw new IllegalArgumentException ("CloudStack ACLs are not supported with Nuage Pre-configured Domain Template" );
259259 }
260260
261261 if (detail != null && !_nuageVspManager .checkIfDomainTemplateExist (network .getDomainId (),detail .getValue (),network .getDataCenterId (),null )){
@@ -302,7 +302,9 @@ public Network implement(Network network, NetworkOffering offering, DeployDestin
302302 implemented .setCidr (network .getCidr ());
303303 }
304304
305- VspNetwork vspNetwork = _nuageVspEntityBuilder .buildVspNetwork (implemented , true );
305+ implemented .setBroadcastUri (_nuageVspManager .calculateBroadcastUri (implemented ));
306+ implemented .setBroadcastDomainType (Networks .BroadcastDomainType .Vsp );
307+ VspNetwork vspNetwork = _nuageVspEntityBuilder .buildVspNetwork (implemented );
306308
307309 if (vspNetwork .isShared ()) {
308310 Boolean previousUnderlay = null ;
@@ -321,11 +323,6 @@ public Network implement(Network network, NetworkOffering offering, DeployDestin
321323 }
322324 }
323325
324- String tenantId = context .getDomain ().getName () + "-" + context .getAccount ().getAccountId ();
325- String broadcastUriStr = implemented .getUuid () + "/" + vspNetwork .getVirtualRouterIp ();
326- implemented .setBroadcastUri (Networks .BroadcastDomainType .Vsp .toUri (broadcastUriStr ));
327- implemented .setBroadcastDomainType (Networks .BroadcastDomainType .Vsp );
328-
329326 boolean implementSucceeded = implement (network .getVpcId (), physicalNetworkId , vspNetwork , implemented , _nuageVspEntityBuilder .buildNetworkDhcpOption (network , offering ));
330327
331328 if (!implementSucceeded ) {
@@ -340,6 +337,7 @@ public Network implement(Network network, NetworkOffering offering, DeployDestin
340337 }
341338 }
342339
340+ String tenantId = context .getDomain ().getName () + "-" + context .getAccount ().getAccountId ();
343341 s_logger .info ("Implemented OK, network " + implemented .getUuid () + " in tenant " + tenantId + " linked to " + implemented .getBroadcastUri ());
344342 } finally {
345343 _networkDao .releaseFromLockTable (network .getId ());
@@ -430,7 +428,7 @@ private static Map<String, String> constructVpcDetails(NetworkRelatedVsdIds netw
430428 public NicProfile allocate (Network network , NicProfile nic , VirtualMachineProfile vm ) throws InsufficientVirtualNetworkCapacityException , InsufficientAddressCapacityException {
431429 if (vm .getType () != VirtualMachine .Type .DomainRouter && _nuageVspEntityBuilder .usesVirtualRouter (network .getNetworkOfferingId ())) {
432430 VspNetwork vspNetwork = _nuageVspEntityBuilder .buildVspNetwork (network );
433- if (nic != null && nic .getRequestedIPv4 () != null && vspNetwork . getVirtualRouterIp ().equals (nic . getRequestedIPv4 ())) {
431+ if (nic != null && nic .getRequestedIPv4 () != null && nic . getRequestedIPv4 ().equals (vspNetwork . getVirtualRouterIp ())) {
434432 DataCenter dc = _dcDao .findById (network .getDataCenterId ());
435433 s_logger .error ("Unable to acquire requested Guest IP address " + nic .getRequestedIPv4 () + " because it is reserved for the VR in network " + network );
436434 throw new InsufficientVirtualNetworkCapacityException ("Unable to acquire requested Guest IP address " + nic .getRequestedIPv4 () + " because it is reserved " +
@@ -470,14 +468,13 @@ public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, D
470468 HostVO nuageVspHost = _nuageVspManager .getNuageVspHost (network .getPhysicalNetworkId ());
471469 VspNetwork vspNetwork = _nuageVspEntityBuilder .buildVspNetwork (vm .getVirtualMachine ().getDomainId (), network );
472470
473- if (vm .getType () == VirtualMachine .Type .DomainRouter && vspNetwork .getVirtualRouterIp ().equals ("null" )) {
474- //In case of upgrade network offering
475- vspNetwork = _nuageVspEntityBuilder .buildVspNetwork (vm .getVirtualMachine ().getDomainId (), network , null , true );
476- String broadcastUriStr = network .getUuid () + "/" + vspNetwork .getVirtualRouterIp ();
477- NetworkVO updatedNetwork = _networkDao .createForUpdate (network .getId ());
478- updatedNetwork .setBroadcastUri (Networks .BroadcastDomainType .Vsp .toUri (broadcastUriStr ));
479- _networkDao .update (updatedNetwork .getId (), updatedNetwork );
471+ boolean vrAddedToNuage = vm .getType () == VirtualMachine .Type .DomainRouter && vspNetwork .getVirtualRouterIp ()
472+ .equals ("null" );
473+ if (vrAddedToNuage ) {
474+ //In case a VR is added due to upgrade network offering - recalculate the broadcast uri before using it.
475+ _nuageVspManager .updateBroadcastUri (network );
480476 network = _networkDao .findById (network .getId ());
477+ vspNetwork = _nuageVspEntityBuilder .buildVspNetwork (vm .getVirtualMachine ().getDomainId (), network , null );
481478 }
482479
483480 if (vspNetwork .isShared ()) {
0 commit comments