cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [26/35] git commit: updated refs/heads/master to 8bc0294
Date Mon, 31 Aug 2015 06:01:46 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java
index 47fa239..8b4b453 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java
@@ -34,6 +34,7 @@ import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.api.ApiConstants;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.StartupCommand;
 import com.cloud.agent.api.StartupRoutingCommand;
@@ -62,6 +63,7 @@ import com.cloud.vm.dao.VMInstanceDao;
 
 @Local(value = Discoverer.class)
 public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter {
+    protected static final Logger s_logger = Logger.getLogger(BareMetalDiscoverer.class);
     @Inject
     protected VMInstanceDao _vmDao = null;
 
@@ -92,25 +94,25 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R
 
         if (!url.getScheme().equals("http")) {
             String msg = "urlString is not http so we're not taking care of the discovery for this: " + url;
-            logger.debug(msg);
+            s_logger.debug(msg);
             return null;
         }
         if (clusterId == null) {
             String msg = "must specify cluster Id when add host";
-            logger.debug(msg);
+            s_logger.debug(msg);
             throw new RuntimeException(msg);
         }
 
         if (podId == null) {
             String msg = "must specify pod Id when add host";
-            logger.debug(msg);
+            s_logger.debug(msg);
             throw new RuntimeException(msg);
         }
 
         ClusterVO cluster = _clusterDao.findById(clusterId);
         if (cluster == null || (cluster.getHypervisorType() != HypervisorType.BareMetal)) {
-            if (logger.isInfoEnabled())
-                logger.info("invalid cluster id or cluster is not for Bare Metal hosts");
+            if (s_logger.isInfoEnabled())
+                s_logger.info("invalid cluster id or cluster is not for Bare Metal hosts");
             return null;
         }
 
@@ -132,14 +134,14 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R
                         + injectScript);
             }
 
-            final Script2 command = new Script2(scriptPath, logger);
+            final Script2 command = new Script2(scriptPath, s_logger);
             command.add("ping");
             command.add("hostname="+ipmiIp);
             command.add("usrname="+username);
             command.add("password="+password, ParamType.PASSWORD);
             final String result = command.execute();
             if (result != null) {
-                logger.warn(String.format("Can not set up ipmi connection(ip=%1$s, username=%2$s, password=%3$s, args) because %4$s", ipmiIp, username, "******", result));
+                s_logger.warn(String.format("Can not set up ipmi connection(ip=%1$s, username=%2$s, password=%3$s, args) because %4$s", ipmiIp, username, "******", result));
                 return null;
             }
 
@@ -205,11 +207,11 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R
             zone.setDhcpProvider(Network.Provider.ExternalDhcpServer.getName());
             _dcDao.update(zone.getId(), zone);
 
-            logger.debug(String.format("Discover Bare Metal host successfully(ip=%1$s, username=%2$s, password=%3%s," +
+            s_logger.debug(String.format("Discover Bare Metal host successfully(ip=%1$s, username=%2$s, password=%3%s," +
                     "cpuNum=%4$s, cpuCapacity-%5$s, memCapacity=%6$s)", ipmiIp, username, "******", cpuNum, cpuCapacity, memCapacity));
             return resources;
         } catch (Exception e) {
-            logger.warn("Can not set up bare metal agent", e);
+            s_logger.warn("Can not set up bare metal agent", e);
         }
 
         return null;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java
index 9b46cfd..8f439cd 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java
@@ -28,6 +28,7 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.host.dao.HostDao;
@@ -42,6 +43,7 @@ import com.cloud.vm.dao.VMInstanceDao;
 
 @Local(value = HypervisorGuru.class)
 public class BareMetalGuru extends HypervisorGuruBase implements HypervisorGuru {
+    private static final Logger s_logger = Logger.getLogger(BareMetalGuru.class);
     @Inject
     GuestOSDao _guestOsDao;
     @Inject

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
index aa11448..2f93ec7 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java
@@ -23,6 +23,7 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
 
@@ -52,6 +53,7 @@ import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value = DeploymentPlanner.class)
 public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
+    private static final Logger s_logger = Logger.getLogger(BareMetalPlanner.class);
     @Inject
     protected DataCenterDao _dcDao;
     @Inject
@@ -82,7 +84,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
             DataCenter dc = _dcDao.findById(h.getDataCenterId());
             Pod pod = _podDao.findById(h.getPodId());
             Cluster c = _clusterDao.findById(h.getClusterId());
-            logger.debug("Start baremetal vm " + vm.getId() + " on last stayed host " + h.getId());
+            s_logger.debug("Start baremetal vm " + vm.getId() + " on last stayed host " + h.getId());
             return new DeployDestination(dc, pod, c, h);
         }
 
