@@ -3768,45 +3768,45 @@ public Network createPrivateNetwork(final String networkName, final String displ
37683768 return Transaction .execute (new TransactionCallbackWithException <Network , Exception >() {
37693769 @ Override
37703770 public Network doInTransaction (TransactionStatus status ) throws ResourceAllocationException , InsufficientCapacityException {
3771- //lock datacenter as we need to get mac address seq from there
3772- DataCenterVO dc = _dcDao .lockRow (pNtwk .getDataCenterId (), true );
3771+ //lock datacenter as we need to get mac address seq from there
3772+ DataCenterVO dc = _dcDao .lockRow (pNtwk .getDataCenterId (), true );
37733773
3774- //check if we need to create guest network
3774+ //check if we need to create guest network
37753775 Network privateNetwork = _networksDao .getPrivateNetwork (uriString , cidr , networkOwnerId , pNtwk .getDataCenterId (), networkOfferingId );
3776- if (privateNetwork == null ) {
3777- //create Guest network
3776+ if (privateNetwork == null ) {
3777+ //create Guest network
37783778 privateNetwork = _networkMgr .createGuestNetwork (ntwkOffFinal .getId (), networkName , displayText , gateway , cidr , uriString , null , owner , null , pNtwk ,
37793779 pNtwk .getDataCenterId (), ACLType .Account , null , vpcId , null , null , true , null );
3780- s_logger .debug ("Created private network " + privateNetwork );
3781- } else {
3782- s_logger .debug ("Private network already exists: " + privateNetwork );
3783- //Do not allow multiple private gateways with same Vlan within a VPC
3784- if (vpcId != null && vpcId .equals (privateNetwork .getVpcId ())) {
3785- throw new InvalidParameterValueException ("Private network for the vlan: " + uriString + " and cidr " + cidr + " already exists " + "for Vpc " + vpcId
3786- + " in zone " + _entityMgr .findById (DataCenter .class , pNtwk .getDataCenterId ()).getName ());
3787- }
3788- }
3780+ s_logger .debug ("Created private network " + privateNetwork );
3781+ } else {
3782+ s_logger .debug ("Private network already exists: " + privateNetwork );
3783+ //Do not allow multiple private gateways with same Vlan within a VPC
3784+ if (vpcId != null && vpcId .equals (privateNetwork .getVpcId ())) {
3785+ throw new InvalidParameterValueException ("Private network for the vlan: " + uriString + " and cidr " + cidr + " already exists " + "for Vpc " + vpcId
3786+ + " in zone " + _entityMgr .findById (DataCenter .class , pNtwk .getDataCenterId ()).getName ());
3787+ }
3788+ }
37893789
3790- //add entry to private_ip_address table
3791- PrivateIpVO privateIp = _privateIpDao .findByIpAndSourceNetworkIdAndVpcId (privateNetwork .getId (), startIp , vpcId );
3792- if (privateIp != null ) {
3790+ //add entry to private_ip_address table
3791+ PrivateIpVO privateIp = _privateIpDao .findByIpAndSourceNetworkIdAndVpcId (privateNetwork .getId (), startIp , vpcId );
3792+ if (privateIp != null ) {
37933793 throw new InvalidParameterValueException ("Private ip address " + startIp + " already used for private gateway" + " in zone "
37943794 + _entityMgr .findById (DataCenter .class , pNtwk .getDataCenterId ()).getName ());
3795- }
3795+ }
37963796
3797- Long mac = dc .getMacAddress ();
3798- Long nextMac = mac + 1 ;
3799- dc .setMacAddress (nextMac );
3797+ Long mac = dc .getMacAddress ();
3798+ Long nextMac = mac + 1 ;
3799+ dc .setMacAddress (nextMac );
38003800
3801- privateIp = new PrivateIpVO (startIp , privateNetwork .getId (), nextMac , vpcId , sourceNat );
3802- _privateIpDao .persist (privateIp );
3801+ privateIp = new PrivateIpVO (startIp , privateNetwork .getId (), nextMac , vpcId , sourceNat );
3802+ _privateIpDao .persist (privateIp );
38033803
3804- _dcDao .update (dc .getId (), dc );
3804+ _dcDao .update (dc .getId (), dc );
38053805
3806- s_logger .debug ("Private network " + privateNetwork + " is created" );
3806+ s_logger .debug ("Private network " + privateNetwork + " is created" );
38073807
3808- return privateNetwork ;
3809- }
3808+ return privateNetwork ;
3809+ }
38103810 });
38113811 } catch (Exception e ) {
38123812 ExceptionUtil .rethrowRuntime (e );
0 commit comments