http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/deploy/FirstFitPlanner.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/deploy/FirstFitPlanner.java b/server/src/com/cloud/deploy/FirstFitPlanner.java index 1be85b0..8fa25bd 100644 --- a/server/src/com/cloud/deploy/FirstFitPlanner.java +++ b/server/src/com/cloud/deploy/FirstFitPlanner.java @@ -32,6 +32,7 @@ import org.apache.cloudstack.framework.config.ConfigKey; import org.apache.cloudstack.framework.config.Configurable; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.log4j.Logger; import com.cloud.capacity.Capacity; import com.cloud.capacity.CapacityManager; @@ -69,6 +70,7 @@ import com.cloud.vm.dao.VMInstanceDao; @Local(value = DeploymentPlanner.class) public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPlanner, Configurable { + private static final Logger s_logger = Logger.getLogger(FirstFitPlanner.class); @Inject protected HostDao _hostDao; @Inject @@ -125,8 +127,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla //check if datacenter is in avoid set if (avoid.shouldAvoid(dc)) { - if (logger.isDebugEnabled()) { - logger.debug("DataCenter id = '" + dc.getId() + "' provided is in avoid set, DeploymentPlanner cannot allocate the VM, returning."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("DataCenter id = '" + dc.getId() + "' provided is in avoid set, DeploymentPlanner cannot allocate the VM, returning."); } return null; } @@ -134,29 +136,29 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla List<Long> clusterList = new ArrayList<Long>(); if (plan.getClusterId() != null) { Long clusterIdSpecified = plan.getClusterId(); - logger.debug("Searching resources only under specified Cluster: " + clusterIdSpecified); + s_logger.debug("Searching resources only under specified Cluster: " + clusterIdSpecified); ClusterVO cluster = _clusterDao.findById(plan.getClusterId()); if (cluster != null) { if (avoid.shouldAvoid(cluster)) { - logger.debug("The specified cluster is in avoid set, returning."); + s_logger.debug("The specified cluster is in avoid set, returning."); } else { clusterList.add(clusterIdSpecified); removeClustersCrossingThreshold(clusterList, avoid, vmProfile, plan); } } else { - logger.debug("The specified cluster cannot be found, returning."); + s_logger.debug("The specified cluster cannot be found, returning."); avoid.addCluster(plan.getClusterId()); return null; } } else if (plan.getPodId() != null) { //consider clusters under this pod only Long podIdSpecified = plan.getPodId(); - logger.debug("Searching resources only under specified Pod: " + podIdSpecified); + s_logger.debug("Searching resources only under specified Pod: " + podIdSpecified); HostPodVO pod = _podDao.findById(podIdSpecified); if (pod != null) { if (avoid.shouldAvoid(pod)) { - logger.debug("The specified pod is in avoid set, returning."); + s_logger.debug("The specified pod is in avoid set, returning."); } else { clusterList = scanClustersForDestinationInZoneOrPod(podIdSpecified, false, vmProfile, plan, avoid); if (clusterList == null) { @@ -164,12 +166,12 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla } } } else { - logger.debug("The specified Pod cannot be found, returning."); + s_logger.debug("The specified Pod cannot be found, returning."); avoid.addPod(plan.getPodId()); return null; } } else { - logger.debug("Searching all possible resources under this Zone: " + plan.getDataCenterId()); + s_logger.debug("Searching all possible resources under this Zone: " + plan.getDataCenterId()); boolean applyAllocationAtPods = Boolean.parseBoolean(_configDao.getValue(Config.ApplyAllocationAlgorithmToPods.key())); if (applyAllocationAtPods) { @@ -226,23 +228,23 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla if (!podsWithCapacity.isEmpty()) { if (avoid.getPodsToAvoid() != null) { - if (logger.isDebugEnabled()) { - logger.debug("Removing from the podId list these pods from avoid set: " + avoid.getPodsToAvoid()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Removing from the podId list these pods from avoid set: " + avoid.getPodsToAvoid()); } podsWithCapacity.removeAll(avoid.getPodsToAvoid()); } if (!isRootAdmin(vmProfile)) { List<Long> disabledPods = listDisabledPods(plan.getDataCenterId()); if (!disabledPods.isEmpty()) { - if (logger.isDebugEnabled()) { - logger.debug("Removing from the podId list these pods that are disabled: " + disabledPods); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Removing from the podId list these pods that are disabled: " + disabledPods); } podsWithCapacity.removeAll(disabledPods); } } } else { - if (logger.isDebugEnabled()) { - logger.debug("No pods found having a host with enough capacity, returning."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("No pods found having a host with enough capacity, returning."); } return null; } @@ -251,8 +253,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla prioritizedPodIds = reorderPods(podCapacityInfo, vmProfile, plan); if (prioritizedPodIds == null || prioritizedPodIds.isEmpty()) { - if (logger.isDebugEnabled()) { - logger.debug("No Pods found for destination, returning."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("No Pods found for destination, returning."); } return null; } @@ -260,7 +262,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla List<Long> clusterList = new ArrayList<Long>(); //loop over pods for (Long podId : prioritizedPodIds) { - logger.debug("Checking resources under Pod: " + podId); + s_logger.debug("Checking resources under Pod: " + podId); List<Long> clustersUnderPod = scanClustersForDestinationInZoneOrPod(podId, false, vmProfile, plan, avoid); if (clustersUnderPod != null) { clusterList.addAll(clustersUnderPod); @@ -268,8 +270,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla } return clusterList; } else { - if (logger.isDebugEnabled()) { - logger.debug("No Pods found after removing disabled pods and pods in avoid list, returning."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("No Pods found after removing disabled pods and pods in avoid list, returning."); } return null; } @@ -336,7 +338,7 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla // Remove clusters crossing disabled threshold clusterListForVmAllocation.removeAll(clustersCrossingThreshold); - logger.debug("Cannot allocate cluster list " + clustersCrossingThreshold.toString() + " for vm creation since their allocated percentage" + + s_logger.debug("Cannot allocate cluster list " + clustersCrossingThreshold.toString() + " for vm creation since their allocated percentage" + " crosses the disable capacity threshold defined at each cluster/ at global value for capacity Type : " + capacity + ", skipping these clusters"); } @@ -356,8 +358,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla List<Long> prioritizedClusterIds = clusterCapacityInfo.first(); if (!prioritizedClusterIds.isEmpty()) { if (avoid.getClustersToAvoid() != null) { - if (logger.isDebugEnabled()) { - logger.debug("Removing from the clusterId list these clusters from avoid set: " + avoid.getClustersToAvoid()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Removing from the clusterId list these clusters from avoid set: " + avoid.getClustersToAvoid()); } prioritizedClusterIds.removeAll(avoid.getClustersToAvoid()); } @@ -370,8 +372,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla disabledClusters = listDisabledClusters(plan.getDataCenterId(), id); } if (!disabledClusters.isEmpty()) { - if (logger.isDebugEnabled()) { - logger.debug("Removing from the clusterId list these clusters that are disabled/clusters under disabled pods: " + disabledClusters); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Removing from the clusterId list these clusters that are disabled/clusters under disabled pods: " + disabledClusters); } prioritizedClusterIds.removeAll(disabledClusters); } @@ -380,8 +382,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla removeClustersCrossingThreshold(prioritizedClusterIds, avoid, vmProfile, plan); } else { - if (logger.isDebugEnabled()) { - logger.debug("No clusters found having a host with enough capacity, returning."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("No clusters found having a host with enough capacity, returning."); } return null; } @@ -389,8 +391,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla List<Long> clusterList = reorderClusters(id, isZone, clusterCapacityInfo, vmProfile, plan); return clusterList; //return checkClustersforDestination(clusterList, vmProfile, plan, avoid, dc); } else { - if (logger.isDebugEnabled()) { - logger.debug("No clusters found after removing disabled clusters and clusters in avoid list, returning."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("No clusters found after removing disabled clusters and clusters in avoid list, returning."); } return null; } @@ -441,8 +443,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla //although an aggregate value may be false indicator that a cluster can host a vm, it will at the least eliminate those clusters which definitely cannot //we need clusters having enough cpu AND RAM to host this particular VM and order them by aggregate cluster capacity - if (logger.isDebugEnabled()) { - logger.debug("Listing clusters in order of aggregate capacity, that have (atleast one host with) enough CPU and RAM capacity under this " + + if (s_logger.isDebugEnabled()) { + s_logger.debug("Listing clusters in order of aggregate capacity, that have (atleast one host with) enough CPU and RAM capacity under this " + (isZone ? "Zone: " : "Pod: ") + id); } String capacityTypeToOrder = _configDao.getValue(Config.HostCapacityTypeToOrderClusters.key()); @@ -452,19 +454,19 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla } List<Long> clusterIdswithEnoughCapacity = _capacityDao.listClustersInZoneOrPodByHostCapacities(id, requiredCpu, requiredRam, capacityType, isZone); - if (logger.isTraceEnabled()) { - logger.trace("ClusterId List having enough CPU and RAM capacity: " + clusterIdswithEnoughCapacity); + if (s_logger.isTraceEnabled()) { + s_logger.trace("ClusterId List having enough CPU and RAM capacity: " + clusterIdswithEnoughCapacity); } Pair<List<Long>, Map<Long, Double>> result = _capacityDao.orderClustersByAggregateCapacity(id, capacityType, isZone); List<Long> clusterIdsOrderedByAggregateCapacity = result.first(); //only keep the clusters that have enough capacity to host this VM - if (logger.isTraceEnabled()) { - logger.trace("ClusterId List in order of aggregate capacity: " + clusterIdsOrderedByAggregateCapacity); + if (s_logger.isTraceEnabled()) { + s_logger.trace("ClusterId List in order of aggregate capacity: " + clusterIdsOrderedByAggregateCapacity); } clusterIdsOrderedByAggregateCapacity.retainAll(clusterIdswithEnoughCapacity); - if (logger.isTraceEnabled()) { - logger.trace("ClusterId List having enough CPU and RAM capacity & in order of aggregate capacity: " + clusterIdsOrderedByAggregateCapacity); + if (s_logger.isTraceEnabled()) { + s_logger.trace("ClusterId List having enough CPU and RAM capacity & in order of aggregate capacity: " + clusterIdsOrderedByAggregateCapacity); } return result; @@ -476,8 +478,8 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla //although an aggregate value may be false indicator that a pod can host a vm, it will at the least eliminate those pods which definitely cannot //we need pods having enough cpu AND RAM to host this particular VM and order them by aggregate pod capacity - if (logger.isDebugEnabled()) { - logger.debug("Listing pods in order of aggregate capacity, that have (atleast one host with) enough CPU and RAM capacity under this Zone: " + zoneId); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Listing pods in order of aggregate capacity, that have (atleast one host with) enough CPU and RAM capacity under this Zone: " + zoneId); } String capacityTypeToOrder = _configDao.getValue(Config.HostCapacityTypeToOrderClusters.key()); short capacityType = Capacity.CAPACITY_TYPE_CPU; @@ -486,19 +488,19 @@ public class FirstFitPlanner extends PlannerBase implements DeploymentClusterPla } List<Long> podIdswithEnoughCapacity = _capacityDao.listPodsByHostCapacities(zoneId, requiredCpu, requiredRam, capacityType); - if (logger.isTraceEnabled()) { - logger.trace("PodId List having enough CPU and RAM capacity: " + podIdswithEnoughCapacity); + if (s_logger.isTraceEnabled()) { + s_logger.trace("PodId List having enough CPU and RAM capacity: " + podIdswithEnoughCapacity); } Pair<List<Long>, Map<Long, Double>> result = _capacityDao.orderPodsByAggregateCapacity(zoneId, capacityType); List<Long> podIdsOrderedByAggregateCapacity = result.first(); //only keep the clusters that have enough capacity to host this VM - if (logger.isTraceEnabled()) { - logger.trace("PodId List in order of aggregate capacity: " + podIdsOrderedByAggregateCapacity); + if (s_logger.isTraceEnabled()) { + s_logger.trace("PodId List in order of aggregate capacity: " + podIdsOrderedByAggregateCapacity); } podIdsOrderedByAggregateCapacity.retainAll(podIdswithEnoughCapacity); - if (logger.isTraceEnabled()) { - logger.trace("PodId List having enough CPU and RAM capacity & in order of aggregate capacity: " + podIdsOrderedByAggregateCapacity); + if (s_logger.isTraceEnabled()) { + s_logger.trace("PodId List having enough CPU and RAM capacity & in order of aggregate capacity: " + podIdsOrderedByAggregateCapacity); } return result;
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/event/dao/EventJoinDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/event/dao/EventJoinDaoImpl.java b/server/src/com/cloud/event/dao/EventJoinDaoImpl.java index 8a1578b..313c372 100644 --- a/server/src/com/cloud/event/dao/EventJoinDaoImpl.java +++ b/server/src/com/cloud/event/dao/EventJoinDaoImpl.java @@ -20,6 +20,7 @@ import java.util.List; import javax.ejb.Local; +import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import org.apache.cloudstack.api.response.EventResponse; @@ -36,6 +37,7 @@ import com.cloud.utils.db.SearchCriteria; @Component @Local(value = {EventJoinDao.class}) public class EventJoinDaoImpl extends GenericDaoBase<EventJoinVO, Long> implements EventJoinDao { + public static final Logger s_logger = Logger.getLogger(EventJoinDaoImpl.class); private SearchBuilder<EventJoinVO> vrSearch; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/AbstractInvestigatorImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/AbstractInvestigatorImpl.java b/server/src/com/cloud/ha/AbstractInvestigatorImpl.java index b65865e..147cecd 100644 --- a/server/src/com/cloud/ha/AbstractInvestigatorImpl.java +++ b/server/src/com/cloud/ha/AbstractInvestigatorImpl.java @@ -23,6 +23,7 @@ import java.util.Map; import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -39,6 +40,7 @@ import com.cloud.utils.db.QueryBuilder; import com.cloud.utils.db.SearchCriteria.Op; public abstract class AbstractInvestigatorImpl extends AdapterBase implements Investigator { + private static final Logger s_logger = Logger.getLogger(AbstractInvestigatorImpl.class); @Inject private final HostDao _hostDao = null; @@ -88,32 +90,32 @@ public abstract class AbstractInvestigatorImpl extends AdapterBase implements In try { Answer pingTestAnswer = _agentMgr.send(hostId, new PingTestCommand(testHostIp)); if (pingTestAnswer == null) { - if (logger.isDebugEnabled()) { - logger.debug("host (" + testHostIp + ") returns Unknown (null) answer"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("host (" + testHostIp + ") returns Unknown (null) answer"); } return Status.Unknown; } if (pingTestAnswer.getResult()) { - if (logger.isDebugEnabled()) { - logger.debug("host (" + testHostIp + ") has been successfully pinged, returning that host is up"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("host (" + testHostIp + ") has been successfully pinged, returning that host is up"); } // computing host is available, but could not reach agent, return false return Status.Up; } else { - if (logger.isDebugEnabled()) { - logger.debug("host (" + testHostIp + ") cannot be pinged, returning Unknown (I don't know) state"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("host (" + testHostIp + ") cannot be pinged, returning Unknown (I don't know) state"); } return Status.Unknown; } } catch (AgentUnavailableException e) { - if (logger.isDebugEnabled()) { - logger.debug("host (" + testHostIp + "): " + e.getLocalizedMessage() + ", trapped AgentUnavailableException returning Unknown state"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("host (" + testHostIp + "): " + e.getLocalizedMessage() + ", trapped AgentUnavailableException returning Unknown state"); } return Status.Unknown; } catch (OperationTimedoutException e) { - if (logger.isDebugEnabled()) { - logger.debug("host (" + testHostIp + "): " + e.getLocalizedMessage() + ", trapped OperationTimedoutException returning Unknown state"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("host (" + testHostIp + "): " + e.getLocalizedMessage() + ", trapped OperationTimedoutException returning Unknown state"); } return Status.Unknown; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/CheckOnAgentInvestigator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/CheckOnAgentInvestigator.java b/server/src/com/cloud/ha/CheckOnAgentInvestigator.java index 3a7fdf4..b2e333f 100644 --- a/server/src/com/cloud/ha/CheckOnAgentInvestigator.java +++ b/server/src/com/cloud/ha/CheckOnAgentInvestigator.java @@ -19,6 +19,7 @@ package com.cloud.ha; import javax.ejb.Local; import javax.inject.Inject; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.CheckVirtualMachineAnswer; @@ -33,6 +34,7 @@ import com.cloud.vm.VirtualMachine.PowerState; @Local(value = Investigator.class) public class CheckOnAgentInvestigator extends AdapterBase implements Investigator { + private final static Logger s_logger = Logger.getLogger(CheckOnAgentInvestigator.class); @Inject AgentManager _agentMgr; @@ -50,17 +52,17 @@ public class CheckOnAgentInvestigator extends AdapterBase implements Investigato try { CheckVirtualMachineAnswer answer = (CheckVirtualMachineAnswer)_agentMgr.send(vm.getHostId(), cmd); if (!answer.getResult()) { - logger.debug("Unable to get vm state on " + vm.toString()); + s_logger.debug("Unable to get vm state on " + vm.toString()); throw new UnknownVM(); } - logger.debug("Agent responded with state " + answer.getState().toString()); + s_logger.debug("Agent responded with state " + answer.getState().toString()); return answer.getState() == PowerState.PowerOn; } catch (AgentUnavailableException e) { - logger.debug("Unable to reach the agent for " + vm.toString() + ": " + e.getMessage()); + s_logger.debug("Unable to reach the agent for " + vm.toString() + ": " + e.getMessage()); throw new UnknownVM(); } catch (OperationTimedoutException e) { - logger.debug("Operation timed out for " + vm.toString() + ": " + e.getMessage()); + s_logger.debug("Operation timed out for " + vm.toString() + ": " + e.getMessage()); throw new UnknownVM(); } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/HighAvailabilityManagerExtImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerExtImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerExtImpl.java index b2f8a96..56db8ef 100644 --- a/server/src/com/cloud/ha/HighAvailabilityManagerExtImpl.java +++ b/server/src/com/cloud/ha/HighAvailabilityManagerExtImpl.java @@ -64,8 +64,8 @@ public class HighAvailabilityManagerExtImpl extends HighAvailabilityManagerImpl protected class UsageServerMonitorTask extends ManagedContextRunnable { @Override protected void runInContext() { - if (logger.isInfoEnabled()) { - logger.info("checking health of usage server"); + if (s_logger.isInfoEnabled()) { + s_logger.info("checking health of usage server"); } try { @@ -80,8 +80,8 @@ public class HighAvailabilityManagerExtImpl extends HighAvailabilityManagerImpl isRunning = true; } } - if (logger.isDebugEnabled()) { - logger.debug("usage server running? " + isRunning + ", heartbeat: " + lastHeartbeat); + if (s_logger.isDebugEnabled()) { + s_logger.debug("usage server running? " + isRunning + ", heartbeat: " + lastHeartbeat); } } finally { txn.close(); @@ -98,7 +98,7 @@ public class HighAvailabilityManagerExtImpl extends HighAvailabilityManagerImpl _alertMgr.clearAlert(AlertManager.AlertType.ALERT_TYPE_USAGE_SERVER, 0, 0); } } catch (Exception ex) { - logger.warn("Error while monitoring usage job", ex); + s_logger.warn("Error while monitoring usage job", ex); } } } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java index 880a400..bec1fd5 100644 --- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java +++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java @@ -29,6 +29,7 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.log4j.Logger; import org.apache.log4j.NDC; import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService; import org.apache.cloudstack.framework.config.dao.ConfigurationDao; @@ -103,6 +104,7 @@ import com.cloud.vm.dao.VMInstanceDao; @Local(value = { HighAvailabilityManager.class }) public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvailabilityManager, ClusterManagerListener { + protected static final Logger s_logger = Logger.getLogger(HighAvailabilityManagerImpl.class); WorkerThread[] _workers; boolean _stopped; long _timeToSleep; @@ -207,13 +209,13 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai for (Investigator investigator : investigators) { hostState = investigator.isAgentAlive(host); if (hostState != null) { - if (logger.isDebugEnabled()) { - logger.debug(investigator.getName() + " was able to determine host " + hostId + " is in " + hostState.toString()); + if (s_logger.isDebugEnabled()) { + s_logger.debug(investigator.getName() + " was able to determine host " + hostId + " is in " + hostState.toString()); } return hostState; } - if (logger.isDebugEnabled()) { - logger.debug(investigator.getName() + " unable to determine the state of the host. Moving on."); + if (s_logger.isDebugEnabled()) { + s_logger.debug(investigator.getName() + " unable to determine the state of the host. Moving on."); } } @@ -228,11 +230,11 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } if (host.getHypervisorType() == HypervisorType.VMware || host.getHypervisorType() == HypervisorType.Hyperv) { - logger.info("Don't restart VMs on host " + host.getId() + " as it is a " + host.getHypervisorType().toString() + " host"); + s_logger.info("Don't restart VMs on host " + host.getId() + " as it is a " + host.getHypervisorType().toString() + " host"); return; } - logger.warn("Scheduling restart for VMs on host " + host.getId() + "-" + host.getName()); + s_logger.warn("Scheduling restart for VMs on host " + host.getId() + "-" + host.getName()); final List<VMInstanceVO> vms = _instanceDao.listByHostId(host.getId()); final DataCenterVO dcVO = _dcDao.findById(host.getDataCenterId()); @@ -264,13 +266,13 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai "Host [" + hostDesc + "] is down." + ((sb != null) ? sb.toString() : "")); for (VMInstanceVO vm : reorderedVMList) { - if (logger.isDebugEnabled()) { - logger.debug("Notifying HA Mgr of to restart vm " + vm.getId() + "-" + vm.getInstanceName()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Notifying HA Mgr of to restart vm " + vm.getId() + "-" + vm.getInstanceName()); } vm = _instanceDao.findByUuid(vm.getUuid()); Long hostId = vm.getHostId(); if (hostId != null && !hostId.equals(host.getId())) { - logger.debug("VM " + vm.getInstanceName() + " is not on down host " + host.getId() + " it is on other host " + s_logger.debug("VM " + vm.getInstanceName() + " is not on down host " + host.getId() + " it is on other host " + hostId + " VM HA is done"); continue; } @@ -283,14 +285,14 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai assert (type == WorkType.CheckStop || type == WorkType.ForceStop || type == WorkType.Stop); if (_haDao.hasBeenScheduled(vm.getId(), type)) { - logger.info("There's already a job scheduled to stop " + vm); + s_logger.info("There's already a job scheduled to stop " + vm); return; } HaWorkVO work = new HaWorkVO(vm.getId(), vm.getType(), type, Step.Scheduled, hostId, vm.getState(), 0, vm.getUpdated()); _haDao.persist(work); - if (logger.isDebugEnabled()) { - logger.debug("Scheduled " + work); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Scheduled " + work); } wakeupWorkers(); } @@ -316,7 +318,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai Long hostId = vm.getHostId(); if (hostId == null) { try { - logger.debug("Found a vm that is scheduled to be restarted but has no host id: " + vm); + s_logger.debug("Found a vm that is scheduled to be restarted but has no host id: " + vm); _itMgr.advanceStop(vm.getUuid(), true); } catch (ResourceUnavailableException e) { assert false : "How do we hit this when force is true?"; @@ -331,13 +333,13 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } if (vm.getHypervisorType() == HypervisorType.VMware || vm.getHypervisorType() == HypervisorType.Hyperv) { - logger.info("Skip HA for VMware VM or Hyperv VM" + vm.getInstanceName()); + s_logger.info("Skip HA for VMware VM or Hyperv VM" + vm.getInstanceName()); return; } if (!investigate) { - if (logger.isDebugEnabled()) { - logger.debug("VM does not require investigation so I'm marking it as Stopped: " + vm.toString()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("VM does not require investigation so I'm marking it as Stopped: " + vm.toString()); } AlertManager.AlertType alertType = AlertManager.AlertType.ALERT_TYPE_USERVM; @@ -355,8 +357,8 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai ") stopped unexpectedly on host " + hostDesc, "Virtual Machine " + vm.getHostName() + " (id: " + vm.getId() + ") running on host [" + vm.getHostId() + "] stopped unexpectedly."); - if (logger.isDebugEnabled()) { - logger.debug("VM is not HA enabled so we're done."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("VM is not HA enabled so we're done."); } } @@ -376,7 +378,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } if (vm.getHypervisorType() == HypervisorType.VMware) { - logger.info("Skip HA for VMware VM " + vm.getInstanceName()); + s_logger.info("Skip HA for VMware VM " + vm.getInstanceName()); return; } @@ -397,8 +399,8 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai hostId != null ? hostId : 0L, vm.getState(), maxRetries + 1, vm.getUpdated()); _haDao.persist(work); - if (logger.isInfoEnabled()) { - logger.info("Schedule vm for HA: " + vm); + if (s_logger.isInfoEnabled()) { + s_logger.info("Schedule vm for HA: " + vm); } wakeupWorkers(); @@ -413,7 +415,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai str.append(item.getId()).append(", "); } str.delete(str.length() - 2, str.length()).append("]"); - logger.info(str.toString()); + s_logger.info(str.toString()); return null; } @@ -424,7 +426,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai str.append(item.getId()).append(", "); } str.delete(str.length() - 2, str.length()).append("]"); - logger.info(str.toString()); + s_logger.info(str.toString()); return (System.currentTimeMillis() >> 10) + _investigateRetryInterval; } @@ -432,13 +434,13 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai VirtualMachine vm = _itMgr.findById(work.getInstanceId()); if (vm == null) { - logger.info("Unable to find vm: " + vmId); + s_logger.info("Unable to find vm: " + vmId); return null; } - logger.info("HA on " + vm); + s_logger.info("HA on " + vm); if (vm.getState() != work.getPreviousState() || vm.getUpdated() != work.getUpdateTime()) { - logger.info("VM " + vm + " has been changed. Current State = " + vm.getState() + " Previous State = " + work.getPreviousState() + " last updated = " + + s_logger.info("VM " + vm + " has been changed. Current State = " + vm.getState() + " Previous State = " + work.getPreviousState() + " last updated = " + vm.getUpdated() + " previous updated = " + work.getUpdateTime()); return null; } @@ -457,7 +459,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai if (host == null) { host = _hostDao.findByIdIncludingRemoved(work.getHostId()); if (host != null) { - logger.debug("VM " + vm.toString() + " is now no longer on host " + work.getHostId() + " as the host is removed"); + s_logger.debug("VM " + vm.toString() + " is now no longer on host " + work.getHostId() + " as the host is removed"); isHostRemoved = true; } } @@ -470,7 +472,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai if (work.getStep() == Step.Investigating) { if (!isHostRemoved) { if (vm.getHostId() == null || vm.getHostId() != work.getHostId()) { - logger.info("VM " + vm.toString() + " is now no longer on host " + work.getHostId()); + s_logger.info("VM " + vm.toString() + " is now no longer on host " + work.getHostId()); return null; } @@ -480,19 +482,19 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai try { alive = investigator.isVmAlive(vm, host); - logger.info(investigator.getName() + " found " + vm + " to be alive? " + alive); + s_logger.info(investigator.getName() + " found " + vm + " to be alive? " + alive); break; } catch (UnknownVM e) { - logger.info(investigator.getName() + " could not find " + vm); + s_logger.info(investigator.getName() + " could not find " + vm); } } boolean fenced = false; if (alive == null) { - logger.debug("Fencing off VM that we don't know the state of"); + s_logger.debug("Fencing off VM that we don't know the state of"); for (FenceBuilder fb : fenceBuilders) { Boolean result = fb.fenceOff(vm, host); - logger.info("Fencer " + fb.getName() + " returned " + result); + s_logger.info("Fencer " + fb.getName() + " returned " + result); if (result != null && result) { fenced = true; break; @@ -502,18 +504,18 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } else if (!alive) { fenced = true; } else { - logger.debug("VM " + vm.getInstanceName() + " is found to be alive by " + investigator.getName()); + s_logger.debug("VM " + vm.getInstanceName() + " is found to be alive by " + investigator.getName()); if (host.getStatus() == Status.Up) { - logger.info(vm + " is alive and host is up. No need to restart it."); + s_logger.info(vm + " is alive and host is up. No need to restart it."); return null; } else { - logger.debug("Rescheduling because the host is not up but the vm is alive"); + s_logger.debug("Rescheduling because the host is not up but the vm is alive"); return (System.currentTimeMillis() >> 10) + _investigateRetryInterval; } } if (!fenced) { - logger.debug("We were unable to fence off the VM " + vm); + s_logger.debug("We were unable to fence off the VM " + vm); _alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodIdToDeployIn(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc); @@ -536,7 +538,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai work.setStep(Step.Scheduled); _haDao.update(work.getId(), work); } else { - logger.debug("How come that HA step is Investigating and the host is removed? Calling forced Stop on Vm anyways"); + s_logger.debug("How come that HA step is Investigating and the host is removed? Calling forced Stop on Vm anyways"); try { _itMgr.advanceStop(vm.getUuid(), true); } catch (ResourceUnavailableException e) { @@ -555,22 +557,22 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai vm = _itMgr.findById(vm.getId()); if (!_forceHA && !vm.isHaEnabled()) { - if (logger.isDebugEnabled()) { - logger.debug("VM is not HA enabled so we're done."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("VM is not HA enabled so we're done."); } return null; // VM doesn't require HA } if ((host == null || host.getRemoved() != null || host.getState() != Status.Up) && !volumeMgr.canVmRestartOnAnotherServer(vm.getId())) { - if (logger.isDebugEnabled()) { - logger.debug("VM can not restart on another server."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("VM can not restart on another server."); } return null; } if (work.getTimesTried() > _maxRetries) { - logger.warn("Retried to max times so deleting: " + vmId); + s_logger.warn("Retried to max times so deleting: " + vmId); return null; } @@ -588,33 +590,33 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai // First try starting the vm with its original planner, if it doesn't succeed send HAPlanner as its an emergency. _itMgr.advanceStart(vm.getUuid(), params, null); }catch (InsufficientCapacityException e){ - logger.warn("Failed to deploy vm " + vmId + " with original planner, sending HAPlanner"); + s_logger.warn("Failed to deploy vm " + vmId + " with original planner, sending HAPlanner"); _itMgr.advanceStart(vm.getUuid(), params, _haPlanners.get(0)); } VMInstanceVO started = _instanceDao.findById(vm.getId()); if (started != null && started.getState() == VirtualMachine.State.Running) { - logger.info("VM is now restarted: " + vmId + " on " + started.getHostId()); + s_logger.info("VM is now restarted: " + vmId + " on " + started.getHostId()); return null; } - if (logger.isDebugEnabled()) { - logger.debug("Rescheduling VM " + vm.toString() + " to try again in " + _restartRetryInterval); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Rescheduling VM " + vm.toString() + " to try again in " + _restartRetryInterval); } } catch (final InsufficientCapacityException e) { - logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage()); + s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage()); _alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodIdToDeployIn(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "Insufficient capacity to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc); } catch (final ResourceUnavailableException e) { - logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage()); + s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage()); _alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodIdToDeployIn(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc); } catch (ConcurrentOperationException e) { - logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage()); + s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage()); _alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodIdToDeployIn(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc); } catch (OperationTimedoutException e) { - logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage()); + s_logger.warn("Unable to restart " + vm.toString() + " due to " + e.getMessage()); _alertMgr.sendAlert(alertType, vm.getDataCenterId(), vm.getPodIdToDeployIn(), "Unable to restart " + vm.getHostName() + " which was running on host " + hostDesc, "The Storage is unavailable for trying to restart VM, name: " + vm.getHostName() + ", id: " + vmId + " which was running on host " + hostDesc); } @@ -640,7 +642,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai _itMgr.migrateAway(vm.getUuid(), srcHostId); return null; } catch (InsufficientServerCapacityException e) { - logger.warn("Insufficient capacity for migrating a VM."); + s_logger.warn("Insufficient capacity for migrating a VM."); _resourceMgr.maintenanceFailed(srcHostId); return (System.currentTimeMillis() >> 10) + _migrateRetryInterval; } @@ -650,8 +652,8 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai public void scheduleDestroy(VMInstanceVO vm, long hostId) { final HaWorkVO work = new HaWorkVO(vm.getId(), vm.getType(), WorkType.Destroy, Step.Scheduled, hostId, vm.getState(), 0, vm.getUpdated()); _haDao.persist(work); - if (logger.isDebugEnabled()) { - logger.debug("Scheduled " + work.toString()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Scheduled " + work.toString()); } wakeupWorkers(); } @@ -663,29 +665,29 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai protected Long destroyVM(HaWorkVO work) { final VirtualMachine vm = _itMgr.findById(work.getInstanceId()); - logger.info("Destroying " + vm.toString()); + s_logger.info("Destroying " + vm.toString()); try { if (vm.getState() != State.Destroyed) { - logger.info("VM is no longer in Destroyed state " + vm.toString()); + s_logger.info("VM is no longer in Destroyed state " + vm.toString()); return null; } if (vm.getHostId() != null) { _itMgr.destroy(vm.getUuid()); - logger.info("Successfully destroy " + vm); + s_logger.info("Successfully destroy " + vm); return null; } else { - if (logger.isDebugEnabled()) { - logger.debug(vm + " has already been stopped"); + if (s_logger.isDebugEnabled()) { + s_logger.debug(vm + " has already been stopped"); } return null; } } catch (final AgentUnavailableException e) { - logger.debug("Agnet is not available" + e.getMessage()); + s_logger.debug("Agnet is not available" + e.getMessage()); } catch (OperationTimedoutException e) { - logger.debug("operation timed out: " + e.getMessage()); + s_logger.debug("operation timed out: " + e.getMessage()); } catch (ConcurrentOperationException e) { - logger.debug("concurrent operation: " + e.getMessage()); + s_logger.debug("concurrent operation: " + e.getMessage()); } work.setTimesTried(work.getTimesTried() + 1); @@ -695,50 +697,50 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai protected Long stopVM(final HaWorkVO work) throws ConcurrentOperationException { VirtualMachine vm = _itMgr.findById(work.getInstanceId()); if (vm == null) { - logger.info("No longer can find VM " + work.getInstanceId() + ". Throwing away " + work); + s_logger.info("No longer can find VM " + work.getInstanceId() + ". Throwing away " + work); work.setStep(Step.Done); return null; } - logger.info("Stopping " + vm); + s_logger.info("Stopping " + vm); try { if (work.getWorkType() == WorkType.Stop) { _itMgr.advanceStop(vm.getUuid(), false); - logger.info("Successfully stopped " + vm); + s_logger.info("Successfully stopped " + vm); return null; } else if (work.getWorkType() == WorkType.CheckStop) { if ((vm.getState() != work.getPreviousState()) || vm.getUpdated() != work.getUpdateTime() || vm.getHostId() == null || vm.getHostId().longValue() != work.getHostId()) { - logger.info(vm + " is different now. Scheduled Host: " + work.getHostId() + " Current Host: " + + s_logger.info(vm + " is different now. Scheduled Host: " + work.getHostId() + " Current Host: " + (vm.getHostId() != null ? vm.getHostId() : "none") + " State: " + vm.getState()); return null; } _itMgr.advanceStop(vm.getUuid(), false); - logger.info("Stop for " + vm + " was successful"); + s_logger.info("Stop for " + vm + " was successful"); return null; } else if (work.getWorkType() == WorkType.ForceStop) { if ((vm.getState() != work.getPreviousState()) || vm.getUpdated() != work.getUpdateTime() || vm.getHostId() == null || vm.getHostId().longValue() != work.getHostId()) { - logger.info(vm + " is different now. Scheduled Host: " + work.getHostId() + " Current Host: " + + s_logger.info(vm + " is different now. Scheduled Host: " + work.getHostId() + " Current Host: " + (vm.getHostId() != null ? vm.getHostId() : "none") + " State: " + vm.getState()); return null; } _itMgr.advanceStop(vm.getUuid(), true); - logger.info("Stop for " + vm + " was successful"); + s_logger.info("Stop for " + vm + " was successful"); return null; } else { assert false : "Who decided there's other steps but didn't modify the guy who does the work?"; } } catch (final ResourceUnavailableException e) { - logger.debug("Agnet is not available" + e.getMessage()); + s_logger.debug("Agnet is not available" + e.getMessage()); } catch (OperationTimedoutException e) { - logger.debug("operation timed out: " + e.getMessage()); + s_logger.debug("operation timed out: " + e.getMessage()); } work.setTimesTried(work.getTimesTried() + 1); - if (logger.isDebugEnabled()) { - logger.debug("Stop was unsuccessful. Rescheduling"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Stop was unsuccessful. Rescheduling"); } return (System.currentTimeMillis() >> 10) + _stopRetryInterval; } @@ -847,12 +849,12 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai protected class CleanupTask extends ManagedContextRunnable { @Override protected void runInContext() { - logger.info("HA Cleanup Thread Running"); + s_logger.info("HA Cleanup Thread Running"); try { _haDao.cleanup(System.currentTimeMillis() - _timeBetweenFailures); } catch (Exception e) { - logger.warn("Error while cleaning up", e); + s_logger.warn("Error while cleaning up", e); } } } @@ -864,7 +866,7 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai @Override public void run() { - logger.info("Starting work"); + s_logger.info("Starting work"); while (!_stopped) { _managedContext.runWithContext(new Runnable() { @Override @@ -873,13 +875,13 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } }); } - logger.info("Time to go home!"); + s_logger.info("Time to go home!"); } private void runWithContext() { HaWorkVO work = null; try { - logger.trace("Checking the database"); + s_logger.trace("Checking the database"); work = _haDao.take(_serverId); if (work == null) { try { @@ -888,13 +890,13 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } return; } catch (final InterruptedException e) { - logger.info("Interrupted"); + s_logger.info("Interrupted"); return; } } NDC.push("work-" + work.getId()); - logger.info("Processing " + work); + s_logger.info("Processing " + work); try { final WorkType wt = work.getWorkType(); @@ -913,21 +915,21 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai } if (nextTime == null) { - logger.info("Completed " + work); + s_logger.info("Completed " + work); work.setStep(Step.Done); } else { - logger.info("Rescheduling " + work + " to try again at " + new Date(nextTime << 10)); + s_logger.info("Rescheduling " + work + " to try again at " + new Date(nextTime << 10)); work.setTimeToTry(nextTime); work.setTimesTried(work.getTimesTried() + 1); work.setServerId(null); work.setDateTaken(null); } } catch (Exception e) { - logger.warn("Encountered unhandled exception during HA process, reschedule retry", e); + s_logger.warn("Encountered unhandled exception during HA process, reschedule retry", e); long nextTime = (System.currentTimeMillis() >> 10) + _restartRetryInterval; - logger.info("Rescheduling " + work + " to try again at " + new Date(nextTime << 10)); + s_logger.info("Rescheduling " + work + " to try again at " + new Date(nextTime << 10)); work.setTimeToTry(nextTime); work.setTimesTried(work.getTimesTried() + 1); work.setServerId(null); @@ -939,13 +941,13 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai work.setUpdateTime(vm.getUpdated()); work.setPreviousState(vm.getState()); if (!Step.Done.equals(work.getStep()) && work.getTimesTried() >= _maxRetries) { - logger.warn("Giving up, retries max times for work: " + work); + s_logger.warn("Giving up, retries max times for work: " + work); work.setStep(Step.Done); } } _haDao.update(work.getId(), work); } catch (final Throwable th) { - logger.error("Caught this throwable, ", th); + s_logger.error("Caught this throwable, ", th); } finally { if (work != null) { NDC.pop(); http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/KVMFencer.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/KVMFencer.java b/server/src/com/cloud/ha/KVMFencer.java index fb76d82..b5834ef 100644 --- a/server/src/com/cloud/ha/KVMFencer.java +++ b/server/src/com/cloud/ha/KVMFencer.java @@ -23,6 +23,7 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.alert.AlertManager; @@ -41,6 +42,7 @@ import com.cloud.vm.VirtualMachine; @Local(value = FenceBuilder.class) public class KVMFencer extends AdapterBase implements FenceBuilder { + private static final Logger s_logger = Logger.getLogger(KVMFencer.class); @Inject HostDao _hostDao; @@ -76,7 +78,7 @@ public class KVMFencer extends AdapterBase implements FenceBuilder { @Override public Boolean fenceOff(VirtualMachine vm, Host host) { if (host.getHypervisorType() != HypervisorType.KVM && host.getHypervisorType() != HypervisorType.LXC) { - logger.warn("Don't know how to fence non kvm hosts " + host.getHypervisorType()); + s_logger.warn("Don't know how to fence non kvm hosts " + host.getHypervisorType()); return null; } @@ -99,10 +101,10 @@ public class KVMFencer extends AdapterBase implements FenceBuilder { try { answer = (FenceAnswer)_agentMgr.send(h.getId(), fence); } catch (AgentUnavailableException e) { - logger.info("Moving on to the next host because " + h.toString() + " is unavailable"); + s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable"); continue; } catch (OperationTimedoutException e) { - logger.info("Moving on to the next host because " + h.toString() + " is unavailable"); + s_logger.info("Moving on to the next host because " + h.toString() + " is unavailable"); continue; } if (answer != null && answer.getResult()) { @@ -116,7 +118,7 @@ public class KVMFencer extends AdapterBase implements FenceBuilder { "Fencing off host " + host.getId() + " did not succeed after asking " + i + " hosts. " + "Check Agent logs for more information."); - logger.error("Unable to fence off " + vm.toString() + " on " + host.toString()); + s_logger.error("Unable to fence off " + vm.toString() + " on " + host.toString()); return false; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java b/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java index 5835fbc..9f361b0 100644 --- a/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java +++ b/server/src/com/cloud/ha/ManagementIPSystemVMInvestigator.java @@ -21,6 +21,7 @@ import java.util.List; import javax.ejb.Local; import javax.inject.Inject; +import org.apache.log4j.Logger; import com.cloud.host.Host; import com.cloud.host.HostVO; @@ -33,6 +34,7 @@ import com.cloud.vm.VirtualMachine; @Local(value = {Investigator.class}) public class ManagementIPSystemVMInvestigator extends AbstractInvestigatorImpl { + private static final Logger s_logger = Logger.getLogger(ManagementIPSystemVMInvestigator.class); @Inject private final HostDao _hostDao = null; @@ -42,28 +44,28 @@ public class ManagementIPSystemVMInvestigator extends AbstractInvestigatorImpl { @Override public boolean isVmAlive(VirtualMachine vm, Host host) throws UnknownVM { if (!vm.getType().isUsedBySystem()) { - logger.debug("Not a System Vm, unable to determine state of " + vm + " returning null"); + s_logger.debug("Not a System Vm, unable to determine state of " + vm + " returning null"); } - if (logger.isDebugEnabled()) { - logger.debug("Testing if " + vm + " is alive"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Testing if " + vm + " is alive"); } if (vm.getHostId() == null) { - logger.debug("There's no host id for " + vm); + s_logger.debug("There's no host id for " + vm); throw new UnknownVM(); } HostVO vmHost = _hostDao.findById(vm.getHostId()); if (vmHost == null) { - logger.debug("Unable to retrieve the host by using id " + vm.getHostId()); + s_logger.debug("Unable to retrieve the host by using id " + vm.getHostId()); throw new UnknownVM(); } List<? extends Nic> nics = _networkMgr.getNicsForTraffic(vm.getId(), TrafficType.Management); if (nics.size() == 0) { - if (logger.isDebugEnabled()) { - logger.debug("Unable to find a management nic, cannot ping this system VM, unable to determine state of " + vm + " returning null"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Unable to find a management nic, cannot ping this system VM, unable to determine state of " + vm + " returning null"); } throw new UnknownVM(); } @@ -79,8 +81,8 @@ public class ManagementIPSystemVMInvestigator extends AbstractInvestigatorImpl { assert vmState != null; // In case of Status.Unknown, next host will be tried if (vmState == Status.Up) { - if (logger.isDebugEnabled()) { - logger.debug("successfully pinged vm's private IP (" + vm.getPrivateIpAddress() + "), returning that the VM is up"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("successfully pinged vm's private IP (" + vm.getPrivateIpAddress() + "), returning that the VM is up"); } return Boolean.TRUE; } else if (vmState == Status.Down) { @@ -89,8 +91,8 @@ public class ManagementIPSystemVMInvestigator extends AbstractInvestigatorImpl { Status vmHostState = testIpAddress(otherHost, vmHost.getPrivateIpAddress()); assert vmHostState != null; if (vmHostState == Status.Up) { - if (logger.isDebugEnabled()) { - logger.debug("successfully pinged vm's host IP (" + vmHost.getPrivateIpAddress() + + if (s_logger.isDebugEnabled()) { + s_logger.debug("successfully pinged vm's host IP (" + vmHost.getPrivateIpAddress() + "), but could not ping VM, returning that the VM is down"); } return Boolean.FALSE; @@ -99,8 +101,8 @@ public class ManagementIPSystemVMInvestigator extends AbstractInvestigatorImpl { } } - if (logger.isDebugEnabled()) { - logger.debug("unable to determine state of " + vm + " returning null"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("unable to determine state of " + vm + " returning null"); } throw new UnknownVM(); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/RecreatableFencer.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/RecreatableFencer.java b/server/src/com/cloud/ha/RecreatableFencer.java index fbfc1a7..4aa7438 100644 --- a/server/src/com/cloud/ha/RecreatableFencer.java +++ b/server/src/com/cloud/ha/RecreatableFencer.java @@ -21,6 +21,7 @@ import java.util.List; import javax.ejb.Local; import javax.inject.Inject; +import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; @@ -34,6 +35,7 @@ import com.cloud.vm.VirtualMachine; @Component @Local(value = FenceBuilder.class) public class RecreatableFencer extends AdapterBase implements FenceBuilder { + private static final Logger s_logger = Logger.getLogger(RecreatableFencer.class); @Inject VolumeDao _volsDao; @Inject @@ -47,22 +49,22 @@ public class RecreatableFencer extends AdapterBase implements FenceBuilder { public Boolean fenceOff(VirtualMachine vm, Host host) { VirtualMachine.Type type = vm.getType(); if (type != VirtualMachine.Type.ConsoleProxy && type != VirtualMachine.Type.DomainRouter && type != VirtualMachine.Type.SecondaryStorageVm) { - if (logger.isDebugEnabled()) { - logger.debug("Don't know how to fence off " + type); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Don't know how to fence off " + type); } return null; } List<VolumeVO> vols = _volsDao.findByInstance(vm.getId()); for (VolumeVO vol : vols) { if (!vol.isRecreatable()) { - if (logger.isDebugEnabled()) { - logger.debug("Unable to fence off volumes that are not recreatable: " + vol); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Unable to fence off volumes that are not recreatable: " + vol); } return null; } if (vol.getPoolType().isShared()) { - if (logger.isDebugEnabled()) { - logger.debug("Unable to fence off volumes that are shared: " + vol); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Unable to fence off volumes that are shared: " + vol); } return null; } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/UserVmDomRInvestigator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/UserVmDomRInvestigator.java b/server/src/com/cloud/ha/UserVmDomRInvestigator.java index e747c00..63d9bf0 100644 --- a/server/src/com/cloud/ha/UserVmDomRInvestigator.java +++ b/server/src/com/cloud/ha/UserVmDomRInvestigator.java @@ -22,6 +22,7 @@ import java.util.List; import javax.ejb.Local; import javax.inject.Inject; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -40,6 +41,7 @@ import com.cloud.vm.dao.UserVmDao; @Local(value = {Investigator.class}) public class UserVmDomRInvestigator extends AbstractInvestigatorImpl { + private static final Logger s_logger = Logger.getLogger(UserVmDomRInvestigator.class); @Inject private final UserVmDao _userVmDao = null; @@ -53,14 +55,14 @@ public class UserVmDomRInvestigator extends AbstractInvestigatorImpl { @Override public boolean isVmAlive(VirtualMachine vm, Host host) throws UnknownVM { if (vm.getType() != VirtualMachine.Type.User) { - if (logger.isDebugEnabled()) { - logger.debug("Not a User Vm, unable to determine state of " + vm + " returning null"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Not a User Vm, unable to determine state of " + vm + " returning null"); } throw new UnknownVM(); } - if (logger.isDebugEnabled()) { - logger.debug("testing if " + vm + " is alive"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("testing if " + vm + " is alive"); } // to verify that the VM is alive, we ask the domR (router) to ping the VM (private IP) UserVmVO userVm = _userVmDao.findById(vm.getId()); @@ -74,8 +76,8 @@ public class UserVmDomRInvestigator extends AbstractInvestigatorImpl { List<VirtualRouter> routers = _vnaMgr.getRoutersForNetwork(nic.getNetworkId()); if (routers == null || routers.isEmpty()) { - if (logger.isDebugEnabled()) { - logger.debug("Unable to find a router in network " + nic.getNetworkId() + " to ping " + vm); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Unable to find a router in network " + nic.getNetworkId() + " to ping " + vm); } continue; } @@ -95,16 +97,16 @@ public class UserVmDomRInvestigator extends AbstractInvestigatorImpl { return result; } - if (logger.isDebugEnabled()) { - logger.debug("Returning null since we're unable to determine state of " + vm); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Returning null since we're unable to determine state of " + vm); } throw new UnknownVM(); } @Override public Status isAgentAlive(Host agent) { - if (logger.isDebugEnabled()) { - logger.debug("checking if agent (" + agent.getId() + ") is alive"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("checking if agent (" + agent.getId() + ") is alive"); } if (agent.getPodId() == null) { @@ -114,29 +116,29 @@ public class UserVmDomRInvestigator extends AbstractInvestigatorImpl { List<Long> otherHosts = findHostByPod(agent.getPodId(), agent.getId()); for (Long hostId : otherHosts) { - if (logger.isDebugEnabled()) { - logger.debug("sending ping from (" + hostId + ") to agent's host ip address (" + agent.getPrivateIpAddress() + ")"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("sending ping from (" + hostId + ") to agent's host ip address (" + agent.getPrivateIpAddress() + ")"); } Status hostState = testIpAddress(hostId, agent.getPrivateIpAddress()); assert hostState != null; // In case of Status.Unknown, next host will be tried if (hostState == Status.Up) { - if (logger.isDebugEnabled()) { - logger.debug("ping from (" + hostId + ") to agent's host ip address (" + agent.getPrivateIpAddress() + + if (s_logger.isDebugEnabled()) { + s_logger.debug("ping from (" + hostId + ") to agent's host ip address (" + agent.getPrivateIpAddress() + ") successful, returning that agent is disconnected"); } return Status.Disconnected; // the computing host ip is ping-able, but the computing agent is down, report that the agent is disconnected } else if (hostState == Status.Down) { - if (logger.isDebugEnabled()) { - logger.debug("returning host state: " + hostState); + if (s_logger.isDebugEnabled()) { + s_logger.debug("returning host state: " + hostState); } return Status.Down; } } // could not reach agent, could not reach agent's host, unclear what the problem is but it'll require more investigation... - if (logger.isDebugEnabled()) { - logger.debug("could not reach agent, could not reach agent's host, returning that we don't have enough information"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("could not reach agent, could not reach agent's host, returning that we don't have enough information"); } return null; } @@ -165,21 +167,21 @@ public class UserVmDomRInvestigator extends AbstractInvestigatorImpl { try { Answer pingTestAnswer = _agentMgr.easySend(hostId, new PingTestCommand(routerPrivateIp, privateIp)); if (pingTestAnswer != null && pingTestAnswer.getResult()) { - if (logger.isDebugEnabled()) { - logger.debug("user vm's " + vm.getHostName() + " ip address " + privateIp + " has been successfully pinged from the Virtual Router " + + if (s_logger.isDebugEnabled()) { + s_logger.debug("user vm's " + vm.getHostName() + " ip address " + privateIp + " has been successfully pinged from the Virtual Router " + router.getHostName() + ", returning that vm is alive"); } return Boolean.TRUE; } } catch (Exception e) { - if (logger.isDebugEnabled()) { - logger.debug("Couldn't reach due to", e); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Couldn't reach due to", e); } continue; } } - if (logger.isDebugEnabled()) { - logger.debug(vm + " could not be pinged, returning that it is unknown"); + if (s_logger.isDebugEnabled()) { + s_logger.debug(vm + " could not be pinged, returning that it is unknown"); } return null; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/XenServerInvestigator.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/XenServerInvestigator.java b/server/src/com/cloud/ha/XenServerInvestigator.java index 8cdb80c..07eb76b 100644 --- a/server/src/com/cloud/ha/XenServerInvestigator.java +++ b/server/src/com/cloud/ha/XenServerInvestigator.java @@ -21,6 +21,7 @@ import java.util.List; import javax.ejb.Local; import javax.inject.Inject; +import org.apache.log4j.Logger; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -37,6 +38,7 @@ import com.cloud.vm.VirtualMachine; @Local(value = Investigator.class) public class XenServerInvestigator extends AdapterBase implements Investigator { + private final static Logger s_logger = Logger.getLogger(XenServerInvestigator.class); @Inject HostDao _hostDao; @Inject @@ -63,7 +65,7 @@ public class XenServerInvestigator extends AdapterBase implements Investigator { if (answer != null && answer.getResult()) { CheckOnHostAnswer ans = (CheckOnHostAnswer)answer; if (!ans.isDetermined()) { - logger.debug("Host " + neighbor + " couldn't determine the status of " + agent); + s_logger.debug("Host " + neighbor + " couldn't determine the status of " + agent); continue; } // even it returns true, that means host is up, but XAPI may not work http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java b/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java index 4a88695..724f4f6 100644 --- a/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java +++ b/server/src/com/cloud/ha/dao/HighAvailabilityDaoImpl.java @@ -21,6 +21,7 @@ import java.util.List; import javax.ejb.Local; +import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import com.cloud.ha.HaWorkVO; @@ -37,6 +38,7 @@ import com.cloud.utils.exception.CloudRuntimeException; @Component @Local(value = {HighAvailabilityDao.class}) public class HighAvailabilityDaoImpl extends GenericDaoBase<HaWorkVO, Long> implements HighAvailabilityDao { + private static final Logger s_logger = Logger.getLogger(HighAvailabilityDaoImpl.class); private final SearchBuilder<HaWorkVO> TBASearch; private final SearchBuilder<HaWorkVO> PreviousInstanceSearch; http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/server/src/com/cloud/hypervisor/CloudZonesStartupProcessor.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/hypervisor/CloudZonesStartupProcessor.java b/server/src/com/cloud/hypervisor/CloudZonesStartupProcessor.java index 8f562c8..d407b84 100644 --- a/server/src/com/cloud/hypervisor/CloudZonesStartupProcessor.java +++ b/server/src/com/cloud/hypervisor/CloudZonesStartupProcessor.java @@ -23,6 +23,7 @@ import javax.ejb.Local; import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.log4j.Logger; import org.springframework.stereotype.Component; import org.apache.cloudstack.api.ResourceDetail; @@ -60,6 +61,7 @@ import com.cloud.utils.net.NetUtils; @Component @Local(value = StartupCommandProcessor.class) public class CloudZonesStartupProcessor extends AdapterBase implements StartupCommandProcessor { + private static final Logger s_logger = Logger.getLogger(CloudZonesStartupProcessor.class); @Inject ClusterDao _clusterDao = null; @Inject @@ -113,8 +115,8 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo server = _hostDao.findByGuid(startup.getGuidWithoutResource()); } if (server != null && server.getRemoved() == null) { - if (logger.isDebugEnabled()) { - logger.debug("Found the host " + server.getId() + " by guid: " + if (s_logger.isDebugEnabled()) { + s_logger.debug("Found the host " + server.getId() + " by guid: " + startup.getGuid()); } found = true; @@ -138,7 +140,7 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo "Agent cannot connect because the current state is " + server.getStatus().toString()); } - logger.info("Old " + server.getType().toString() + s_logger.info("Old " + server.getType().toString() + " host reconnected w/ id =" + server.getId()); } */ @@ -150,7 +152,7 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo String zoneToken = startup.getDataCenter(); if (zoneToken == null) { - logger.warn("No Zone Token passed in, cannot not find zone for the agent"); + s_logger.warn("No Zone Token passed in, cannot not find zone for the agent"); throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent"); } @@ -169,8 +171,8 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo } } } - if (logger.isDebugEnabled()) { - logger.debug("Successfully loaded the DataCenter from the zone token passed in "); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Successfully loaded the DataCenter from the zone token passed in "); } long zoneId = zone.getId(); @@ -178,8 +180,8 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo if (maxHostsInZone != null) { long maxHosts = Long.parseLong(maxHostsInZone.getValue()); long currentCountOfHosts = _hostDao.countRoutingHostsByDataCenter(zoneId); - if (logger.isDebugEnabled()) { - logger.debug("Number of hosts in Zone:" + currentCountOfHosts + ", max hosts limit: " + maxHosts); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Number of hosts in Zone:" + currentCountOfHosts + ", max hosts limit: " + maxHosts); } if (currentCountOfHosts >= maxHosts) { throw new AgentAuthnException("Number of running Routing hosts in the Zone:" + zone.getName() + " is already at the max limit:" + maxHosts + @@ -190,24 +192,24 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo HostPodVO pod = null; if (startup.getPrivateIpAddress() == null) { - logger.warn("No private IP address passed in for the agent, cannot not find pod for agent"); + s_logger.warn("No private IP address passed in for the agent, cannot not find pod for agent"); throw new AgentAuthnException("No private IP address passed in for the agent, cannot not find pod for agent"); } if (startup.getPrivateNetmask() == null) { - logger.warn("No netmask passed in for the agent, cannot not find pod for agent"); + s_logger.warn("No netmask passed in for the agent, cannot not find pod for agent"); throw new AgentAuthnException("No netmask passed in for the agent, cannot not find pod for agent"); } if (host.getPodId() != null) { - if (logger.isDebugEnabled()) { - logger.debug("Pod is already created for this agent, looks like agent is reconnecting..."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Pod is already created for this agent, looks like agent is reconnecting..."); } pod = _podDao.findById(host.getPodId()); if (!checkCIDR(type, pod, startup.getPrivateIpAddress(), startup.getPrivateNetmask())) { pod = null; - if (logger.isDebugEnabled()) { - logger.debug("Subnet of Pod does not match the subnet of the agent, not using this Pod: " + host.getPodId()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Subnet of Pod does not match the subnet of the agent, not using this Pod: " + host.getPodId()); } } else { updatePodNetmaskIfNeeded(pod, startup.getPrivateNetmask()); @@ -215,8 +217,8 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo } if (pod == null) { - if (logger.isDebugEnabled()) { - logger.debug("Trying to detect the Pod to use from the agent's ip address and netmask passed in "); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Trying to detect the Pod to use from the agent's ip address and netmask passed in "); } //deduce pod @@ -234,12 +236,12 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo } if (!podFound) { - if (logger.isDebugEnabled()) { - logger.debug("Creating a new Pod since no default Pod found that matches the agent's ip address and netmask passed in "); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Creating a new Pod since no default Pod found that matches the agent's ip address and netmask passed in "); } if (startup.getGatewayIpAddress() == null) { - logger.warn("No Gateway IP address passed in for the agent, cannot create a new pod for the agent"); + s_logger.warn("No Gateway IP address passed in for the agent, cannot create a new pod for the agent"); throw new AgentAuthnException("No Gateway IP address passed in for the agent, cannot create a new pod for the agent"); } //auto-create a new pod, since pod matching the agent's ip is not found @@ -264,8 +266,8 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo ClusterVO cluster = null; if (host.getClusterId() != null) { - if (logger.isDebugEnabled()) { - logger.debug("Cluster is already created for this agent, looks like agent is reconnecting..."); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Cluster is already created for this agent, looks like agent is reconnecting..."); } cluster = _clusterDao.findById(host.getClusterId()); } @@ -276,8 +278,8 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo if (existingCluster != null) { cluster = existingCluster; } else { - if (logger.isDebugEnabled()) { - logger.debug("Creating a new Cluster for this agent with name: " + clusterName + " in Pod: " + pod.getId() + ", in Zone:" + zoneId); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Creating a new Cluster for this agent with name: " + clusterName + " in Pod: " + pod.getId() + ", in Zone:" + zoneId); } cluster = new ClusterVO(zoneId, pod.getId(), clusterName); @@ -291,8 +293,8 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo } } - if (logger.isDebugEnabled()) { - logger.debug("Detected Zone: " + zoneId + ", Pod: " + pod.getId() + ", Cluster:" + cluster.getId()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Detected Zone: " + zoneId + ", Pod: " + pod.getId() + ", Cluster:" + cluster.getId()); } host.setDataCenterId(zone.getId()); host.setPodId(pod.getId()); @@ -368,8 +370,8 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo server = _hostDao.findByGuid(startup.getGuidWithoutResource()); } if (server != null && server.getRemoved() == null) { - if (logger.isDebugEnabled()) { - logger.debug("Found the host " + server.getId() + " by guid: " + if (s_logger.isDebugEnabled()) { + s_logger.debug("Found the host " + server.getId() + " by guid: " + startup.getGuid()); } found = true; @@ -393,7 +395,7 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo "Agent cannot connect because the current state is " + server.getStatus().toString()); } - logger.info("Old " + server.getType().toString() + s_logger.info("Old " + server.getType().toString() + " host reconnected w/ id =" + server.getId()); } */ @@ -405,7 +407,7 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo String zoneToken = startup.getDataCenter(); if (zoneToken == null) { - logger.warn("No Zone Token passed in, cannot not find zone for the agent"); + s_logger.warn("No Zone Token passed in, cannot not find zone for the agent"); throw new AgentAuthnException("No Zone Token passed in, cannot not find zone for agent"); } @@ -424,14 +426,14 @@ public class CloudZonesStartupProcessor extends AdapterBase implements StartupCo } } } - if (logger.isDebugEnabled()) { - logger.debug("Successfully loaded the DataCenter from the zone token passed in "); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Successfully loaded the DataCenter from the zone token passed in "); } HostPodVO pod = findPod(startup, zone.getId(), Host.Type.Routing); //yes, routing Long podId = null; if (pod != null) { - logger.debug("Found pod " + pod.getName() + " for the secondary storage host " + startup.getName()); + s_logger.debug("Found pod " + pod.getName() + " for the secondary storage host " + startup.getName()); podId = pod.getId(); } host.setDataCenterId(zone.getId());