@@ -114,7 +116,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
         }
 
         if (target == null) {
-            logger.warn("Cannot find host with tag " + hostTag + " use capacity from service offering");
+            s_logger.warn("Cannot find host with tag " + hostTag + " use capacity from service offering");
             cpu_requested = offering.getCpu() * offering.getSpeed();
             ram_requested = offering.getRamSize() * 1024L * 1024L;
         } else {
@@ -126,7 +128,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
             if (haVmTag == null) {
                 hosts = _resourceMgr.listAllUpAndEnabledNonHAHosts(Host.Type.Routing, cluster.getId(), cluster.getPodId(), cluster.getDataCenterId());
             } else {
-                logger.warn("Cannot find HA host with tag " + haVmTag + " in cluster id=" + cluster.getId() + ", pod id=" + cluster.getPodId() + ", data center id=" +
+                s_logger.warn("Cannot find HA host with tag " + haVmTag + " in cluster id=" + cluster.getId() + ", pod id=" + cluster.getPodId() + ", data center id=" +
                     cluster.getDataCenterId());
                 return null;
             }
@@ -138,7 +140,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
                 Float memoryOvercommitRatio = Float.parseFloat(cluster_detail_ram.getValue());
 
                 if (_capacityMgr.checkIfHostHasCapacity(h.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio, true)) {
-                    logger.debug("Find host " + h.getId() + " has enough capacity");
+                    s_logger.debug("Find host " + h.getId() + " has enough capacity");
                     DataCenter dc = _dcDao.findById(h.getDataCenterId());
                     Pod pod = _podDao.findById(h.getPodId());
                     return new DeployDestination(dc, pod, cluster, h);
@@ -146,7 +148,7 @@ public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner {
             }
         }
 
-        logger.warn(String.format("Cannot find enough capacity(requested cpu=%1$s memory=%2$s)", cpu_requested, ram_requested));
+        s_logger.warn(String.format("Cannot find enough capacity(requested cpu=%1$s memory=%2$s)", cpu_requested, ram_requested));
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalTemplateAdapter.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalTemplateAdapter.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalTemplateAdapter.java
index 6d74119..17dab00 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalTemplateAdapter.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalTemplateAdapter.java
@@ -44,6 +44,7 @@ import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd;
 import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd;
 import org.apache.cloudstack.storage.command.TemplateOrVolumePostUploadCommand;
 import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
+import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
@@ -52,6 +53,7 @@ import java.util.List;
 
 @Local(value = TemplateAdapter.class)
 public class BareMetalTemplateAdapter extends TemplateAdapterBase implements TemplateAdapter {
+    private final static Logger s_logger = Logger.getLogger(BareMetalTemplateAdapter.class);
     @Inject
     HostDao _hostDao;
     @Inject
@@ -129,7 +131,7 @@ public class BareMetalTemplateAdapter extends TemplateAdapterBase implements Tem
             zoneName = "all zones";
         }
 
-        logger.debug("Attempting to mark template host refs for template: " + template.getName() + " as destroyed in zone: " + zoneName);
+        s_logger.debug("Attempting to mark template host refs for template: " + template.getName() + " as destroyed in zone: " + zoneName);
         Account account = _accountDao.findByIdIncludingRemoved(template.getAccountId());
         String eventType = EventTypes.EVENT_TEMPLATE_DELETE;
         List<TemplateDataStoreVO> templateHostVOs = this._tmpltStoreDao.listByTemplate(templateId);
@@ -139,7 +141,7 @@ public class BareMetalTemplateAdapter extends TemplateAdapterBase implements Tem
             try {
                 lock = _tmpltStoreDao.acquireInLockTable(vo.getId());
                 if (lock == null) {
-                    logger.debug("Failed to acquire lock when deleting templateDataStoreVO with ID: " + vo.getId());
+                    s_logger.debug("Failed to acquire lock when deleting templateDataStoreVO with ID: " + vo.getId());
                     success = false;
                     break;
                 }
@@ -171,7 +173,7 @@ public class BareMetalTemplateAdapter extends TemplateAdapterBase implements Tem
             _tmpltZoneDao.remove(templateZone.getId());
         }
 
-        logger.debug("Successfully marked template host refs for template: " + template.getName() + " as destroyed in zone: " + zoneName);
+        s_logger.debug("Successfully marked template host refs for template: " + template.getName() + " as destroyed in zone: " + zoneName);
 
         // If there are no more non-destroyed template host entries for this template, delete it
         if (success && (_tmpltStoreDao.listByTemplate(templateId).size() == 0)) {
@@ -181,7 +183,7 @@ public class BareMetalTemplateAdapter extends TemplateAdapterBase implements Tem
 
             try {
                 if (lock == null) {
-                    logger.debug("Failed to acquire lock when deleting template with ID: " + templateId);
+                    s_logger.debug("Failed to acquire lock when deleting template with ID: " + templateId);
                     success = false;
                 } else if (_tmpltDao.remove(templateId)) {
                     // Decrement the number of templates and total secondary storage space used by the account.
@@ -194,7 +196,7 @@ public class BareMetalTemplateAdapter extends TemplateAdapterBase implements Tem
                     _tmpltDao.releaseFromLockTable(lock.getId());
                 }
             }
-            logger.debug("Removed template: " + template.getName() + " because all of its template host refs were marked as destroyed.");
+            s_logger.debug("Removed template: " + template.getName() + " because all of its template host refs were marked as destroyed.");
         }
 
         return success;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java
index 61f4215..f826ae9 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java
@@ -33,6 +33,7 @@ import com.cloud.utils.fsm.StateMachine2;
 import com.cloud.vm.VMInstanceVO;
 import com.cloud.vm.dao.VMInstanceDao;
 import org.apache.cloudstack.api.BaremetalProvisionDoneNotificationCmd;
+import org.apache.log4j.Logger;
 
 import org.apache.cloudstack.api.AddBaremetalHostCmd;
 
@@ -47,6 +48,7 @@ import com.cloud.vm.VirtualMachine.State;
 
 @Local(value = {BaremetalManager.class})
 public class BaremetalManagerImpl extends ManagerBase implements BaremetalManager, StateListener<State, VirtualMachine.Event, VirtualMachine> {
+    private static final Logger s_logger = Logger.getLogger(BaremetalManagerImpl.class);
 
     @Inject
     protected HostDao _hostDao;
@@ -93,17 +95,17 @@ public class BaremetalManagerImpl extends ManagerBase implements BaremetalManage
 
       HostVO host = _hostDao.findById(vo.getHostId());
       if (host == null) {
-        logger.debug("Skip oldState " + oldState + " to " + "newState " + newState + " transimtion");
+        s_logger.debug("Skip oldState " + oldState + " to " + "newState " + newState + " transimtion");
         return true;
       }
       _hostDao.loadDetails(host);
 
       if (newState == State.Starting) {
         host.setDetail("vmName", vo.getInstanceName());
-        logger.debug("Add vmName " + host.getDetail("vmName") + " to host " + host.getId() + " details");
+        s_logger.debug("Add vmName " + host.getDetail("vmName") + " to host " + host.getId() + " details");
       } else {
         if (host.getDetail("vmName") != null && host.getDetail("vmName").equalsIgnoreCase(vo.getInstanceName())) {
-          logger.debug("Remove vmName " + host.getDetail("vmName") + " from host " + host.getId() + " details");
+          s_logger.debug("Remove vmName " + host.getDetail("vmName") + " from host " + host.getId() + " details");
           host.getDetails().remove("vmName");
         }
       }
@@ -150,7 +152,7 @@ public class BaremetalManagerImpl extends ManagerBase implements BaremetalManage
         vm.setState(State.Running);
         vm.setLastHostId(vm.getHostId());
         vmDao.update(vm.getId(), vm);
-        logger.debug(String.format("received baremetal provision done notification for vm[id:%s name:%s] running on host[mac:%s, ip:%s]",
+        s_logger.debug(String.format("received baremetal provision done notification for vm[id:%s name:%s] running on host[mac:%s, ip:%s]",
                 vm.getId(), vm.getInstanceName(), host.getPrivateMacAddress(), host.getPrivateIpAddress()));
     }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
index 136179d..5ad48dc 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java
@@ -33,6 +33,7 @@ import javax.inject.Inject;
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
 import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
@@ -69,6 +70,7 @@ import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value = BaremetalPxeService.class)
 public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements BaremetalPxeService {
+    private static final Logger s_logger = Logger.getLogger(BareMetalPingServiceImpl.class);
     @Inject
     ResourceManager _resourceMgr;
     @Inject
@@ -107,19 +109,19 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
                 new PreparePxeServerCommand(ip, mac, mask, gateway, dns, tpl, profile.getVirtualMachine().getInstanceName(), dest.getHost().getName());
             PreparePxeServerAnswer ans = (PreparePxeServerAnswer)_agentMgr.send(pxeServerId, cmd);
             if (!ans.getResult()) {
-                logger.warn("Unable tot program PXE server: " + pxeVo.getId() + " because " + ans.getDetails());
+                s_logger.warn("Unable tot program PXE server: " + pxeVo.getId() + " because " + ans.getDetails());
                 return false;
             }
 
             IpmISetBootDevCommand bootCmd = new IpmISetBootDevCommand(BootDev.pxe);
             Answer anw = _agentMgr.send(dest.getHost().getId(), bootCmd);
             if (!anw.getResult()) {
-                logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + anw.getDetails());
+                s_logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + anw.getDetails());
             }
 
             return anw.getResult();
         } catch (Exception e) {
-            logger.warn("Cannot prepare PXE server", e);
+            s_logger.warn("Cannot prepare PXE server", e);
             return false;
         }
     }
@@ -150,7 +152,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
             Answer ans = _agentMgr.send(pxeServerId, cmd);
             return ans.getResult();
         } catch (Exception e) {
-            logger.debug("Prepare for creating baremetal template failed", e);
+            s_logger.debug("Prepare for creating baremetal template failed", e);
             return false;
         }
     }
@@ -219,7 +221,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
         try {
             uri = new URI(cmd.getUrl());
         } catch (Exception e) {
-            logger.debug(e);
+            s_logger.debug(e);
             throw new IllegalArgumentException(e.getMessage());
         }
         String ipAddress = uri.getHost();
