mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
1) More fixes for the problems found by findBugs
2) Corrected some logging in MidoNetPublicNetworkGuru - removed .toString method call on the objects in the log body as toString is called on the object by default when use log4j
This commit is contained in:
parent
90c485e5d6
commit
6c23e201ad
@ -99,5 +99,5 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
|
||||
|
||||
Map getDetails();
|
||||
|
||||
Boolean isDynamicallyScalable();
|
||||
boolean isDynamicallyScalable();
|
||||
}
|
||||
|
||||
@ -593,7 +593,7 @@ public class VMTemplateVO implements VirtualMachineTemplate {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isDynamicallyScalable() {
|
||||
public boolean isDynamicallyScalable() {
|
||||
return dynamicallyScalable;
|
||||
}
|
||||
|
||||
|
||||
@ -23,8 +23,6 @@ import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.acl.IAMEntityType;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
@ -37,6 +35,7 @@ import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
|
||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.to.DataObjectType;
|
||||
@ -435,8 +434,8 @@ public class TemplateObject implements TemplateInfo {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isDynamicallyScalable() {
|
||||
return Boolean.FALSE;
|
||||
public boolean isDynamicallyScalable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -27,12 +27,11 @@ import java.util.Random;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
|
||||
@ -25,11 +25,10 @@ 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.engine.subsystem.api.storage.StoragePoolAllocator;
|
||||
import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.deploy.DeploymentPlan;
|
||||
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
|
||||
|
||||
@ -108,8 +108,8 @@ public class TemplateEntityImpl implements TemplateEntity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean isDynamicallyScalable() {
|
||||
return null; //To change body of implemented methods use File | Settings | File Templates.
|
||||
public boolean isDynamicallyScalable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -26,9 +26,6 @@ import java.util.Map;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
|
||||
@ -41,7 +38,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.Scope;
|
||||
@ -61,8 +57,10 @@ import org.apache.cloudstack.storage.command.DeleteCommand;
|
||||
import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import org.apache.cloudstack.storage.to.TemplateObjectTO;
|
||||
import org.apache.cloudstack.storage.to.VolumeObjectTO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.agent.api.Answer;
|
||||
import com.cloud.agent.api.storage.ListVolumeAnswer;
|
||||
@ -75,8 +73,8 @@ import com.cloud.event.EventTypes;
|
||||
import com.cloud.event.UsageEventUtils;
|
||||
import com.cloud.exception.ConcurrentOperationException;
|
||||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.storage.DataStoreRole;
|
||||
import com.cloud.storage.ScopeType;
|
||||
import com.cloud.storage.StoragePool;
|
||||
@ -625,15 +623,15 @@ public class VolumeServiceImpl implements VolumeService {
|
||||
if (templatePoolRef != null) {
|
||||
long templatePoolRefId = templatePoolRef.getId();
|
||||
templatePoolRef = _tmpltPoolDao.acquireInLockTable(templatePoolRefId, 1200);
|
||||
if (templatePoolRef == null) {
|
||||
s_logger.warn("Reset Template State On Pool failed - unable to lock TemplatePoolRef " + templatePoolRefId);
|
||||
}
|
||||
|
||||
try {
|
||||
templatePoolRef.setDownloadState(VMTemplateStorageResourceAssoc.Status.NOT_DOWNLOADED);
|
||||
templatePoolRef.setState(ObjectInDataStoreStateMachine.State.Allocated);
|
||||
_tmpltPoolDao.update(templatePoolRefId, templatePoolRef);
|
||||
} finally {
|
||||
if (templatePoolRef == null) {
|
||||
s_logger.warn("Reset Template State On Pool failed - unable to lock TemplatePoolRef " + templatePoolRefId);
|
||||
} else {
|
||||
templatePoolRef.setDownloadState(VMTemplateStorageResourceAssoc.Status.NOT_DOWNLOADED);
|
||||
templatePoolRef.setState(ObjectInDataStoreStateMachine.State.Allocated);
|
||||
_tmpltPoolDao.update(templatePoolRefId, templatePoolRef);
|
||||
}
|
||||
}finally {
|
||||
_tmpltPoolDao.releaseFromLockTable(templatePoolRefId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,10 +23,9 @@ import java.util.Set;
|
||||
import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupDao;
|
||||
import org.apache.cloudstack.affinity.dao.AffinityGroupVMMapDao;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenter;
|
||||
@ -120,10 +119,10 @@ public class ExplicitDedicationProcessor extends AffinityProcessorBase implement
|
||||
DataCenterVO zoneOfHost = _dcDao.findById(host.getDataCenterId());
|
||||
if (resourceList != null && resourceList.size() != 0) {
|
||||
for (DedicatedResourceVO resource : resourceList) {
|
||||
if ((resource.getHostId() != null && resource.getHostId() == plan.getHostId()) ||
|
||||
(resource.getClusterId() != null && resource.getClusterId() == clusterofHost.getId()) ||
|
||||
(resource.getPodId() != null && resource.getPodId() == podOfHost.getId()) ||
|
||||
(resource.getDataCenterId() != null && resource.getDataCenterId() == zoneOfHost.getId())) {
|
||||
if ((resource.getHostId() != null && resource.getHostId().longValue() == plan.getHostId().longValue()) ||
|
||||
(resource.getClusterId() != null && resource.getClusterId().longValue() == clusterofHost.getId()) ||
|
||||
(resource.getPodId() != null && resource.getPodId().longValue() == podOfHost.getId()) ||
|
||||
(resource.getDataCenterId() != null && resource.getDataCenterId().longValue() == zoneOfHost.getId())) {
|
||||
canUse = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,10 +33,8 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
@ -44,18 +42,14 @@ import com.cloud.baremetal.networkservice.BareMetalResourceBase;
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.resource.Discoverer;
|
||||
import com.cloud.resource.DiscovererBase;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceStateAdapter;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.UnableDeleteHostException;
|
||||
@ -71,17 +65,7 @@ import com.cloud.vm.dao.VMInstanceDao;
|
||||
public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter {
|
||||
protected static final Logger s_logger = Logger.getLogger(BareMetalDiscoverer.class);
|
||||
@Inject
|
||||
protected ClusterDao _clusterDao;
|
||||
@Inject
|
||||
protected HostDao _hostDao;
|
||||
@Inject
|
||||
protected DataCenterDao _dcDao;
|
||||
@Inject
|
||||
protected VMInstanceDao _vmDao = null;
|
||||
@Inject
|
||||
protected ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
protected ConfigurationDao _configDao;
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
|
||||
@ -43,12 +43,9 @@ import com.cloud.agent.api.SetupCommand;
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
import com.cloud.alert.AlertManager;
|
||||
import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConnectionException;
|
||||
@ -58,13 +55,11 @@ import com.cloud.host.Host;
|
||||
import com.cloud.host.HostEnvironment;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.hypervisor.Hypervisor;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.hypervisor.hyperv.resource.HypervDirectConnectResource;
|
||||
import com.cloud.resource.Discoverer;
|
||||
import com.cloud.resource.DiscovererBase;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceStateAdapter;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.UnableDeleteHostException;
|
||||
@ -78,27 +73,14 @@ 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);
|
||||
|
||||
private String _instance;
|
||||
private String _mountParent;
|
||||
private int _timeout;
|
||||
Random _rand = new Random(System.currentTimeMillis());
|
||||
|
||||
Map<String, String> _storageMounts = new HashMap<String, String>();
|
||||
StorageLayer _storage;
|
||||
|
||||
@Inject
|
||||
private HostDao _hostDao = null;
|
||||
@Inject
|
||||
private ClusterDao _clusterDao;
|
||||
@Inject
|
||||
private ClusterDetailsDao _clusterDetailsDao;
|
||||
@Inject
|
||||
private ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
private HostPodDao _podDao;
|
||||
@Inject
|
||||
private DataCenterDao _dcDao;
|
||||
|
||||
|
||||
// TODO: AgentManager and AlertManager not being used to transmit info,
|
||||
// may want to reconsider.
|
||||
|
||||
@ -449,7 +449,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
protected int _stopTimeout;
|
||||
|
||||
// TODO vmsync {
|
||||
protected static HashMap<DomainInfo.DomainState, State> s_statesTable;
|
||||
protected static final HashMap<DomainInfo.DomainState, State> s_statesTable;
|
||||
static {
|
||||
s_statesTable = new HashMap<DomainInfo.DomainState, State>();
|
||||
s_statesTable.put(DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF, State.Stopped);
|
||||
@ -461,7 +461,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv
|
||||
}
|
||||
// TODO vmsync }
|
||||
|
||||
protected static HashMap<DomainInfo.DomainState, PowerState> s_powerStatesTable;
|
||||
protected static final HashMap<DomainInfo.DomainState, PowerState> s_powerStatesTable;
|
||||
static {
|
||||
s_powerStatesTable = new HashMap<DomainInfo.DomainState, PowerState>();
|
||||
s_powerStatesTable.put(DomainInfo.DomainState.VIR_DOMAIN_SHUTOFF, PowerState.PowerOff);
|
||||
|
||||
@ -30,8 +30,7 @@ import org.xml.sax.helpers.DefaultHandler;
|
||||
|
||||
public class LibvirtXMLParser extends DefaultHandler {
|
||||
private static final Logger s_logger = Logger.getLogger(LibvirtXMLParser.class);
|
||||
protected static SAXParserFactory s_spf;
|
||||
|
||||
protected static final SAXParserFactory s_spf;
|
||||
static {
|
||||
s_spf = SAXParserFactory.newInstance();
|
||||
|
||||
|
||||
@ -25,12 +25,11 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
|
||||
import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
|
||||
import org.apache.cloudstack.storage.resource.SecondaryStorageDiscoverer;
|
||||
import org.apache.cloudstack.storage.resource.SecondaryStorageResource;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.Listener;
|
||||
@ -55,8 +54,6 @@ public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer imp
|
||||
@Inject
|
||||
AgentManager _agentMgr;
|
||||
@Inject
|
||||
ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
SnapshotDao _snapshotDao;
|
||||
@Inject
|
||||
ImageStoreDao imageStoreDao;
|
||||
|
||||
@ -27,12 +27,8 @@ import javax.ejb.Local;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.vmware.vim25.ClusterDasConfigInfo;
|
||||
import com.vmware.vim25.ManagedObjectReference;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.agent.api.StartupCommand;
|
||||
import com.cloud.agent.api.StartupRoutingCommand;
|
||||
@ -42,7 +38,6 @@ import com.cloud.dc.ClusterDetailsDao;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.exception.DiscoveredWithErrorException;
|
||||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
@ -69,7 +64,6 @@ import com.cloud.network.element.CiscoNexusVSMElement;
|
||||
import com.cloud.network.element.NetworkElement;
|
||||
import com.cloud.resource.Discoverer;
|
||||
import com.cloud.resource.DiscovererBase;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceStateAdapter;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.UnableDeleteHostException;
|
||||
@ -80,6 +74,8 @@ import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.UriUtils;
|
||||
import com.vmware.vim25.ClusterDasConfigInfo;
|
||||
import com.vmware.vim25.ManagedObjectReference;
|
||||
|
||||
@Local(value = Discoverer.class)
|
||||
public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter {
|
||||
@ -94,13 +90,7 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
|
||||
@Inject
|
||||
ClusterDetailsDao _clusterDetailsDao;
|
||||
@Inject
|
||||
DataCenterDao _dcDao;
|
||||
@Inject
|
||||
ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
CiscoNexusVSMDeviceDao _nexusDao;
|
||||
CiscoNexusVSMElement _nexusElement;
|
||||
List<NetworkElement> networkElements;
|
||||
@Inject
|
||||
NetworkModel _netmgr;
|
||||
@Inject
|
||||
@ -113,6 +103,8 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer
|
||||
protected Map<String, String> _urlParams;
|
||||
protected boolean useDVS = false;
|
||||
protected boolean nexusDVS = false;
|
||||
CiscoNexusVSMElement _nexusElement;
|
||||
List<NetworkElement> networkElements;
|
||||
|
||||
public VmwareServerDiscoverer() {
|
||||
s_logger.info("VmwareServerDiscoverer is constructed");
|
||||
|
||||
@ -34,13 +34,6 @@ import javax.persistence.EntityExistsException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.xmlrpc.XmlRpcException;
|
||||
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.Host;
|
||||
import com.xensource.xenapi.Pool;
|
||||
import com.xensource.xenapi.Session;
|
||||
import com.xensource.xenapi.Types.SessionAuthenticationFailed;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
import com.cloud.agent.AgentManager;
|
||||
import com.cloud.agent.Listener;
|
||||
import com.cloud.agent.api.AgentControlAnswer;
|
||||
@ -57,7 +50,6 @@ import com.cloud.configuration.Config;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.DataCenterVO;
|
||||
import com.cloud.dc.HostPodVO;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.dc.dao.HostPodDao;
|
||||
import com.cloud.exception.AgentUnavailableException;
|
||||
import com.cloud.exception.ConnectionException;
|
||||
@ -85,7 +77,6 @@ import com.cloud.hypervisor.xen.resource.XenServerConnectionPool;
|
||||
import com.cloud.hypervisor.xen.resource.Xenserver625Resource;
|
||||
import com.cloud.resource.Discoverer;
|
||||
import com.cloud.resource.DiscovererBase;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceStateAdapter;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.UnableDeleteHostException;
|
||||
@ -99,6 +90,12 @@ import com.cloud.utils.db.QueryBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.exception.HypervisorVersionChangedException;
|
||||
import com.xensource.xenapi.Connection;
|
||||
import com.xensource.xenapi.Host;
|
||||
import com.xensource.xenapi.Pool;
|
||||
import com.xensource.xenapi.Session;
|
||||
import com.xensource.xenapi.Types.SessionAuthenticationFailed;
|
||||
import com.xensource.xenapi.Types.XenAPIException;
|
||||
|
||||
@Local(value = Discoverer.class)
|
||||
public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter {
|
||||
@ -122,11 +119,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
||||
@Inject
|
||||
VMTemplateDao _tmpltDao;
|
||||
@Inject
|
||||
ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
HostPodDao _podDao;
|
||||
@Inject
|
||||
DataCenterDao _dcDao;
|
||||
|
||||
protected XcpServerDiscoverer() {
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
// under the License.
|
||||
package com.cloud.hypervisor.xen.resource;
|
||||
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@ -329,7 +330,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
}
|
||||
}
|
||||
|
||||
protected static HashMap<Types.VmPowerState, PowerState> s_powerStatesTable;
|
||||
protected static final HashMap<Types.VmPowerState, PowerState> s_powerStatesTable;
|
||||
static {
|
||||
s_powerStatesTable = new HashMap<Types.VmPowerState, PowerState>();
|
||||
s_powerStatesTable.put(Types.VmPowerState.HALTED, PowerState.PowerOff);
|
||||
@ -340,7 +341,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe
|
||||
}
|
||||
|
||||
// TODO vmsync {
|
||||
protected static HashMap<Types.VmPowerState, State> s_statesTable;
|
||||
protected static final HashMap<Types.VmPowerState, State> s_statesTable;
|
||||
static {
|
||||
s_statesTable = new HashMap<Types.VmPowerState, State>();
|
||||
s_statesTable.put(Types.VmPowerState.HALTED, State.Stopped);
|
||||
|
||||
@ -72,7 +72,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
// Only change is to make broadcast domain type Mido
|
||||
@Override
|
||||
public Network design(NetworkOffering offering, DeploymentPlan plan, Network network, Account owner) {
|
||||
s_logger.debug("design called with network: " + network.toString());
|
||||
s_logger.debug("design called with network: " + network);
|
||||
if (!canHandle(offering)) {
|
||||
return null;
|
||||
}
|
||||
@ -96,7 +96,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
if (nic.getIp4Address() == null) {
|
||||
PublicIp ip = _ipAddrMgr.assignPublicIpAddress(dc.getId(), null, vm.getOwner(), Vlan.VlanType.VirtualNetwork, null, null, false);
|
||||
nic.setIp4Address(ip.getAddress().toString());
|
||||
nic.setIp4Address(ip.getAddress().addr());
|
||||
|
||||
nic.setGateway(ip.getGateway());
|
||||
|
||||
@ -121,7 +121,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
|
||||
@Override
|
||||
public void updateNicProfile(NicProfile profile, Network network) {
|
||||
s_logger.debug("updateNicProfile called with network: " + network.toString() + " profile: " + profile.toString());
|
||||
s_logger.debug("updateNicProfile called with network: " + network + " profile: " + profile);
|
||||
|
||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||
if (profile != null) {
|
||||
@ -134,16 +134,15 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
public NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
|
||||
InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
|
||||
s_logger.debug("allocate called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
|
||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||
|
||||
if (nic != null && nic.getRequestedIpv4() != null) {
|
||||
throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
|
||||
}
|
||||
|
||||
if (nic == null) {
|
||||
nic = new NicProfile(Nic.ReservationStrategy.Create, null, null, null, null);
|
||||
}
|
||||
s_logger.debug("allocate called with network: " + network + " nic: " + nic + " vm: " + vm);
|
||||
DataCenter dc = _dcDao.findById(network.getDataCenterId());
|
||||
|
||||
if (nic.getRequestedIpv4() != null) {
|
||||
throw new CloudRuntimeException("Does not support custom ip allocation at this time: " + nic);
|
||||
}
|
||||
|
||||
getIp(nic, dc, vm, network);
|
||||
|
||||
@ -163,7 +162,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
@Override
|
||||
public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException {
|
||||
s_logger.debug("reserve called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
|
||||
s_logger.debug("reserve called with network: " + network + " nic: " + nic + " vm: " + vm);
|
||||
if (nic.getIp4Address() == null) {
|
||||
getIp(nic, dest.getDataCenter(), vm, network);
|
||||
}
|
||||
@ -171,14 +170,14 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
|
||||
@Override
|
||||
public boolean release(NicProfile nic, VirtualMachineProfile vm, String reservationId) {
|
||||
s_logger.debug("release called with nic: " + nic.toString() + " vm: " + vm.toString());
|
||||
s_logger.debug("release called with nic: " + nic + " vm: " + vm);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context)
|
||||
throws InsufficientVirtualNetworkCapcityException {
|
||||
s_logger.debug("implement called with network: " + network.toString());
|
||||
s_logger.debug("implement called with network: " + network);
|
||||
long dcId = destination.getDataCenter().getId();
|
||||
|
||||
//get physical network id
|
||||
@ -205,7 +204,7 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
@Override
|
||||
@DB
|
||||
public void deallocate(Network network, NicProfile nic, VirtualMachineProfile vm) {
|
||||
s_logger.debug("deallocate called with network: " + network.toString() + " nic: " + nic.toString() + " vm: " + vm.toString());
|
||||
s_logger.debug("deallocate called with network: " + network + " nic: " + nic + " vm: " + vm);
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("public network deallocate network: networkId: " + nic.getNetworkId() + ", ip: " + nic.getIp4Address());
|
||||
}
|
||||
@ -229,12 +228,12 @@ public class MidoNetPublicNetworkGuru extends PublicNetworkGuru {
|
||||
|
||||
@Override
|
||||
public void shutdown(NetworkProfile network, NetworkOffering offering) {
|
||||
s_logger.debug("shutdown called with network: " + network.toString());
|
||||
s_logger.debug("shutdown called with network: " + network);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trash(Network network, NetworkOffering offering) {
|
||||
s_logger.debug("trash called with network: " + network.toString());
|
||||
s_logger.debug("trash called with network: " + network);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.network.PhysicalNetworkSetupInfo;
|
||||
import com.cloud.resource.Discoverer;
|
||||
import com.cloud.resource.DiscovererBase;
|
||||
import com.cloud.resource.ResourceManager;
|
||||
import com.cloud.resource.ResourceStateAdapter;
|
||||
import com.cloud.resource.ServerResource;
|
||||
import com.cloud.resource.UnableDeleteHostException;
|
||||
@ -65,8 +64,6 @@ public abstract class LibvirtServerDiscoverer extends DiscovererBase implements
|
||||
private String _kvmPublicNic;
|
||||
private String _kvmGuestNic;
|
||||
@Inject
|
||||
ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
AgentManager _agentMgr;
|
||||
|
||||
@Override
|
||||
|
||||
@ -25,13 +25,13 @@ import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.cloud.configuration.Config;
|
||||
import com.cloud.dc.ClusterVO;
|
||||
import com.cloud.dc.dao.ClusterDao;
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.host.HostVO;
|
||||
import com.cloud.host.dao.HostDao;
|
||||
import com.cloud.network.NetworkModel;
|
||||
@ -49,6 +49,10 @@ public abstract class DiscovererBase extends AdapterBase implements Discoverer {
|
||||
protected NetworkModel _networkMgr;
|
||||
@Inject
|
||||
protected HostDao _hostDao;
|
||||
@Inject
|
||||
protected ResourceManager _resourceMgr;
|
||||
@Inject
|
||||
protected DataCenterDao _dcDao;
|
||||
|
||||
@Override
|
||||
public boolean configure(String name, Map<String, Object> params) throws ConfigurationException {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user