@@ -174,7 +174,7 @@ public boolean sendCommandsToRouter(final VirtualRouter router, final Commands c
174174 throw new AgentUnavailableException ("Unable to send commands to virtual router " , router .getHostId (), e );
175175 }
176176
177- if (answers == null || answers .length != cmds .size ()) {
177+ if (( answers == null ) || ( answers .length != cmds .size () )) {
178178 return false ;
179179 }
180180
@@ -195,7 +195,7 @@ public void handleSingleWorkingRedundantRouter(final List<? extends VirtualRoute
195195 if (connectedRouters .isEmpty () || disconnectedRouters .isEmpty ()) {
196196 return ;
197197 }
198- if (connectedRouters .size () != 1 || disconnectedRouters .size () != 1 ) {
198+ if (( connectedRouters .size () != 1 ) || ( disconnectedRouters .size () != 1 ) ) {
199199 s_logger .warn ("How many redundant routers do we have?? " );
200200 return ;
201201 }
@@ -240,12 +240,6 @@ public void handleSingleWorkingRedundantRouter(final List<? extends VirtualRoute
240240 }
241241 }
242242
243- /*
244- * (non-Javadoc)
245- *
246- * @see com.cloud.network.router.NetworkHelper#getRealPriority(com.cloud.vm.
247- * DomainRouterVO)
248- */
249243 @ Override
250244 public int getRealPriority (final DomainRouterVO router ) {
251245 int priority = router .getPriority ();
@@ -255,28 +249,13 @@ public int getRealPriority(final DomainRouterVO router) {
255249 return priority ;
256250 }
257251
258- // @Override
259- /*
260- * (non-Javadoc)
261- *
262- * @see
263- * com.cloud.network.router.NetworkHelper#getNicTO(com.cloud.network.router
264- * .VirtualRouter, java.lang.Long, java.lang.String)
265- */
266252 @ Override
267253 public NicTO getNicTO (final VirtualRouter router , final Long networkId , final String broadcastUri ) {
268254 NicProfile nicProfile = _networkModel .getNicProfile (router , networkId , broadcastUri );
269255
270256 return _itMgr .toNicTO (nicProfile , router .getHypervisorType ());
271257 }
272258
273- // @Override
274- /*
275- * (non-Javadoc)
276- *
277- * @see com.cloud.network.router.NetworkHelper#destroyRouter(long,
278- * com.cloud.user.Account, java.lang.Long)
279- */
280259 @ Override
281260 public VirtualRouter destroyRouter (final long routerId , final Account caller , final Long callerUserId ) throws ResourceUnavailableException , ConcurrentOperationException {
282261
@@ -296,14 +275,6 @@ public VirtualRouter destroyRouter(final long routerId, final Account caller, fi
296275 return router ;
297276 }
298277
299- /*
300- * (non-Javadoc)
301- *
302- * @see
303- * com.cloud.network.router.NetworkHelper#checkRouterVersion(com.cloud.network
304- * .router.VirtualRouter)
305- */
306- // @Override
307278 @ Override
308279 public boolean checkRouterVersion (final VirtualRouter router ) {
309280 if (!VirtualNetworkApplianceManagerImpl .routerVersionCheckEnabled .value ()) {
@@ -370,16 +341,16 @@ protected DomainRouterVO waitRouter(final DomainRouterVO router) {
370341
371342 @ Override
372343 public List <DomainRouterVO > startRouters (final RouterDeploymentDefinition routerDeploymentDefinition ) throws StorageUnavailableException , InsufficientCapacityException ,
373- ConcurrentOperationException , ResourceUnavailableException {
344+ ConcurrentOperationException , ResourceUnavailableException {
374345
375346 List <DomainRouterVO > runningRouters = new ArrayList <DomainRouterVO >();
376347
377348 for (DomainRouterVO router : routerDeploymentDefinition .getRouters ()) {
378349 boolean skip = false ;
379350 final State state = router .getState ();
380- if (router .getHostId () != null && state != State .Running ) {
351+ if (( router .getHostId () != null ) && ( state != State .Running ) ) {
381352 final HostVO host = _hostDao .findById (router .getHostId ());
382- if (host == null || host .getState () != Status .Up ) {
353+ if (( host == null ) || ( host .getState () != Status .Up ) ) {
383354 skip = true ;
384355 }
385356 }
@@ -399,7 +370,7 @@ public List<DomainRouterVO> startRouters(final RouterDeploymentDefinition router
399370 public DomainRouterVO startVirtualRouter (final DomainRouterVO router , final User user , final Account caller , final Map <Param , Object > params )
400371 throws StorageUnavailableException , InsufficientCapacityException , ConcurrentOperationException , ResourceUnavailableException {
401372
402- if (router .getRole () != Role .VIRTUAL_ROUTER || !router .getIsRedundantRouter ()) {
373+ if (( router .getRole () != Role .VIRTUAL_ROUTER ) || !router .getIsRedundantRouter ()) {
403374 return start (router , user , caller , params , null );
404375 }
405376
@@ -429,7 +400,7 @@ public DomainRouterVO startVirtualRouter(final DomainRouterVO router, final User
429400 if (networkIds .size () != 0 ) {
430401 final List <DomainRouterVO > routerList = _routerDao .findByNetwork (networkIds .get (0 ));
431402 for (final DomainRouterVO rrouter : routerList ) {
432- if (rrouter .getHostId () != null && rrouter .getIsRedundantRouter () && rrouter .getState () == State .Running ) {
403+ if (( rrouter .getHostId () != null ) && rrouter .getIsRedundantRouter () && ( rrouter .getState () == State .Running ) ) {
433404 if (routerToBeAvoid != null ) {
434405 throw new ResourceUnavailableException ("Try to start router " + router .getInstanceName () + "(" + router .getId () + ")"
435406 + ", but there are already two redundant routers with IP " + router .getPublicIpAddress () + ", they are " + rrouter .getInstanceName () + "("
@@ -452,7 +423,7 @@ public DomainRouterVO startVirtualRouter(final DomainRouterVO router, final User
452423 avoids [1 ].addCluster (_hostDao .findById (routerToBeAvoid .getHostId ()).getClusterId ());
453424 avoids [2 ] = new ExcludeList ();
454425 final List <VolumeVO > volumes = _volumeDao .findByInstanceAndType (routerToBeAvoid .getId (), Volume .Type .ROOT );
455- if (volumes != null && volumes .size () != 0 ) {
426+ if (( volumes != null ) && ( volumes .size () != 0 ) ) {
456427 avoids [2 ].addPool (volumes .get (0 ).getPoolId ());
457428 }
458429 avoids [2 ].addHost (routerToBeAvoid .getHostId ());
@@ -499,7 +470,7 @@ protected String retrieveTemplateName(final HypervisorType hType, final long dat
499470
500471 @ Override
501472 public DomainRouterVO deployRouter (final RouterDeploymentDefinition routerDeploymentDefinition , final boolean startRouter ) throws InsufficientAddressCapacityException ,
502- InsufficientServerCapacityException , InsufficientCapacityException , StorageUnavailableException , ResourceUnavailableException {
473+ InsufficientServerCapacityException , InsufficientCapacityException , StorageUnavailableException , ResourceUnavailableException {
503474
504475 final ServiceOfferingVO routerOffering = _serviceOfferingDao .findById (routerDeploymentDefinition .getOfferingId ());
505476 final Account owner = routerDeploymentDefinition .getOwner ();
@@ -553,7 +524,7 @@ public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploy
553524 _itMgr .allocate (router .getInstanceName (), template , routerOffering , networks , routerDeploymentDefinition .getPlan (), null );
554525 router = _routerDao .findById (router .getId ());
555526 } catch (final InsufficientCapacityException ex ) {
556- if (allocateRetry < 2 && iter .hasNext ()) {
527+ if (( allocateRetry < 2 ) && iter .hasNext ()) {
557528 s_logger .debug ("Failed to allocate the VR with hypervisor type " + hType + ", retrying one more time" );
558529 continue ;
559530 } else {
@@ -568,7 +539,7 @@ public DomainRouterVO deployRouter(final RouterDeploymentDefinition routerDeploy
568539 router = startVirtualRouter (router , _accountMgr .getSystemUser (), _accountMgr .getSystemAccount (), routerDeploymentDefinition .getParams ());
569540 break ;
570541 } catch (final InsufficientCapacityException ex ) {
571- if (startRetry < 2 && iter .hasNext ()) {
542+ if (( startRetry < 2 ) && iter .hasNext ()) {
572543 s_logger .debug ("Failed to start the VR " + router + " with hypervisor type " + hType + ", " + "destroying it and recreating one more time" );
573544 // destroy the router
574545 destroyRouter (router .getId (), _accountMgr .getAccount (Account .ACCOUNT_ID_SYSTEM ), User .UID_SYSTEM );
@@ -637,12 +608,12 @@ protected List<HypervisorType> getHypervisors(final RouterDeploymentDefinition r
637608 protected HypervisorType getClusterToStartDomainRouterForOvm (final long podId ) {
638609 final List <ClusterVO > clusters = _clusterDao .listByPodId (podId );
639610 for (final ClusterVO cv : clusters ) {
640- if (cv .getHypervisorType () == HypervisorType .Ovm || cv .getHypervisorType () == HypervisorType .BareMetal ) {
611+ if (( cv .getHypervisorType () == HypervisorType .Ovm ) || ( cv .getHypervisorType () == HypervisorType .BareMetal ) ) {
641612 continue ;
642613 }
643614
644615 final List <HostVO > hosts = _resourceMgr .listAllHostsInCluster (cv .getId ());
645- if (hosts == null || hosts .isEmpty ()) {
616+ if (( hosts == null ) || hosts .isEmpty ()) {
646617 continue ;
647618 }
648619
@@ -674,13 +645,14 @@ public LinkedHashMap<Network, List<? extends NicProfile>> createRouterNetworks(f
674645 if (!routerDeploymentDefinition .isPublicNetwork ()) {
675646 final Nic placeholder = _networkModel .getPlaceholderNicForRouter (routerDeploymentDefinition .getGuestNetwork (), routerDeploymentDefinition .getPodId ());
676647 if (routerDeploymentDefinition .getGuestNetwork ().getCidr () != null ) {
677- if (placeholder != null && placeholder .getIp4Address () != null ) {
648+ if (( placeholder != null ) && ( placeholder .getIp4Address () != null ) ) {
678649 s_logger .debug ("Requesting ipv4 address " + placeholder .getIp4Address () + " stored in placeholder nic for the network "
679650 + routerDeploymentDefinition .getGuestNetwork ());
680651 defaultNetworkStartIp = placeholder .getIp4Address ();
681652 } else {
682653 final String startIp = _networkModel .getStartIpAddress (routerDeploymentDefinition .getGuestNetwork ().getId ());
683- if (startIp != null && _ipAddressDao .findByIpAndSourceNetworkId (routerDeploymentDefinition .getGuestNetwork ().getId (), startIp ).getAllocatedTime () == null ) {
654+ if ((startIp != null )
655+ && (_ipAddressDao .findByIpAndSourceNetworkId (routerDeploymentDefinition .getGuestNetwork ().getId (), startIp ).getAllocatedTime () == null )) {
684656 defaultNetworkStartIp = startIp ;
685657 } else if (s_logger .isDebugEnabled ()) {
686658 s_logger .debug ("First ipv4 " + startIp + " in network id=" + routerDeploymentDefinition .getGuestNetwork ().getId ()
@@ -690,13 +662,13 @@ public LinkedHashMap<Network, List<? extends NicProfile>> createRouterNetworks(f
690662 }
691663
692664 if (routerDeploymentDefinition .getGuestNetwork ().getIp6Cidr () != null ) {
693- if (placeholder != null && placeholder .getIp6Address () != null ) {
665+ if (( placeholder != null ) && ( placeholder .getIp6Address () != null ) ) {
694666 s_logger .debug ("Requesting ipv6 address " + placeholder .getIp6Address () + " stored in placeholder nic for the network "
695667 + routerDeploymentDefinition .getGuestNetwork ());
696668 defaultNetworkStartIpv6 = placeholder .getIp6Address ();
697669 } else {
698670 final String startIpv6 = _networkModel .getStartIpv6Address (routerDeploymentDefinition .getGuestNetwork ().getId ());
699- if (startIpv6 != null && _ipv6Dao .findByNetworkIdAndIp (routerDeploymentDefinition .getGuestNetwork ().getId (), startIpv6 ) == null ) {
671+ if (( startIpv6 != null ) && ( _ipv6Dao .findByNetworkIdAndIp (routerDeploymentDefinition .getGuestNetwork ().getId (), startIpv6 ) == null ) ) {
700672 defaultNetworkStartIpv6 = startIpv6 ;
701673 } else if (s_logger .isDebugEnabled ()) {
702674 s_logger .debug ("First ipv6 " + startIpv6 + " in network id=" + routerDeploymentDefinition .getGuestNetwork ().getId ()
0 commit comments