@@ -244,7 +246,7 @@ public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements
         try {
             resource.configure("PING PXE resource", params);
         } catch (Exception e) {
-            logger.debug(e);
+            s_logger.debug(e);
             throw new CloudRuntimeException(e.getMessage());
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
index c2bdc6b..5ef861d 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java
@@ -72,6 +72,7 @@ import com.cloud.vm.VirtualMachine.PowerState;
 import com.cloud.vm.dao.VMInstanceDao;
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
 import javax.naming.ConfigurationException;
@@ -82,6 +83,7 @@ import java.util.concurrent.TimeUnit;
 
 @Local(value = ServerResource.class)
 public class BareMetalResourceBase extends ManagerBase implements ServerResource {
+    private static final Logger s_logger = Logger.getLogger(BareMetalResourceBase.class);
     protected String _uuid;
     protected String _zone;
     protected String _pod;
@@ -174,20 +176,20 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         try {
             ipmiIface = configDao.getValue(Config.BaremetalIpmiLanInterface.key());
         } catch (Exception e) {
-            logger.debug(e.getMessage(), e);
+            s_logger.debug(e.getMessage(), e);
         }
 
         try {
             ipmiRetryTimes = Integer.parseInt(configDao.getValue(Config.BaremetalIpmiRetryTimes.key()));
         } catch (Exception e) {
-            logger.debug(e.getMessage(), e);
+            s_logger.debug(e.getMessage(), e);
         }
 
         try {
             provisionDoneNotificationOn = Boolean.valueOf(configDao.getValue(Config.BaremetalProvisionDoneNotificationEnabled.key()));
             isProvisionDoneNotificationTimeout = Integer.parseInt(configDao.getValue(Config.BaremetalProvisionDoneNotificationTimeout.key()));
         } catch (Exception e) {
-            logger.debug(e.getMessage(), e);
+            s_logger.debug(e.getMessage(), e);
         }
 
         String injectScript = "scripts/util/ipmi.py";
@@ -196,7 +198,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
             throw new ConfigurationException("Cannot find ping script " + scriptPath);
         }
         String pythonPath = "/usr/bin/python";
-        _pingCommand = new Script2(pythonPath, logger);
+        _pingCommand = new Script2(pythonPath, s_logger);
         _pingCommand.add(scriptPath);
         _pingCommand.add("ping");
         _pingCommand.add("interface=" + ipmiIface);
@@ -204,7 +206,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         _pingCommand.add("usrname=" + _username);
         _pingCommand.add("password=" + _password, ParamType.PASSWORD);
 
-        _setPxeBootCommand = new Script2(pythonPath, logger);
+        _setPxeBootCommand = new Script2(pythonPath, s_logger);
         _setPxeBootCommand.add(scriptPath);
         _setPxeBootCommand.add("boot_dev");
         _setPxeBootCommand.add("interface=" + ipmiIface);
@@ -213,7 +215,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         _setPxeBootCommand.add("password=" + _password, ParamType.PASSWORD);
         _setPxeBootCommand.add("dev=pxe");
 
-        _setDiskBootCommand = new Script2(pythonPath, logger);
+        _setDiskBootCommand = new Script2(pythonPath, s_logger);
         _setDiskBootCommand.add(scriptPath);
         _setDiskBootCommand.add("boot_dev");
         _setDiskBootCommand.add("interface=" + ipmiIface);
@@ -222,7 +224,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         _setDiskBootCommand.add("password=" + _password, ParamType.PASSWORD);
         _setDiskBootCommand.add("dev=disk");
 
-        _rebootCommand = new Script2(pythonPath, logger);
+        _rebootCommand = new Script2(pythonPath, s_logger);
         _rebootCommand.add(scriptPath);
         _rebootCommand.add("reboot");
         _rebootCommand.add("interface=" + ipmiIface);
@@ -230,7 +232,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         _rebootCommand.add("usrname=" + _username);
         _rebootCommand.add("password=" + _password, ParamType.PASSWORD);
 
-        _getStatusCommand = new Script2(pythonPath, logger);
+        _getStatusCommand = new Script2(pythonPath, s_logger);
         _getStatusCommand.add(scriptPath);
         _getStatusCommand.add("ping");
         _getStatusCommand.add("interface=" + ipmiIface);
@@ -238,7 +240,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         _getStatusCommand.add("usrname=" + _username);
         _getStatusCommand.add("password=" + _password, ParamType.PASSWORD);
 
-        _powerOnCommand = new Script2(pythonPath, logger);
+        _powerOnCommand = new Script2(pythonPath, s_logger);
         _powerOnCommand.add(scriptPath);
         _powerOnCommand.add("power");
         _powerOnCommand.add("interface=" + ipmiIface);
@@ -247,7 +249,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         _powerOnCommand.add("password=" + _password, ParamType.PASSWORD);
         _powerOnCommand.add("action=on");
 
-        _powerOffCommand = new Script2(pythonPath, logger);
+        _powerOffCommand = new Script2(pythonPath, s_logger);
         _powerOffCommand.add(scriptPath);
         _powerOffCommand.add("power");
         _powerOffCommand.add("interface=" + ipmiIface);
@@ -256,7 +258,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         _powerOffCommand.add("password=" + _password, ParamType.PASSWORD);
         _powerOffCommand.add("action=soft");
 
-        _forcePowerOffCommand = new Script2(pythonPath, logger);
+        _forcePowerOffCommand = new Script2(pythonPath, s_logger);
         _forcePowerOffCommand.add(scriptPath);
         _forcePowerOffCommand.add("power");
         _forcePowerOffCommand.add("interface=" + ipmiIface);
@@ -265,7 +267,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
         _forcePowerOffCommand.add("password=" + _password, ParamType.PASSWORD);
         _forcePowerOffCommand.add("action=off");
 
-        _bootOrRebootCommand = new Script2(pythonPath, logger);
+        _bootOrRebootCommand = new Script2(pythonPath, s_logger);
         _bootOrRebootCommand.add(scriptPath);
         _bootOrRebootCommand.add("boot_or_reboot");
         _bootOrRebootCommand.add("interface=" + ipmiIface);
@@ -297,11 +299,11 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
                 res = cmd.execute(interpreter);
             }
             if (res != null && res.startsWith("Error: Unable to establish LAN")) {
-                logger.warn("IPMI script timeout(" + cmd.toString() + "), will retry " + retry + " times");
+                s_logger.warn("IPMI script timeout(" + cmd.toString() + "), will retry " + retry + " times");
                 try {
                     TimeUnit.SECONDS.sleep(1);
                 } catch (InterruptedException e) {
-                    logger.debug("[ignored] interupted while waiting to retry running script.");
+                    s_logger.debug("[ignored] interupted while waiting to retry running script.");
                 }
                 continue;
             } else if (res == null) {
@@ -311,7 +313,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
             }
         }
 
-        logger.warn("IPMI Scirpt failed due to " + res + "(" + cmd.toString() + ")");
+        s_logger.warn("IPMI Scirpt failed due to " + res + "(" + cmd.toString() + ")");
         return false;
     }
 
@@ -377,12 +379,12 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
             if (!ipmiPing()) {
                 Thread.sleep(1000);
                 if (!ipmiPing()) {
-                    logger.warn("Cannot ping ipmi nic " + _ip);
+                    s_logger.warn("Cannot ping ipmi nic " + _ip);
                     return null;
                 }
             }
         } catch (Exception e) {
-            logger.debug("Cannot ping ipmi nic " + _ip, e);
+            s_logger.debug("Cannot ping ipmi nic " + _ip, e);
             return null;
         }
 
@@ -417,11 +419,11 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
 
         String bootDev = cmd.getBootDev().name();
         if (!doScript(bootCmd)) {
-            logger.warn("Set " + _ip + " boot dev to " + bootDev + "failed");
+            s_logger.warn("Set " + _ip + " boot dev to " + bootDev + "failed");
             return new Answer(cmd, false, "Set " + _ip + " boot dev to " + bootDev + "failed");
         }
 
-        logger.warn("Set " + _ip + " boot dev to " + bootDev + "Success");
+        s_logger.warn("Set " + _ip + " boot dev to " + bootDev + "Success");
         return new Answer(cmd, true, "Set " + _ip + " boot dev to " + bootDev + "Success");
     }
 
@@ -492,7 +494,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
                 return Answer.createUnsupportedCommandAnswer(cmd);
             }
         } catch (Throwable t) {
-            logger.debug(t.getMessage(), t);
+            s_logger.debug(t.getMessage(), t);
             return new Answer(cmd, false, t.getMessage());
         }
     }
@@ -543,7 +545,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
             OutputInterpreter.AllLinesParser interpreter = new OutputInterpreter.AllLinesParser();
             if (!doScript(_getStatusCommand, interpreter)) {
                 success = true;
-                logger.warn("Cannot get power status of " + getName() + ", assume VM state changed successfully");
+                s_logger.warn("Cannot get power status of " + getName() + ", assume VM state changed successfully");
                 break;
             }
 
@@ -598,7 +600,7 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
                     try {
                         TimeUnit.SECONDS.sleep(5);
                     } catch (InterruptedException e) {
-                        logger.warn(e.getMessage(), e);
+                        s_logger.warn(e.getMessage(), e);
                     }
 
                     q = QueryBuilder.create(VMInstanceVO.class);
