JoaoJandre commented on code in PR #8742: URL: https://github.com/apache/cloudstack/pull/8742#discussion_r1567530831
########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -2519,10 +2443,7 @@ private void afterHypervisorMigrationCleanup(VMInstanceVO vm, Map<Volume, Storag setDestinationPoolAndReallocateNetwork(rootVolumePool, vm); Long destClusterId = rootVolumePool != null ? rootVolumePool.getClusterId() : null; if (destClusterId != null && !destClusterId.equals(sourceClusterId)) { - if(isDebugEnabled) { - String msg = String.format("Resetting lastHost for VM %s(%s)", vm.getInstanceName(), vm.getUuid()); - logger.debug(msg); - } + logger.debug("Resetting lastHost for VM %s(%s)", vm.getInstanceName(), vm.getUuid()); Review Comment: this won't work ########## engine/orchestration/src/main/java/com/cloud/agent/manager/ClusteredAgentManagerImpl.java: ########## @@ -335,17 +321,15 @@ protected boolean handleDisconnect(final AgentAttache agent, final Status.Event @Override public boolean executeUserRequest(final long hostId, final Event event) throws AgentUnavailableException { if (event == Event.AgentDisconnected) { - if (logger.isDebugEnabled()) { - logger.debug("Received agent disconnect event for host " + hostId); - } + logger.debug("Received agent disconnect event for host {}", hostId); final AgentAttache attache = findAttache(hostId); if (attache != null) { // don't process disconnect if the host is being rebalanced if (isAgentRebalanceEnabled()) { final HostTransferMapVO transferVO = _hostTransferDao.findById(hostId); if (transferVO != null) { if (transferVO.getFutureOwner() == _nodeId && transferVO.getState() == HostTransferState.TransferStarted) { - logger.debug("Not processing " + Event.AgentDisconnected + " event for the host id=" + hostId + " as the host is being connected to " + _nodeId); + logger.debug("Not processing {} event for the host id={} as the host is being connected to {}",Event.AgentDisconnected, hostId, _nodeId); Review Comment: ```suggestion logger.debug("Not processing {} event for the host id={} as the host is being connected to {}", Event.AgentDisconnected, hostId, _nodeId); ``` ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -2494,18 +2422,14 @@ private Answer[] attemptHypervisorMigration(VMInstanceVO vm, Map<Volume, Storage try { return _agentMgr.send(hostId, commandsContainer); } catch (AgentUnavailableException | OperationTimedoutException e) { - logger.warn(String.format("Hypervisor migration failed for the VM: %s", vm), e); + logger.warn("Hypervisor migration failed for the VM: {}", vm, e); } } return null; } private void afterHypervisorMigrationCleanup(VMInstanceVO vm, Map<Volume, StoragePool> volumeToPool, Long sourceClusterId, Answer[] hypervisorMigrationResults) throws InsufficientCapacityException { - boolean isDebugEnabled = logger.isDebugEnabled(); - if(isDebugEnabled) { - String msg = String.format("Cleaning up after hypervisor pool migration volumes for VM %s(%s)", vm.getInstanceName(), vm.getUuid()); - logger.debug(msg); - } + logger.debug("Cleaning up after hypervisor pool migration volumes for VM %s(%s)", vm.getInstanceName(), vm.getUuid()); Review Comment: this won't work ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -4329,9 +4219,7 @@ private boolean orchestrateRemoveVmFromNetwork(final VirtualMachine vm, final Ne return true; } finally { _nicsDao.releaseFromLockTable(lock.getId()); - if (logger.isDebugEnabled()) { - logger.debug("Lock is released for nic id " + lock.getId() + " as a part of remove vm " + vm + " from network " + network); - } + logger.debug("Lock is released for nic id " + lock.getId() + " as a part of remove vm " + vm + " from network " + network); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -61,34 +61,26 @@ public void processHostVmStateReport(long hostId, Map<String, HostVmStateReportE @Override public void processHostVmStatePingReport(long hostId, Map<String, HostVmStateReportEntry> report, boolean force) { - if (logger.isDebugEnabled()) - logger.debug("Process host VM state report from ping process. host: " + hostId); + logger.debug("Process host VM state report from ping process. host: " + hostId); Map<Long, VirtualMachine.PowerState> translatedInfo = convertVmStateReport(report); processReport(hostId, translatedInfo, force); } private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> translatedInfo, boolean force) { - if (logger.isDebugEnabled()) { - logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); - } + logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -158,24 +146,19 @@ private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> tra // between the startime of this job and the currentTime of this missing-branch // an update might have occurred that we should not override in case of out of band migration if (_instanceDao.updatePowerState(instance.getId(), hostId, VirtualMachine.PowerState.PowerReportMissing, startTime)) { - if (logger.isDebugEnabled()) { - logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + instance.getId() + ", power state: PowerReportMissing "); - } + logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + instance.getId() + ", power state: PowerReportMissing "); _messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, instance.getId()); } else { - if (logger.isDebugEnabled()) { - logger.debug("VM power state does not change, skip DB writing. vm id: " + instance.getId()); - } + logger.debug("VM power state does not change, skip DB writing. vm id: " + instance.getId()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -138,16 +128,14 @@ private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> tra } } - if (logger.isInfoEnabled()) { - String lastTime = new SimpleDateFormat("yyyy/MM/dd'T'HH:mm:ss.SSS'Z'").format(vmStateUpdateTime); - logger.debug( - String.format("Detected missing VM. host: %d, vm id: %d(%s), power state: %s, last state update: %s" - , hostId - , instance.getId() - , instance.getUuid() - , VirtualMachine.PowerState.PowerReportMissing - , lastTime)); - } + String lastTime = new SimpleDateFormat("yyyy/MM/dd'T'HH:mm:ss.SSS'Z'").format(vmStateUpdateTime); + logger.debug( + String.format("Detected missing VM. host: %d, vm id: %d(%s), power state: %s, last state update: %s" Review Comment: Still using string format ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -1661,9 +1653,7 @@ private void implementNetworkElements(final DeployDestination dest, final Reserv + network.getPhysicalNetworkId()); } - if (logger.isDebugEnabled()) { - logger.debug("Asking " + element.getName() + " to implement " + network); - } + logger.debug("Asking " + element.getName() + " to implement " + network); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -2128,9 +2118,7 @@ public NicProfile prepareNic(final VirtualMachineProfile vmProfile, final Deploy throw new CloudRuntimeException("Service provider " + element.getProvider().getName() + " either doesn't exist or is not enabled in physical network id: " + network.getPhysicalNetworkId()); } - if (logger.isDebugEnabled()) { - logger.debug("Asking " + element.getName() + " to prepare for " + nic); - } + logger.debug("Asking " + element.getName() + " to prepare for " + nic); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -3326,9 +3302,7 @@ public boolean destroyNetwork(final long networkId, final ReservationContext con for (final NetworkElement element : networkElements) { if (providersToDestroy.contains(element.getProvider())) { try { - if (logger.isDebugEnabled()) { - logger.debug("Sending destroy to " + element); - } + logger.debug("Sending destroy to " + element); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -3485,20 +3457,16 @@ public void reallyRun() { } if (!networkDetailsDao.findDetails(Network.AssociatedNetworkId, String.valueOf(networkId), null).isEmpty()) { - logger.debug(String.format("Network %s is associated to a shared network, skipping", networkId)); + logger.debug("Network {} is associated to a shared network, skipping", networkId); continue; } final Long time = _lastNetworkIdsToFree.remove(networkId); if (time == null) { - if (logger.isDebugEnabled()) { - logger.debug("We found network " + networkId + " to be free for the first time. Adding it to the list: " + currentTime); - } + logger.debug("We found network " + networkId + " to be free for the first time. Adding it to the list: " + currentTime); stillFree.put(networkId, currentTime); } else if (time > currentTime - netGcWait) { - if (logger.isDebugEnabled()) { - logger.debug("Network " + networkId + " is still free but it's not time to shutdown yet: " + time); - } + logger.debug("Network " + networkId + " is still free but it's not time to shutdown yet: " + time); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -1370,20 +1332,18 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil new ArrayList<>(ipAddressDetails.values()), CAManager.CertValidityPeriod.value(), null); final boolean result = caManager.deployCertificate(vmHost, certificate, false, sshAccessDetails); if (!result) { - logger.error("Failed to setup certificate for system vm: " + vm.getInstanceName()); + logger.error("Failed to setup certificate for system vm: {}", vm.getInstanceName()); } return; } catch (final Exception e) { - logger.error("Retrying after catching exception while trying to secure agent for systemvm id=" + vm.getId(), e); + logger.error("Retrying after catching exception while trying to secure agent for systemvm id={}", vm.getId(), e); } } throw new CloudRuntimeException("Failed to setup and secure agent for systemvm id=" + vm.getId()); } return; } else { - if (logger.isDebugEnabled()) { - logger.info("The guru did not like the answers so stopping " + vm); - } + logger.info("The guru did not like the answers so stopping " + vm); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -4371,9 +4259,7 @@ public void findHostAndMigrate(final String vmUuid, final Long newSvcOfferingId, } if (dest != null) { - if (logger.isDebugEnabled()) { - logger.debug(" Found " + dest + " for scaling the vm to."); - } + logger.debug(" Found " + dest + " for scaling the vm to."); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -4214,9 +4172,7 @@ public void processConnect(final Host host, final StartupCommand cmd, final bool dcId = dc.getId(); final HypervisorType hypervisorType = startup.getHypervisorType(); - if (logger.isDebugEnabled()) { - logger.debug("Host's hypervisorType is: " + hypervisorType); - } + logger.debug("Host's hypervisorType is: " + hypervisorType); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -4278,29 +4172,25 @@ private boolean orchestrateRemoveVmFromNetwork(final VirtualMachine vm, final Ne } if (nic == null) { - logger.warn("Could not get a nic with " + network); + logger.warn("Could not get a nic with {}", network); return false; } if (nic.isDefaultNic() && vm.getType() == VirtualMachine.Type.User) { - logger.warn("Failed to remove nic from " + vm + " in " + network + ", nic is default."); + logger.warn("Failed to remove nic from {} in {}, nic is default.", vm, network); throw new CloudRuntimeException("Failed to remove nic from " + vm + " in " + network + ", nic is default."); } final Nic lock = _nicsDao.acquireInLockTable(nic.getId()); if (lock == null) { if (_nicsDao.findById(nic.getId()) == null) { - if (logger.isDebugEnabled()) { - logger.debug("Not need to remove the vm " + vm + " from network " + network + " as the vm doesn't have nic in this network"); - } + logger.debug("Not need to remove the vm {} from network {} as the vm doesn't have nic in this network.", vm, network); return true; } throw new ConcurrentOperationException("Unable to lock nic " + nic.getId()); } - if (logger.isDebugEnabled()) { - logger.debug("Lock is acquired for nic id " + lock.getId() + " as a part of remove vm " + vm + " from network " + network); - } + logger.debug("Lock is acquired for nic id " + lock.getId() + " as a part of remove vm " + vm + " from network " + network); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -61,34 +61,26 @@ public void processHostVmStateReport(long hostId, Map<String, HostVmStateReportE @Override public void processHostVmStatePingReport(long hostId, Map<String, HostVmStateReportEntry> report, boolean force) { - if (logger.isDebugEnabled()) - logger.debug("Process host VM state report from ping process. host: " + hostId); + logger.debug("Process host VM state report from ping process. host: " + hostId); Map<Long, VirtualMachine.PowerState> translatedInfo = convertVmStateReport(report); processReport(hostId, translatedInfo, force); } private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> translatedInfo, boolean force) { - if (logger.isDebugEnabled()) { - logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); - } + logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); for (Map.Entry<Long, VirtualMachine.PowerState> entry : translatedInfo.entrySet()) { - if (logger.isDebugEnabled()) - logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); + logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); if (_instanceDao.updatePowerState(entry.getKey(), hostId, entry.getValue(), DateUtil.currentGMTTime())) { - if (logger.isInfoEnabled()) { - logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); - } + logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -1180,35 +1152,29 @@ public void orchestrateStart(final String vmUuid, final Map<VirtualMachineProfil int retry = StartRetry.value(); while (retry-- != 0) { - logger.debug("VM start attempt #" + (StartRetry.value() - retry)); + logger.debug("VM start attempt #{}", (StartRetry.value() - retry)); if (reuseVolume) { final List<VolumeVO> vols = _volsDao.findReadyRootVolumesByInstance(vm.getId()); for (final VolumeVO vol : vols) { final Long volTemplateId = vol.getTemplateId(); if (volTemplateId != null && volTemplateId != template.getId()) { - if (logger.isDebugEnabled()) { - logger.debug(vol + " of " + vm + " is READY, but template ids don't match, let the planner reassign a new pool"); - } + logger.debug("{} of {} is READY, but template ids don't match, let the planner reassign a new pool", vol, vm); continue; } final StoragePool pool = (StoragePool)dataStoreMgr.getPrimaryDataStore(vol.getPoolId()); if (!pool.isInMaintenance()) { - if (logger.isDebugEnabled()) { - logger.debug("Root volume is ready, need to place VM in volume's cluster"); - } + logger.debug("Root volume is ready, need to place VM in volume's cluster"); final long rootVolDcId = pool.getDataCenterId(); final Long rootVolPodId = pool.getPodId(); final Long rootVolClusterId = pool.getClusterId(); if (planToDeploy != null && planToDeploy.getDataCenterId() != 0) { final Long clusterIdSpecified = planToDeploy.getClusterId(); if (clusterIdSpecified != null && rootVolClusterId != null) { if (!rootVolClusterId.equals(clusterIdSpecified)) { - if (logger.isDebugEnabled()) { - logger.debug("Cannot satisfy the deployment plan passed in since the ready Root volume is in different cluster. volume's cluster: " + - rootVolClusterId + ", cluster specified: " + clusterIdSpecified); - } + logger.debug("Cannot satisfy the deployment plan passed in since the ready Root volume is in different cluster. volume's cluster: " + + rootVolClusterId + ", cluster specified: " + clusterIdSpecified); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -61,34 +61,26 @@ public void processHostVmStateReport(long hostId, Map<String, HostVmStateReportE @Override public void processHostVmStatePingReport(long hostId, Map<String, HostVmStateReportEntry> report, boolean force) { - if (logger.isDebugEnabled()) - logger.debug("Process host VM state report from ping process. host: " + hostId); + logger.debug("Process host VM state report from ping process. host: " + hostId); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -158,24 +146,19 @@ private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> tra // between the startime of this job and the currentTime of this missing-branch // an update might have occurred that we should not override in case of out of band migration if (_instanceDao.updatePowerState(instance.getId(), hostId, VirtualMachine.PowerState.PowerReportMissing, startTime)) { - if (logger.isDebugEnabled()) { - logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + instance.getId() + ", power state: PowerReportMissing "); - } + logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + instance.getId() + ", power state: PowerReportMissing "); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -107,9 +99,7 @@ private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> tra // here we need to be wary of out of band migration as opposed to other, more unexpected state changes if (vmsThatAreMissingReport.size() > 0) { Date currentTime = DateUtil.currentGMTTime(); - if (logger.isDebugEnabled()) { - logger.debug("Run missing VM report. current time: " + currentTime.getTime()); - } + logger.debug("Run missing VM report. current time: " + currentTime.getTime()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -4125,9 +4085,7 @@ private boolean shutdownNetworkResources(final long networkId, final Account cal } if (network.getVpcId() != null) { - if (logger.isDebugEnabled()) { - logger.debug("Releasing Network ACL Items for network id=" + networkId + " as a part of shutdownNetworkRules"); - } + logger.debug("Releasing Network ACL Items for network id=" + networkId + " as a part of shutdownNetworkRules"); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java: ########## @@ -5415,9 +5296,7 @@ public Outcome<VirtualMachine> addVmToNetworkThroughJobQueue( } workJob = pendingWorkJobs.get(0); } else { - if (logger.isTraceEnabled()) { - logger.trace(String.format("no jobs to add network %s for vm %s yet", network, vm)); - } + logger.trace(String.format("no jobs to add network %s for vm %s yet", network, vm)); Review Comment: Still using string format ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -61,34 +61,26 @@ public void processHostVmStateReport(long hostId, Map<String, HostVmStateReportE @Override public void processHostVmStatePingReport(long hostId, Map<String, HostVmStateReportEntry> report, boolean force) { - if (logger.isDebugEnabled()) - logger.debug("Process host VM state report from ping process. host: " + hostId); + logger.debug("Process host VM state report from ping process. host: " + hostId); Map<Long, VirtualMachine.PowerState> translatedInfo = convertVmStateReport(report); processReport(hostId, translatedInfo, force); } private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> translatedInfo, boolean force) { - if (logger.isDebugEnabled()) { - logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); - } + logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); for (Map.Entry<Long, VirtualMachine.PowerState> entry : translatedInfo.entrySet()) { - if (logger.isDebugEnabled()) - logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); + logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -1482,9 +1480,7 @@ public Pair<NetworkGuru, NetworkVO> implementNetwork(final long networkId, final throw ex; } - if (logger.isDebugEnabled()) { - logger.debug("Lock is acquired for network id " + networkId + " as a part of network implement"); - } + logger.debug("Lock is acquired for network id " + networkId + " as a part of network implement"); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VmWorkJobDispatcher.java: ########## @@ -103,8 +102,7 @@ public void runJob(AsyncJob job) { CallContext.unregister(); } } finally { - if (logger.isDebugEnabled()) - logger.debug("Done with run of VM work job: " + cmd + " for VM " + work.getVmId() + ", job origin: " + job.getRelated()); + logger.debug("Done with run of VM work job: " + cmd + " for VM " + work.getVmId() + ", job origin: " + job.getRelated()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VmWorkJobDispatcher.java: ########## @@ -75,8 +75,7 @@ public void runJob(AsyncJob job) { return; } - if (logger.isDebugEnabled()) - logger.debug("Run VM work job: " + cmd + " for VM " + work.getVmId() + ", job origin: " + job.getRelated()); + logger.debug("Run VM work job: " + cmd + " for VM " + work.getVmId() + ", job origin: " + job.getRelated()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -2431,9 +2419,7 @@ public Pair<Network, NicProfile> doInTransaction(final TransactionStatus status) final List<Provider> providersToImplement = getNetworkProviders(network.getId()); for (final NetworkElement element : networkElements) { if (providersToImplement.contains(element.getProvider())) { - if (logger.isDebugEnabled()) { - logger.debug("Asking " + element.getName() + " to release " + profile); - } + logger.debug("Asking " + element.getName() + " to release " + profile); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -158,24 +146,19 @@ private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> tra // between the startime of this job and the currentTime of this missing-branch // an update might have occurred that we should not override in case of out of band migration if (_instanceDao.updatePowerState(instance.getId(), hostId, VirtualMachine.PowerState.PowerReportMissing, startTime)) { - if (logger.isDebugEnabled()) { - logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + instance.getId() + ", power state: PowerReportMissing "); - } + logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + instance.getId() + ", power state: PowerReportMissing "); _messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, instance.getId()); } else { - if (logger.isDebugEnabled()) { - logger.debug("VM power state does not change, skip DB writing. vm id: " + instance.getId()); - } + logger.debug("VM power state does not change, skip DB writing. vm id: " + instance.getId()); } } else { logger.debug("vm id: " + instance.getId() + " - time since last state update(" + milliSecondsSinceLastStateUpdate + "ms) has not passed graceful period yet"); } } } - if (logger.isDebugEnabled()) - logger.debug("Done with process of VM state report. host: " + hostId); + logger.debug("Done with process of VM state report. host: " + hostId); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -1493,9 +1489,7 @@ public Pair<NetworkGuru, NetworkVO> implementNetwork(final long networkId, final return implemented; } - if (logger.isDebugEnabled()) { - logger.debug("Asking " + guru.getName() + " to implement " + network); - } + logger.debug("Asking " + guru.getName() + " to implement " + network); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -1560,9 +1554,7 @@ public Pair<NetworkGuru, NetworkVO> implementNetwork(final long networkId, final } _networksDao.releaseFromLockTable(networkId); - if (logger.isDebugEnabled()) { - logger.debug("Lock is released for network id " + networkId + " as a part of network implement"); - } + logger.debug("Lock is released for network id " + networkId + " as a part of network implement"); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -3214,9 +3192,7 @@ public boolean shutdownNetworkElementsAndResources(final ReservationContext cont for (final NetworkElement element : networkElements) { if (providersToShutdown.contains(element.getProvider())) { try { - if (logger.isDebugEnabled()) { - logger.debug("Sending network shutdown to " + element.getName()); - } + logger.debug("Sending network shutdown to " + element.getName()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -2444,9 +2430,7 @@ public Pair<Network, NicProfile> doInTransaction(final TransactionStatus status) @Override public void cleanupNics(final VirtualMachineProfile vm) { - if (logger.isDebugEnabled()) { - logger.debug("Cleaning network for vm: " + vm.getId()); - } + logger.debug("Cleaning network for vm: " + vm.getId()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/com/cloud/vm/VirtualMachinePowerStateSyncImpl.java: ########## @@ -61,34 +61,26 @@ public void processHostVmStateReport(long hostId, Map<String, HostVmStateReportE @Override public void processHostVmStatePingReport(long hostId, Map<String, HostVmStateReportEntry> report, boolean force) { - if (logger.isDebugEnabled()) - logger.debug("Process host VM state report from ping process. host: " + hostId); + logger.debug("Process host VM state report from ping process. host: " + hostId); Map<Long, VirtualMachine.PowerState> translatedInfo = convertVmStateReport(report); processReport(hostId, translatedInfo, force); } private void processReport(long hostId, Map<Long, VirtualMachine.PowerState> translatedInfo, boolean force) { - if (logger.isDebugEnabled()) { - logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); - } + logger.debug("Process VM state report. host: " + hostId + ", number of records in report: " + translatedInfo.size()); for (Map.Entry<Long, VirtualMachine.PowerState> entry : translatedInfo.entrySet()) { - if (logger.isDebugEnabled()) - logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); + logger.debug("VM state report. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); if (_instanceDao.updatePowerState(entry.getKey(), hostId, entry.getValue(), DateUtil.currentGMTTime())) { - if (logger.isInfoEnabled()) { - logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); - } + logger.debug("VM state report is updated. host: " + hostId + ", vm id: " + entry.getKey() + ", power state: " + entry.getValue()); _messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE, PublishScope.GLOBAL, entry.getKey()); } else { - if (logger.isTraceEnabled()) { - logger.trace("VM power state does not change, skip DB writing. vm id: " + entry.getKey()); - } + logger.trace("VM power state does not change, skip DB writing. vm id: " + entry.getKey()); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -3348,9 +3322,7 @@ public boolean destroyNetwork(final long networkId, final ReservationContext con } if (success) { - if (logger.isDebugEnabled()) { - logger.debug("Network id=" + networkId + " is destroyed successfully, cleaning up corresponding resources now."); - } + logger.debug("Network id=" + networkId + " is destroyed successfully, cleaning up corresponding resources now."); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -3173,9 +3153,7 @@ public Boolean doInTransaction(final TransactionStatus status) { } finally { if (network != null) { _networksDao.releaseFromLockTable(network.getId()); - if (logger.isDebugEnabled()) { - logger.debug("Lock is released for network " + network + " as a part of network shutdown"); - } + logger.debug("Lock is released for network " + network + " as a part of network shutdown"); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -3999,9 +3967,7 @@ private boolean shutdownNetworkResources(final long networkId, final Account cal // Mark all PF rules as revoked and apply them on the backend (not in the DB) final List<PortForwardingRuleVO> pfRules = _portForwardingRulesDao.listByNetwork(networkId); - if (logger.isDebugEnabled()) { - logger.debug("Releasing " + pfRules.size() + " port forwarding rules for network id=" + networkId + " as a part of shutdownNetworkRules"); - } + logger.debug("Releasing " + pfRules.size() + " port forwarding rules for network id=" + networkId + " as a part of shutdownNetworkRules"); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -3133,9 +3115,7 @@ public Boolean doInTransaction(final TransactionStatus status) { boolean result = false; if (success) { - if (logger.isDebugEnabled()) { - logger.debug("Network id=" + networkId + " is shutdown successfully, cleaning up corresponding resources now."); - } + logger.debug("Network id=" + networkId + " is shutdown successfully, cleaning up corresponding resources now."); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -4091,9 +4053,7 @@ private boolean shutdownNetworkResources(final long networkId, final Account cal } final List<FirewallRuleVO> firewallEgressRules = _firewallDao.listByNetworkPurposeTrafficType(networkId, Purpose.Firewall, FirewallRule.TrafficType.Egress); - if (logger.isDebugEnabled()) { - logger.debug("Releasing " + firewallEgressRules.size() + " firewall egress rules for network id=" + networkId + " as a part of shutdownNetworkRules"); - } + logger.debug("Releasing " + firewallEgressRules.size() + " firewall egress rules for network id=" + networkId + " as a part of shutdownNetworkRules"); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -4021,9 +3987,7 @@ private boolean shutdownNetworkResources(final long networkId, final Account cal // Mark all static rules as revoked and apply them on the backend (not in the DB) final List<FirewallRuleVO> firewallStaticNatRules = _firewallDao.listByNetworkAndPurpose(networkId, Purpose.StaticNat); final List<StaticNatRule> staticNatRules = new ArrayList<StaticNatRule>(); - if (logger.isDebugEnabled()) { - logger.debug("Releasing " + firewallStaticNatRules.size() + " static nat rules for network id=" + networkId + " as a part of shutdownNetworkRules"); - } + logger.debug("Releasing " + firewallStaticNatRules.size() + " static nat rules for network id=" + networkId + " as a part of shutdownNetworkRules"); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -3485,20 +3457,16 @@ public void reallyRun() { } if (!networkDetailsDao.findDetails(Network.AssociatedNetworkId, String.valueOf(networkId), null).isEmpty()) { - logger.debug(String.format("Network %s is associated to a shared network, skipping", networkId)); + logger.debug("Network {} is associated to a shared network, skipping", networkId); continue; } final Long time = _lastNetworkIdsToFree.remove(networkId); if (time == null) { - if (logger.isDebugEnabled()) { - logger.debug("We found network " + networkId + " to be free for the first time. Adding it to the list: " + currentTime); - } + logger.debug("We found network " + networkId + " to be free for the first time. Adding it to the list: " + currentTime); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/StorageOrchestrator.java: ########## @@ -267,7 +267,7 @@ public MigrationResponse migrateResources(Long srcImgStoreId, Long destImgStoreI } if (chosenFileForMigration.getPhysicalSize() > storageCapacities.get(destImgStoreId).first()) { - logger.debug(String.format("%s: %s too large to be migrated to %s", chosenFileForMigration.getType().name(), chosenFileForMigration.getUuid(), destImgStoreId)); + logger.debug("{}: %s too large to be migrated to {}", chosenFileForMigration.getType().name(), chosenFileForMigration.getUuid(), destImgStoreId); Review Comment: Theres a %s here still ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -4071,9 +4035,7 @@ private boolean shutdownNetworkResources(final long networkId, final Account cal // revoke all firewall rules for the network w/o applying them on the DB final List<FirewallRuleVO> firewallRules = _firewallDao.listByNetworkPurposeTrafficType(networkId, Purpose.Firewall, FirewallRule.TrafficType.Ingress); - if (logger.isDebugEnabled()) { - logger.debug("Releasing " + firewallRules.size() + " firewall ingress rules for network id=" + networkId + " as a part of shutdownNetworkRules"); - } + logger.debug("Releasing " + firewallRules.size() + " firewall ingress rules for network id=" + networkId + " as a part of shutdownNetworkRules"); Review Comment: Still using string concatenation ########## engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/NetworkOrchestrator.java: ########## @@ -4756,9 +4708,7 @@ private String generateNewMacAddressIfForced(Network network, String macAddress, @Override public void unmanageNics(VirtualMachineProfile vm) { - if (logger.isDebugEnabled()) { - logger.debug("Unmanaging NICs for VM: " + vm.getId()); - } + logger.debug("Unmanaging NICs for VM: " + vm.getId()); Review Comment: Still using string concatenation -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org