@@ -612,21 +614,21 @@ public class BareMetalResourceBase extends ManagerBase implements ServerResource
                         return new StartAnswer(cmd);
                     }
 
-                    logger.debug(String.format("still wait for baremetal provision done notification for vm[name:%s], current vm state is %s", vmvo.getInstanceName(), vmvo.getState()));
+                    s_logger.debug(String.format("still wait for baremetal provision done notification for vm[name:%s], current vm state is %s", vmvo.getInstanceName(), vmvo.getState()));
                 }
 
                 return new StartAnswer(cmd, String.format("timeout after %s seconds, no baremetal provision done notification received. vm[name:%s] failed to start", isProvisionDoneNotificationTimeout, vm.getName()));
             }
         }
 
-        logger.debug("Start bare metal vm " + vm.getName() + "successfully");
+        s_logger.debug("Start bare metal vm " + vm.getName() + "successfully");
         _vmName = vm.getName();
         return new StartAnswer(cmd);
     }
 
     protected ReadyAnswer execute(ReadyCommand cmd) {
         // derived resource should check if the PXE server is ready
-        logger.debug("Bare metal resource " + getName() + " is ready");
+        s_logger.debug("Bare metal resource " + getName() + " is ready");
         return new ReadyAnswer(cmd);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java
index b6500b0..292e6ef 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java
@@ -23,6 +23,7 @@ import javax.inject.Inject;
 
 import org.apache.cloudstack.api.ApiConstants;
 import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
+import org.apache.log4j.Logger;
 
 import com.cloud.dc.DataCenter;
 import com.cloud.dc.Pod;
@@ -59,6 +60,7 @@ import com.cloud.vm.VirtualMachineProfile;
 
 @Local(value = {NetworkGuru.class})
 public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
+    private static final Logger s_logger = Logger.getLogger(BaremetaNetworkGuru.class);
     @Inject
     private HostDao _hostDao;
     @Inject
@@ -147,14 +149,14 @@ public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru {
          * nic.setBroadcastUri(null); nic.setIsolationUri(null);
          */
 
-        logger.debug("Allocated a nic " + nic + " for " + vm);
+        s_logger.debug("Allocated a nic " + nic + " for " + vm);
     }
 
     private void getBaremetalIp(NicProfile nic, Pod pod, VirtualMachineProfile vm, Network network, String requiredIp) throws
         InsufficientAddressCapacityException, ConcurrentOperationException {
         DataCenter dc = _dcDao.findById(pod.getDataCenterId());
         if (nic.getIPv4Address() == null) {
-            logger.debug(String.format("Requiring ip address: %s", nic.getIPv4Address()));
+            s_logger.debug(String.format("Requiring ip address: %s", nic.getIPv4Address()));
             PublicIp ip = _ipAddrMgr.assignPublicIpAddress(dc.getId(), pod.getId(), vm.getOwner(), VlanType.DirectAttached, network.getId(), requiredIp, false);
             nic.setIPv4Address(ip.getAddress().toString());
             nic.setFormat(AddressFormat.Ip4);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
index 1a11644..5f2c746 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java
@@ -25,6 +25,7 @@ import java.util.Set;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.log4j.Logger;
 
 import com.cloud.baremetal.database.BaremetalDhcpVO;
 import com.cloud.dc.DataCenter.NetworkType;
@@ -58,6 +59,7 @@ import com.cloud.vm.dao.NicDao;
 
 @Local(value = NetworkElement.class)
 public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProvider {
+    private static final Logger s_logger = Logger.getLogger(BaremetalDhcpElement.class);
     private static final Map<Service, Map<Capability, String>> capabilities;
 
     @Inject
@@ -99,7 +101,7 @@ public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProv
     public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
         ResourceUnavailableException, InsufficientCapacityException {
         if (offering.isSystemOnly() || !canHandle(dest, offering.getTrafficType(), network.getGuestType())) {
-            logger.debug("BaremetalDhcpElement can not handle networkoffering: " + offering.getName());
+            s_logger.debug("BaremetalDhcpElement can not handle networkoffering: " + offering.getName());
             return false;
         }
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
index fe96988..c2182e1 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java
@@ -34,6 +34,7 @@ import javax.naming.ConfigurationException;
 
 import org.apache.cloudstack.api.AddBaremetalDhcpCmd;
 import org.apache.cloudstack.api.ListBaremetalDhcpCmd;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -76,6 +77,7 @@ import com.cloud.vm.dao.UserVmDao;
 
 @Local(value = {BaremetalDhcpManager.class})
 public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDhcpManager, ResourceStateAdapter {
+    private static final org.apache.log4j.Logger s_logger = Logger.getLogger(BaremetalDhcpManagerImpl.class);
     protected String _name;
     @Inject
     DataCenterDao _dcDao;
@@ -155,15 +157,15 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
         try {
             Answer ans = _agentMgr.send(h.getId(), dhcpCommand);
             if (ans.getResult()) {
-                logger.debug(String.format("Set dhcp entry on external DHCP %1$s successfully(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(),
+                s_logger.debug(String.format("Set dhcp entry on external DHCP %1$s successfully(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(),
                     nic.getIPv4Address(), nic.getMacAddress(), profile.getVirtualMachine().getHostName()));
                 return true;
             } else {
-                logger.debug(errMsg + " " + ans.getDetails());
+                s_logger.debug(errMsg + " " + ans.getDetails());
                 throw new ResourceUnavailableException(errMsg, DataCenter.class, zoneId);
             }
         } catch (Exception e) {
-            logger.debug(errMsg, e);
+            s_logger.debug(errMsg, e);
             throw new ResourceUnavailableException(errMsg + e.getMessage(), DataCenter.class, zoneId);
         }
     }
@@ -226,7 +228,7 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
         try {
             uri = new URI(cmd.getUrl());
         } catch (Exception e) {
-            logger.debug(e);
+            s_logger.debug(e);
             throw new IllegalArgumentException(e.getMessage());
         }
 
@@ -260,7 +262,7 @@ public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDh
                 throw new CloudRuntimeException("Unsupport DHCP server type: " + cmd.getDhcpType());
             }
         } catch (Exception e) {
-            logger.debug(e);
+            s_logger.debug(e);
             throw new CloudRuntimeException(e.getMessage());
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
index 9fe3f6a..0d3cdce 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java
@@ -27,6 +27,7 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
@@ -43,6 +44,7 @@ import com.cloud.resource.ServerResource;
 import com.cloud.utils.component.ManagerBase;
 
 public class BaremetalDhcpResourceBase extends ManagerBase implements ServerResource {
+    private static final Logger s_logger = Logger.getLogger(BaremetalDhcpResourceBase.class);
     String _name;
     String _guid;
     String _username;
@@ -127,7 +129,7 @@ public class BaremetalDhcpResourceBase extends ManagerBase implements ServerReso
     }
 
     protected ReadyAnswer execute(ReadyCommand cmd) {
-        logger.debug("External DHCP resource " + _name + " is ready");
+        s_logger.debug("External DHCP resource " + _name + " is ready");
         return new ReadyAnswer(cmd);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java
index e92cbf2..8fd2c35 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java
@@ -27,6 +27,7 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 
 import com.trilead.ssh2.SCPClient;
 
@@ -40,13 +41,14 @@ import com.cloud.utils.script.Script;
 import com.cloud.utils.ssh.SSHCmdHelper;
 
 public class BaremetalDhcpdResource extends BaremetalDhcpResourceBase {
+    private static final Logger s_logger = Logger.getLogger(BaremetalDhcpdResource.class);
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
         com.trilead.ssh2.Connection sshConnection = null;
         try {
             super.configure(name, params);
-            logger.debug(String.format("Trying to connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s)", _ip, _username, "******"));
+            s_logger.debug(String.format("Trying to connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s)", _ip, _username, "******"));
             sshConnection = SSHCmdHelper.acquireAuthorizedConnection(_ip, _username, _password);
             if (sshConnection == null) {
                 throw new ConfigurationException(String.format("Cannot connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
@@ -87,10 +89,10 @@ public class BaremetalDhcpdResource extends BaremetalDhcpResourceBase {
                 throw new ConfigurationException("prepare Dhcpd at " + _ip + " failed, command:" + cmd);
             }
 
-            logger.debug("Dhcpd resource configure successfully");
+            s_logger.debug("Dhcpd resource configure successfully");
             return true;
         } catch (Exception e) {
-            logger.debug("Dhcpd resource configure failed", e);
+            s_logger.debug("Dhcpd resource configure failed", e);
             throw new ConfigurationException(e.getMessage());
         } finally {
             SSHCmdHelper.releaseSshConnection(sshConnection);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
index 51acfe9..79f23cc 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java
@@ -27,6 +27,7 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 
 import com.trilead.ssh2.SCPClient;
 
@@ -40,13 +41,14 @@ import com.cloud.utils.script.Script;
 import com.cloud.utils.ssh.SSHCmdHelper;
 
 public class BaremetalDnsmasqResource extends BaremetalDhcpResourceBase {
+    private static final Logger s_logger = Logger.getLogger(BaremetalDnsmasqResource.class);
 
     @Override
     public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
         com.trilead.ssh2.Connection sshConnection = null;
         try {
             super.configure(name, params);
-            logger.debug(String.format("Trying to connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s)", _ip, _username, _password));
+            s_logger.debug(String.format("Trying to connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s)", _ip, _username, _password));
             sshConnection = SSHCmdHelper.acquireAuthorizedConnection(_ip, _username, _password);
             if (sshConnection == null) {
                 throw new ConfigurationException(String.format("Cannot connect to DHCP server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
@@ -79,10 +81,10 @@ public class BaremetalDnsmasqResource extends BaremetalDhcpResourceBase {
             }
             */
 
-            logger.debug("Dnsmasq resource configure successfully");
+            s_logger.debug("Dnsmasq resource configure successfully");
             return true;
         } catch (Exception e) {
-            logger.debug("Dnsmasq resorce configure failed", e);
+            s_logger.debug("Dnsmasq resorce configure failed", e);
             throw new ConfigurationException(e.getMessage());
         } finally {
             SSHCmdHelper.releaseSshConnection(sshConnection);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java
index 0da8a6e..260f4f1 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java
@@ -25,6 +25,7 @@ import java.util.Map;
 import javax.naming.ConfigurationException;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
 
 import com.trilead.ssh2.SCPClient;
 
@@ -39,6 +40,7 @@ import com.cloud.utils.script.Script;
 import com.cloud.utils.ssh.SSHCmdHelper;
 
 public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase {
+    private static final Logger s_logger = Logger.getLogger(BaremetalKickStartPxeResource.class);
     private static final String Name = "BaremetalKickStartPxeResource";
     String _tftpDir;
 
@@ -52,11 +54,11 @@ public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase {
 
         com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22);
 
-        logger.debug(String.format("Trying to connect to kickstart PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
+        s_logger.debug(String.format("Trying to connect to kickstart PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
         try {
             sshConnection.connect(null, 60000, 60000);
             if (!sshConnection.authenticateWithPassword(_username, _password)) {
-                logger.debug("SSH Failed to authenticate");
+                s_logger.debug("SSH Failed to authenticate");
                 throw new ConfigurationException(String.format("Cannot connect to kickstart PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
             }
 
@@ -130,7 +132,7 @@ public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase {
 
             sshConnection.connect(null, 60000, 60000);
             if (!sshConnection.authenticateWithPassword(_username, _password)) {
-                logger.debug("SSH Failed to authenticate");
+                s_logger.debug("SSH Failed to authenticate");
                 throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
             }
 
@@ -141,7 +143,7 @@ public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase {
 
             return new Answer(cmd, true, "Success");
         } catch (Exception e) {
-            logger.debug("Prepare for creating baremetal template failed", e);
+            s_logger.debug("Prepare for creating baremetal template failed", e);
             return new Answer(cmd, false, e.getMessage());
         } finally {
             if (sshConnection != null) {
@@ -166,7 +168,7 @@ public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase {
         try {
             sshConnection.connect(null, 60000, 60000);
             if (!sshConnection.authenticateWithPassword(_username, _password)) {
-                logger.debug("SSH Failed to authenticate");
+                s_logger.debug("SSH Failed to authenticate");
                 throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
             }
 
@@ -186,10 +188,10 @@ public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase {
                 return new Answer(cmd, false, "prepare kickstart at pxe server " + _ip + " failed, command:" + script);
             }
 
-            logger.debug("Prepare kickstart PXE server successfully");
+            s_logger.debug("Prepare kickstart PXE server successfully");
             return new Answer(cmd, true, "Success");
         } catch (Exception e) {
-            logger.debug("Prepare for kickstart server failed", e);
+            s_logger.debug("Prepare for kickstart server failed", e);
             return new Answer(cmd, false, e.getMessage());
         } finally {
             if (sshConnection != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
index 6e179d6..beffa3e 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java
@@ -34,6 +34,7 @@ import org.apache.cloudstack.api.AddBaremetalKickStartPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxeCmd;
 import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.baremetal.IpmISetBootDevCommand;
@@ -81,6 +82,7 @@ import com.cloud.vm.dao.NicDao;
 
 @Local(value = BaremetalPxeService.class)
 public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase implements BaremetalPxeService {
+    private static final Logger s_logger = Logger.getLogger(BaremetalKickStartServiceImpl.class);
     @Inject
     ResourceManager _resourceMgr;
     @Inject
@@ -170,7 +172,7 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
             throw new CloudRuntimeException(String.format("cannot find id_rsa.cloud"));
         }
         if (!keyFile.exists()) {
-            logger.error("Unable to locate id_rsa.cloud in your setup at " + keyFile.toString());
+            s_logger.error("Unable to locate id_rsa.cloud in your setup at " + keyFile.toString());
         }
         return keyFile;
     }
@@ -199,7 +201,7 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
         cmd.setTemplateUuid(template.getUuid());
         Answer aws = _agentMgr.send(pxeVo.getHostId(), cmd);
         if (!aws.getResult()) {
-            logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + aws.getDetails());
+            s_logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + aws.getDetails());
             return false;
         }
 
@@ -229,7 +231,7 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
         List<String> tuple =  parseKickstartUrl(profile);
         String cmd =  String.format("/opt/cloud/bin/prepare_pxe.sh %s %s %s %s %s %s", tuple.get(1), tuple.get(2), profile.getTemplate().getUuid(),
                 String.format("01-%s", nic.getMacAddress().replaceAll(":", "-")).toLowerCase(), tuple.get(0), nic.getMacAddress().toLowerCase());
-        logger.debug(String.format("prepare pxe on virtual router[ip:%s], cmd: %s", mgmtNic.getIPv4Address(), cmd));
+        s_logger.debug(String.format("prepare pxe on virtual router[ip:%s], cmd: %s", mgmtNic.getIPv4Address(), cmd));
         Pair<Boolean, String> ret = SshHelper.sshExecute(mgmtNic.getIPv4Address(), 3922, "root", getSystemVMKeyFile(), null, cmd);
         if (!ret.first()) {
             throw new CloudRuntimeException(String.format("failed preparing PXE in virtual router[id:%s], because %s", vr.getId(), ret.second()));
@@ -237,7 +239,7 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
 
         //String internalServerIp = "10.223.110.231";
         cmd = String.format("/opt/cloud/bin/baremetal_snat.sh %s %s %s", mgmtNic.getIPv4Address(), internalServerIp, mgmtNic.getIPv4Gateway());
-        logger.debug(String.format("prepare SNAT on virtual router[ip:%s], cmd: %s", mgmtNic.getIPv4Address(), cmd));
+        s_logger.debug(String.format("prepare SNAT on virtual router[ip:%s], cmd: %s", mgmtNic.getIPv4Address(), cmd));
         ret = SshHelper.sshExecute(mgmtNic.getIPv4Address(), 3922, "root", getSystemVMKeyFile(), null, cmd);
         if (!ret.first()) {
             throw new CloudRuntimeException(String.format("failed preparing PXE in virtual router[id:%s], because %s", vr.getId(), ret.second()));
@@ -262,12 +264,12 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
             IpmISetBootDevCommand bootCmd = new IpmISetBootDevCommand(BootDev.pxe);
             Answer aws = _agentMgr.send(dest.getHost().getId(), bootCmd);
             if (!aws.getResult()) {
-                logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + aws.getDetails());
+                s_logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + aws.getDetails());
             }
 
             return aws.getResult();
         } catch (Exception e) {
-            logger.warn("Cannot prepare PXE server", e);
+            s_logger.warn("Cannot prepare PXE server", e);
             return false;
         }
     }
@@ -319,7 +321,7 @@ public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase imple
         try {
             uri = new URI(cmd.getUrl());
         } catch (Exception e) {
-            logger.debug(e);
+            s_logger.debug(e);
             throw new IllegalArgumentException(e.getMessage());
         }
         String ipAddress = uri.getHost();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java
index 0ca2f92..80827a2 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java
@@ -28,6 +28,7 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 
 import com.trilead.ssh2.SCPClient;
 
@@ -44,6 +45,7 @@ import com.cloud.utils.script.Script;
 import com.cloud.utils.ssh.SSHCmdHelper;
 
 public class BaremetalPingPxeResource extends BaremetalPxeResourceBase {
+    private static final Logger s_logger = Logger.getLogger(BaremetalPingPxeResource.class);
     private static final String Name = "BaremetalPingPxeResource";
     String _storageServer;
     String _pingDir;
@@ -95,11 +97,11 @@ public class BaremetalPingPxeResource extends BaremetalPxeResourceBase {
 
         com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22);
 
-        logger.debug(String.format("Trying to connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
+        s_logger.debug(String.format("Trying to connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
         try {
             sshConnection.connect(null, 60000, 60000);
             if (!sshConnection.authenticateWithPassword(_username, _password)) {
-                logger.debug("SSH Failed to authenticate");
+                s_logger.debug("SSH Failed to authenticate");
                 throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******"));
             }
 
@@ -149,7 +151,7 @@ public class BaremetalPingPxeResource extends BaremetalPxeResourceBase {
         try {
             sshConnection.connect(null, 60000, 60000);
             if (!sshConnection.authenticateWithPassword(_username, _password)) {
-                logger.debug("SSH Failed to authenticate");
+                s_logger.debug("SSH Failed to authenticate");
                 throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
             }
 
@@ -159,11 +161,11 @@ public class BaremetalPingPxeResource extends BaremetalPxeResourceBase {
             if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) {
                 return new PreparePxeServerAnswer(cmd, "prepare PING at " + _ip + " failed, command:" + script);
             }
-            logger.debug("Prepare Ping PXE server successfully");
+            s_logger.debug("Prepare Ping PXE server successfully");
 
             return new PreparePxeServerAnswer(cmd);
         } catch (Exception e) {
-            logger.debug("Prepare PING pxe server failed", e);
+            s_logger.debug("Prepare PING pxe server failed", e);
             return new PreparePxeServerAnswer(cmd, e.getMessage());
         } finally {
             if (sshConnection != null) {
@@ -177,7 +179,7 @@ public class BaremetalPingPxeResource extends BaremetalPxeResourceBase {
         try {
             sshConnection.connect(null, 60000, 60000);
             if (!sshConnection.authenticateWithPassword(_username, _password)) {
-                logger.debug("SSH Failed to authenticate");
+                s_logger.debug("SSH Failed to authenticate");
                 throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
             }
 
@@ -187,11 +189,11 @@ public class BaremetalPingPxeResource extends BaremetalPxeResourceBase {
             if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) {
                 return new Answer(cmd, false, "prepare for creating template failed, command:" + script);
             }
-            logger.debug("Prepare for creating template successfully");
+            s_logger.debug("Prepare for creating template successfully");
 
             return new Answer(cmd, true, "Success");
         } catch (Exception e) {
-            logger.debug("Prepare for creating baremetal template failed", e);
+            s_logger.debug("Prepare for creating baremetal template failed", e);
             return new Answer(cmd, false, e.getMessage());
         } finally {
             if (sshConnection != null) {
@@ -235,7 +237,7 @@ public class BaremetalPingPxeResource extends BaremetalPxeResourceBase {
 
             sshConnection.connect(null, 60000, 60000);
             if (!sshConnection.authenticateWithPassword(_username, _password)) {
-                logger.debug("SSH Failed to authenticate");
+                s_logger.debug("SSH Failed to authenticate");
                 throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, _password));
             }
 
@@ -246,7 +248,7 @@ public class BaremetalPingPxeResource extends BaremetalPxeResourceBase {
 
             return new Answer(cmd, true, "Success");
         } catch (Exception e) {
-            logger.debug("Prepare for creating baremetal template failed", e);
+            s_logger.debug("Prepare for creating baremetal template failed", e);
             return new Answer(cmd, false, e.getMessage());
         } finally {
             if (sshConnection != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
index 7612bab..da28668 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java
@@ -51,6 +51,7 @@ import com.cloud.vm.VirtualMachine.Type;
 import com.cloud.vm.VirtualMachineProfile;
 import com.cloud.vm.dao.NicDao;
 import com.cloud.vm.dao.VMInstanceDao;
+import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
@@ -60,6 +61,7 @@ import java.util.Set;
 
 @Local(value = NetworkElement.class)
 public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
+    private static final Logger s_logger = Logger.getLogger(BaremetalPxeElement.class);
     private static final Map<Service, Map<Capability, String>> capabilities;
 
     @Inject
@@ -110,7 +112,7 @@ public class BaremetalPxeElement extends AdapterBase implements NetworkElement {
         }
 
         if (offering.isSystemOnly() || !canHandle(dest, offering.getTrafficType(), network.getGuestType())) {
-            logger.debug("BaremetalPxeElement can not handle network offering: " + offering.getName());
+            s_logger.debug("BaremetalPxeElement can not handle network offering: " + offering.getName());
             return false;
         }
         return true;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
index 2e9b691..e99292a 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java
@@ -35,6 +35,7 @@ import org.apache.cloudstack.api.AddBaremetalPxeCmd;
 import org.apache.cloudstack.api.AddBaremetalPxePingServerCmd;
 import org.apache.cloudstack.api.ListBaremetalPxeServersCmd;
 import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.AgentManager;
 import com.cloud.agent.api.Answer;
@@ -72,6 +73,7 @@ import com.cloud.vm.dao.UserVmDao;
 
 @Local(value = {BaremetalPxeManager.class})
 public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxeManager, ResourceStateAdapter {
+    private static final org.apache.log4j.Logger s_logger = Logger.getLogger(BaremetalPxeManagerImpl.class);
     @Inject
     DataCenterDao _dcDao;
     @Inject
@@ -233,13 +235,13 @@ public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxe
         try {
             Answer ans = _agentMgr.send(pxeVo.getHostId(), cmd);
             if (!ans.getResult()) {
-                logger.debug(String.format("Add userdata to vm:%s failed because %s", vm.getInstanceName(), ans.getDetails()));
+                s_logger.debug(String.format("Add userdata to vm:%s failed because %s", vm.getInstanceName(), ans.getDetails()));
                 return false;
             } else {
                 return true;
             }
         } catch (Exception e) {
-            logger.debug(String.format("Add userdata to vm:%s failed", vm.getInstanceName()), e);
+            s_logger.debug(String.format("Add userdata to vm:%s failed", vm.getInstanceName()), e);
             return false;
         }
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResourceBase.java
index 01d1bf6..5b5a959 100644
--- a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResourceBase.java
+++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResourceBase.java
@@ -26,6 +26,7 @@ import java.util.Map;
 
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
@@ -40,6 +41,7 @@ import com.cloud.resource.ServerResource;
 import com.cloud.utils.component.ManagerBase;
 
 public class BaremetalPxeResourceBase extends ManagerBase implements ServerResource {
+    private static final Logger s_logger = Logger.getLogger(BaremetalPxeResourceBase.class);
     String _name;
     String _guid;
     String _username;
@@ -82,7 +84,7 @@ public class BaremetalPxeResourceBase extends ManagerBase implements ServerResou
     }
 
     protected ReadyAnswer execute(ReadyCommand cmd) {
-        logger.debug("Pxe resource " + _name + " is ready");
+        s_logger.debug("Pxe resource " + _name + " is ready");
         return new ReadyAnswer(cmd);
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/hyperv/src/com/cloud/ha/HypervInvestigator.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/src/com/cloud/ha/HypervInvestigator.java b/plugins/hypervisors/hyperv/src/com/cloud/ha/HypervInvestigator.java
index 75ae709..634f242 100644
--- a/plugins/hypervisors/hyperv/src/com/cloud/ha/HypervInvestigator.java
+++ b/plugins/hypervisors/hyperv/src/com/cloud/ha/HypervInvestigator.java
@@ -23,6 +23,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.utils.component.AdapterBase;
 
 @Local(value=Investigator.class)
 public class HypervInvestigator extends AdapterBase implements Investigator {
+    private final static Logger s_logger = Logger.getLogger(HypervInvestigator.class);
     @Inject HostDao _hostDao;
     @Inject AgentManager _agentMgr;
     @Inject ResourceManager _resourceMgr;
@@ -68,7 +70,7 @@ public class HypervInvestigator extends AdapterBase implements Investigator {
                     return answer.getResult() ? Status.Down : Status.Up;
                 }
             } catch (Exception e) {
-                logger.debug("Failed to send command to host: " + neighbor.getId());
+                s_logger.debug("Failed to send command to host: " + neighbor.getId());
             }
         }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
index c34bfae..c928124 100644
--- a/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
+++ b/plugins/hypervisors/hyperv/src/com/cloud/hypervisor/hyperv/discoverer/HypervServerDiscoverer.java
@@ -30,6 +30,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.agent.Listener;
@@ -73,6 +74,7 @@ import com.cloud.storage.StorageLayer;
  */
 @Local(value = Discoverer.class)
 public class HypervServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter {
+    private static final Logger s_logger = Logger.getLogger(HypervServerDiscoverer.class);
     Random _rand = new Random(System.currentTimeMillis());
 
     Map<String, String> _storageMounts = new HashMap<String, String>();
@@ -117,7 +119,7 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
 
         // assert
         if (startup.getHypervisorType() != HypervisorType.Hyperv) {
-            logger.debug("Not Hyper-V hypervisor, so moving on.");
+            s_logger.debug("Not Hyper-V hypervisor, so moving on.");
             return;
         }
 
@@ -133,8 +135,8 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
             _clusterDao.update(cluster.getId(), cluster);
         }
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("Setting up host " + agentId);
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Setting up host " + agentId);
         }
 
         HostEnvironment env = new HostEnvironment();
@@ -159,14 +161,14 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
                 if (reason == null) {
                     reason = " details were null";
                 }
-                logger.warn("Unable to setup agent " + agentId + " due to " + reason);
+                s_logger.warn("Unable to setup agent " + agentId + " due to " + reason);
             }
             // Error handling borrowed from XcpServerDiscoverer, may need to be
             // updated.
         } catch (AgentUnavailableException e) {
-            logger.warn("Unable to setup agent " + agentId + " because it became unavailable.", e);
+            s_logger.warn("Unable to setup agent " + agentId + " because it became unavailable.", e);
         } catch (OperationTimedoutException e) {
-            logger.warn("Unable to setup agent " + agentId + " because it timed out", e);
+            s_logger.warn("Unable to setup agent " + agentId + " because it timed out", e);
         }
         throw new ConnectionException(true, "Reinitialize agent after setup.");
     }
@@ -201,14 +203,14 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
     public final Map<? extends ServerResource, Map<String, String>> find(final long dcId, final Long podId, final Long clusterId, final URI uri, final String username,
         final String password, final List<String> hostTags) throws DiscoveryException {
 
-        if (logger.isInfoEnabled()) {
-            logger.info("Discover host. dc(zone): " + dcId + ", pod: " + podId + ", cluster: " + clusterId + ", uri host: " + uri.getHost());
+        if (s_logger.isInfoEnabled()) {
+            s_logger.info("Discover host. dc(zone): " + dcId + ", pod: " + podId + ", cluster: " + clusterId + ", uri host: " + uri.getHost());
         }
 
         // Assertions
         if (podId == null) {
-            if (logger.isInfoEnabled()) {
-                logger.info("No pod is assigned, skipping the discovery in" + " Hyperv discoverer");
+            if (s_logger.isInfoEnabled()) {
+                s_logger.info("No pod is assigned, skipping the discovery in" + " Hyperv discoverer");
             }
             return null;
         }
@@ -216,20 +218,20 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
         // in the
         // database
         if (cluster == null) {
-            if (logger.isInfoEnabled()) {
-                logger.info("No cluster in database for cluster id " + clusterId);
+            if (s_logger.isInfoEnabled()) {
+                s_logger.info("No cluster in database for cluster id " + clusterId);
             }
             return null;
         }
         if (cluster.getHypervisorType() != HypervisorType.Hyperv) {
-            if (logger.isInfoEnabled()) {
-                logger.info("Cluster " + clusterId + "is not for Hyperv hypervisors");
+            if (s_logger.isInfoEnabled()) {
+                s_logger.info("Cluster " + clusterId + "is not for Hyperv hypervisors");
             }
             return null;
         }
         if (!uri.getScheme().equals("http")) {
             String msg = "urlString is not http so we're not taking care of" + " the discovery for this: " + uri;
-            logger.debug(msg);
+            s_logger.debug(msg);
             return null;
         }
 
@@ -241,11 +243,11 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
             String guidWithTail = calcServerResourceGuid(uuidSeed) + "-HypervResource";
 
             if (_resourceMgr.findHostByGuid(guidWithTail) != null) {
-                logger.debug("Skipping " + agentIp + " because " + guidWithTail + " is already in the database.");
+                s_logger.debug("Skipping " + agentIp + " because " + guidWithTail + " is already in the database.");
                 return null;
             }
 
-            logger.info("Creating" + HypervDirectConnectResource.class.getName() + " HypervDummyResourceBase for zone/pod/cluster " + dcId + "/" + podId + "/" +
+            s_logger.info("Creating" + HypervDirectConnectResource.class.getName() + " HypervDummyResourceBase for zone/pod/cluster " + dcId + "/" + podId + "/" +
                 clusterId);
 
             // Some Hypervisors organise themselves in pools.
@@ -286,7 +288,7 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
             Answer pingAns = resource.executeRequest(ping);
             if (pingAns == null || !pingAns.getResult()) {
                 String errMsg = "Agent not running, or no route to agent on at " + uri;
-                logger.debug(errMsg);
+                s_logger.debug(errMsg);
                 throw new DiscoveryException(errMsg);
             }
 
@@ -297,14 +299,14 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
             return resources;
         } catch (ConfigurationException e) {
             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, dcId, podId, "Unable to add " + uri.getHost(), "Error is " + e.getMessage());
-            logger.warn("Unable to instantiate " + uri.getHost(), e);
+            s_logger.warn("Unable to instantiate " + uri.getHost(), e);
         } catch (UnknownHostException e) {
             _alertMgr.sendAlert(AlertManager.AlertType.ALERT_TYPE_HOST, dcId, podId, "Unable to add " + uri.getHost(), "Error is " + e.getMessage());
 
-            logger.warn("Unable to instantiate " + uri.getHost(), e);
+            s_logger.warn("Unable to instantiate " + uri.getHost(), e);
         } catch (Exception e) {
             String msg = " can't setup agent, due to " + e.toString() + " - " + e.getMessage();
-            logger.warn(msg);
+            s_logger.warn(msg);
         }
         return null;
     }
@@ -381,7 +383,7 @@ public class HypervServerDiscoverer extends DiscovererBase implements Discoverer
             return null;
         }
 
-        logger.info("Host: " + host.getName() + " connected with hypervisor type: " + HypervisorType.Hyperv + ". Checking CIDR...");
+        s_logger.info("Host: " + host.getName() + " connected with hypervisor type: " + HypervisorType.Hyperv + ". Checking CIDR...");
 
         HostPodVO pod = _podDao.findById(host.getPodId());
         DataCenterVO dc = _dcDao.findById(host.getDataCenterId());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java b/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java
index afad450..000d37c 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/ha/KVMInvestigator.java
@@ -28,6 +28,7 @@ import com.cloud.host.dao.HostDao;
 import com.cloud.hypervisor.Hypervisor;
 import com.cloud.resource.ResourceManager;
 import com.cloud.utils.component.AdapterBase;
+import org.apache.log4j.Logger;
 
 import javax.ejb.Local;
 import javax.inject.Inject;
@@ -35,6 +36,7 @@ import java.util.List;
 
 @Local(value = Investigator.class)
 public class KVMInvestigator extends AdapterBase implements Investigator {
+    private final static Logger s_logger = Logger.getLogger(KVMInvestigator.class);
     @Inject
     HostDao _hostDao;
     @Inject
@@ -70,7 +72,7 @@ public class KVMInvestigator extends AdapterBase implements Investigator {
                 hostStatus = answer.getResult() ? Status.Down : Status.Up;
             }
         } catch (Exception e) {
-            logger.debug("Failed to send command to host: " + agent.getId());
+            s_logger.debug("Failed to send command to host: " + agent.getId());
         }
         if (hostStatus == null) {
             hostStatus = Status.Disconnected;
@@ -81,18 +83,18 @@ public class KVMInvestigator extends AdapterBase implements Investigator {
             if (neighbor.getId() == agent.getId() || (neighbor.getHypervisorType() != Hypervisor.HypervisorType.KVM && neighbor.getHypervisorType() != Hypervisor.HypervisorType.LXC)) {
                 continue;
             }
-            logger.debug("Investigating host:" + agent.getId() + " via neighbouring host:" + neighbor.getId());
+            s_logger.debug("Investigating host:" + agent.getId() + " via neighbouring host:" + neighbor.getId());
             try {
                 Answer answer = _agentMgr.easySend(neighbor.getId(), cmd);
                 if (answer != null) {
                     neighbourStatus = answer.getResult() ? Status.Down : Status.Up;
-                    logger.debug("Neighbouring host:" + neighbor.getId() + " returned status:" + neighbourStatus + " for the investigated host:" + agent.getId());
+                    s_logger.debug("Neighbouring host:" + neighbor.getId() + " returned status:" + neighbourStatus + " for the investigated host:" + agent.getId());
                     if (neighbourStatus == Status.Up) {
                         break;
                     }
                 }
             } catch (Exception e) {
-                logger.debug("Failed to send command to host: " + neighbor.getId());
+                s_logger.debug("Failed to send command to host: " + neighbor.getId());
             }
         }
         if (neighbourStatus == Status.Up && (hostStatus == Status.Disconnected || hostStatus == Status.Down)) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java
index 6281bd5..b720040 100644
--- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java
+++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java
@@ -28,6 +28,7 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import org.apache.log4j.Logger;
 import org.apache.xmlrpc.XmlRpcException;
 
 import com.cloud.agent.api.StartupCommand;
@@ -54,6 +55,7 @@ import com.cloud.utils.ssh.SSHCmdHelper;
 
 @Local(value = Discoverer.class)
 public class OvmDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter {
+    private static final Logger s_logger = Logger.getLogger(OvmDiscoverer.class);
     protected String _publicNetworkDevice;
     protected String _privateNetworkDevice;
     protected String _guestNetworkDevice;
@@ -97,25 +99,25 @@ public class OvmDiscoverer extends DiscovererBase implements Discoverer, Resourc
 
         if (!url.getScheme().equals("http")) {
             String msg = "urlString is not http so we're not taking care of the discovery for this: " + url;
-            logger.debug(msg);
+            s_logger.debug(msg);
             return null;
         }
         if (clusterId == null) {
             String msg = "must specify cluster Id when add host";
-            logger.debug(msg);
+            s_logger.debug(msg);
             throw new CloudRuntimeException(msg);
         }
 
         if (podId == null) {
             String msg = "must specify pod Id when add host";
-            logger.debug(msg);
+            s_logger.debug(msg);
             throw new CloudRuntimeException(msg);
         }
 
         ClusterVO cluster = _clusterDao.findById(clusterId);
         if (cluster == null || (cluster.getHypervisorType() != HypervisorType.Ovm)) {
-            if (logger.isInfoEnabled())
-                logger.info("invalid cluster id or cluster is not for Ovm hypervisors");
+            if (s_logger.isInfoEnabled())
+                s_logger.info("invalid cluster id or cluster is not for Ovm hypervisors");
             return null;
         }
 
@@ -139,7 +141,7 @@ public class OvmDiscoverer extends DiscovererBase implements Discoverer, Resourc
                 throw new CloudRuntimeException("The host " + hostIp + " has been added before");
             }
 
-            logger.debug("Ovm discover is going to disover host having guid " + guid);
+            s_logger.debug("Ovm discover is going to disover host having guid " + guid);
 
             ClusterVO clu = _clusterDao.findById(clusterId);
             if (clu.getGuid() == null) {
@@ -196,16 +198,16 @@ public class OvmDiscoverer extends DiscovererBase implements Discoverer, Resourc
             resources.put(ovmResource, details);
             return resources;
         } catch (XmlRpcException e) {
-            logger.debug("XmlRpc exception, Unable to discover OVM: " + url, e);
+            s_logger.debug("XmlRpc exception, Unable to discover OVM: " + url, e);
             return null;
         } catch (UnknownHostException e) {
-            logger.debug("Host name resolve failed exception, Unable to discover OVM: " + url, e);
+            s_logger.debug("Host name resolve failed exception, Unable to discover OVM: " + url, e);
             return null;
         } catch (ConfigurationException e) {
-            logger.debug("Configure resource failed, Unable to discover OVM: " + url, e);
+            s_logger.debug("Configure resource failed, Unable to discover OVM: " + url, e);
             return null;
         } catch (Exception e) {
-            logger.debug("Unable to discover OVM: " + url, e);
+            s_logger.debug("Unable to discover OVM: " + url, e);
             return null;
         }
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8bc02940/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java
index 6426acc..a4276a4 100644
--- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java
+++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.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.agent.api.FenceAnswer;
@@ -40,6 +41,7 @@ import com.cloud.vm.VirtualMachine;
 
 @Local(value = FenceBuilder.class)
 public class OvmFencer extends AdapterBase implements FenceBuilder {
+    private static final Logger s_logger = Logger.getLogger(OvmFencer.class);
     @Inject
     AgentManager _agentMgr;
     @Inject
@@ -69,7 +71,7 @@ public class OvmFencer extends AdapterBase implements FenceBuilder {
     @Override
     public Boolean fenceOff(VirtualMachine vm, Host host) {
         if (host.getHypervisorType() != HypervisorType.Ovm) {
-            logger.debug("Don't know how to fence non Ovm hosts " + host.getHypervisorType());
+            s_logger.debug("Don't know how to fence non Ovm hosts " + host.getHypervisorType());
             return null;
         }
 
@@ -93,13 +95,13 @@ public class OvmFencer extends AdapterBase implements FenceBuilder {
             try {
                 answer = (FenceAnswer)_agentMgr.send(h.getId(), fence);
             } catch (AgentUnavailableException e) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
                 }
                 continue;
             } catch (OperationTimedoutException e) {
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
+                if (s_logger.isDebugEnabled()) {
+                    s_logger.debug("Moving on to the next host because " + h.toString() + " is unavailable");
                 }
                 continue;
             }
@@ -109,8 +111,8 @@ public class OvmFencer extends AdapterBase implements FenceBuilder {
             }
         }
 
-        if (logger.isDebugEnabled()) {
-            logger.debug("Unable to fence off " + vm.toString() + " on " + host.toString());
+        if (s_logger.isDebugEnabled()) {
+            s_logger.debug("Unable to fence off " + vm.toString() + " on " + host.toString());
         }
 
         return false;


Mime
View raw message