mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
More changes for deployVM flow.
This commit is contained in:
parent
94e8090bf3
commit
e6cd47ddc0
@ -154,7 +154,7 @@ public class VMEntityManagerImpl implements VMEntityManager {
|
||||
|
||||
}
|
||||
|
||||
DeploymentPlanner planner = ComponentContext.getCompanent(plannerToUse);
|
||||
DeploymentPlanner planner = ComponentContext.getComponent(plannerToUse);
|
||||
DeployDestination dest = null;
|
||||
|
||||
if (planner.canHandle(vmProfile, plan, exclude)) {
|
||||
|
||||
@ -23,7 +23,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.ClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.org.Cluster.ClusterType;
|
||||
import com.cloud.org.Grouping.AllocationState;
|
||||
@ -36,7 +36,7 @@ public class ClusterEntityImpl implements ClusterEntity {
|
||||
|
||||
private DataCenterResourceManager manager;
|
||||
|
||||
private ClusterVO clusterVO;
|
||||
private EngineClusterVO clusterVO;
|
||||
|
||||
|
||||
public ClusterEntityImpl(String clusterId, DataCenterResourceManager manager) {
|
||||
|
||||
@ -18,10 +18,10 @@ package org.apache.cloudstack.engine.datacenter.entity.api;
|
||||
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.ClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.DataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO;
|
||||
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
|
||||
@ -29,22 +29,22 @@ import com.cloud.utils.fsm.NoTransitionException;
|
||||
|
||||
public interface DataCenterResourceManager {
|
||||
|
||||
DataCenterVO loadDataCenter(String dataCenterId);
|
||||
EngineDataCenterVO loadDataCenter(String dataCenterId);
|
||||
|
||||
void saveDataCenter(DataCenterVO dc);
|
||||
void saveDataCenter(EngineDataCenterVO dc);
|
||||
|
||||
void savePod(HostPodVO dc);
|
||||
void savePod(EngineHostPodVO dc);
|
||||
|
||||
void saveCluster(ClusterVO cluster);
|
||||
void saveCluster(EngineClusterVO cluster);
|
||||
|
||||
boolean changeState(DataCenterResourceEntity entity, Event event) throws NoTransitionException;
|
||||
|
||||
HostPodVO loadPod(String uuid);
|
||||
EngineHostPodVO loadPod(String uuid);
|
||||
|
||||
ClusterVO loadCluster(String uuid);
|
||||
EngineClusterVO loadCluster(String uuid);
|
||||
|
||||
HostVO loadHost(String uuid);
|
||||
EngineHostVO loadHost(String uuid);
|
||||
|
||||
void saveHost(HostVO hostVO);
|
||||
void saveHost(EngineHostVO hostVO);
|
||||
|
||||
}
|
||||
|
||||
@ -20,14 +20,14 @@ import javax.inject.Inject;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.ClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.DataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.ClusterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.DataCenterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.HostDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.HostPodDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineClusterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineDataCenterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@ -39,23 +39,23 @@ import com.cloud.utils.fsm.StateMachine2;
|
||||
public class DataCenterResourceManagerImpl implements DataCenterResourceManager {
|
||||
|
||||
@Inject
|
||||
DataCenterDao _dataCenterDao;
|
||||
EngineDataCenterDao _dataCenterDao;
|
||||
|
||||
@Inject
|
||||
HostPodDao _podDao;
|
||||
EngineHostPodDao _podDao;
|
||||
|
||||
@Inject
|
||||
ClusterDao _clusterDao;
|
||||
EngineClusterDao _clusterDao;
|
||||
|
||||
@Inject
|
||||
HostDao _hostDao;
|
||||
EngineHostDao _hostDao;
|
||||
|
||||
|
||||
protected StateMachine2<State, Event, DataCenterResourceEntity> _stateMachine = DataCenterResourceEntity.State.s_fsm;
|
||||
|
||||
@Override
|
||||
public DataCenterVO loadDataCenter(String dataCenterId) {
|
||||
DataCenterVO dataCenterVO = _dataCenterDao.findByUuid(dataCenterId);
|
||||
public EngineDataCenterVO loadDataCenter(String dataCenterId) {
|
||||
EngineDataCenterVO dataCenterVO = _dataCenterDao.findByUuid(dataCenterId);
|
||||
if(dataCenterVO == null){
|
||||
throw new InvalidParameterValueException("Zone does not exist");
|
||||
}
|
||||
@ -63,7 +63,7 @@ public class DataCenterResourceManagerImpl implements DataCenterResourceManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDataCenter(DataCenterVO dc) {
|
||||
public void saveDataCenter(EngineDataCenterVO dc) {
|
||||
_dataCenterDao.persist(dc);
|
||||
|
||||
}
|
||||
@ -85,8 +85,8 @@ public class DataCenterResourceManagerImpl implements DataCenterResourceManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostPodVO loadPod(String uuid) {
|
||||
HostPodVO pod = _podDao.findByUuid(uuid);
|
||||
public EngineHostPodVO loadPod(String uuid) {
|
||||
EngineHostPodVO pod = _podDao.findByUuid(uuid);
|
||||
if(pod == null){
|
||||
throw new InvalidParameterValueException("Pod does not exist");
|
||||
}
|
||||
@ -94,8 +94,8 @@ public class DataCenterResourceManagerImpl implements DataCenterResourceManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClusterVO loadCluster(String uuid) {
|
||||
ClusterVO cluster = _clusterDao.findByUuid(uuid);
|
||||
public EngineClusterVO loadCluster(String uuid) {
|
||||
EngineClusterVO cluster = _clusterDao.findByUuid(uuid);
|
||||
if(cluster == null){
|
||||
throw new InvalidParameterValueException("Pod does not exist");
|
||||
}
|
||||
@ -103,18 +103,18 @@ public class DataCenterResourceManagerImpl implements DataCenterResourceManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public void savePod(HostPodVO pod) {
|
||||
public void savePod(EngineHostPodVO pod) {
|
||||
_podDao.persist(pod);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveCluster(ClusterVO cluster) {
|
||||
public void saveCluster(EngineClusterVO cluster) {
|
||||
_clusterDao.persist(cluster);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO loadHost(String uuid) {
|
||||
HostVO host = _hostDao.findByUuid(uuid);
|
||||
public EngineHostVO loadHost(String uuid) {
|
||||
EngineHostVO host = _hostDao.findByUuid(uuid);
|
||||
if(host == null){
|
||||
throw new InvalidParameterValueException("Host does not exist");
|
||||
}
|
||||
@ -122,7 +122,7 @@ public class DataCenterResourceManagerImpl implements DataCenterResourceManager
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveHost(HostVO hostVO) {
|
||||
public void saveHost(EngineHostVO hostVO) {
|
||||
_hostDao.persist(hostVO);
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO;
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
@ -31,7 +31,7 @@ public class HostEntityImpl implements HostEntity {
|
||||
|
||||
private DataCenterResourceManager manager;
|
||||
|
||||
private HostVO hostVO;
|
||||
private EngineHostVO hostVO;
|
||||
|
||||
public HostEntityImpl(String uuid, DataCenterResourceManager manager) {
|
||||
this.manager = manager;
|
||||
|
||||
@ -24,7 +24,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO;
|
||||
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.org.Grouping.AllocationState;
|
||||
@ -35,7 +35,7 @@ public class PodEntityImpl implements PodEntity {
|
||||
|
||||
private DataCenterResourceManager manager;
|
||||
|
||||
private HostPodVO podVO;
|
||||
private EngineHostPodVO podVO;
|
||||
|
||||
public PodEntityImpl(String uuid, DataCenterResourceManager manager) {
|
||||
this.manager = manager;
|
||||
|
||||
@ -26,7 +26,7 @@ import java.util.Map;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.DataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO;
|
||||
import com.cloud.utils.fsm.FiniteStateObject;
|
||||
import com.cloud.utils.fsm.NoTransitionException;
|
||||
|
||||
@ -37,7 +37,7 @@ public class ZoneEntityImpl implements ZoneEntity, FiniteStateObject<DataCenterR
|
||||
|
||||
private DataCenterResourceManager manager;
|
||||
|
||||
private DataCenterVO dataCenterVO;
|
||||
private EngineDataCenterVO dataCenterVO;
|
||||
|
||||
|
||||
public ZoneEntityImpl(String dataCenterId, DataCenterResourceManager manager) {
|
||||
|
||||
@ -40,7 +40,7 @@ import com.cloud.utils.db.StateMachine;
|
||||
|
||||
@Entity
|
||||
@Table(name="cluster")
|
||||
public class ClusterVO implements Cluster, Identity {
|
||||
public class EngineClusterVO implements Cluster, Identity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@ -99,19 +99,19 @@ public class ClusterVO implements Cluster, Identity {
|
||||
*/
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
@StateMachine(state=State.class, event=Event.class)
|
||||
@Column(name="state", updatable=true, nullable=false, length=32)
|
||||
protected State state = null;
|
||||
@Column(name="engine_state", updatable=true, nullable=false, length=32)
|
||||
protected State engineState = null;
|
||||
|
||||
|
||||
public ClusterVO() {
|
||||
public EngineClusterVO() {
|
||||
clusterType = Cluster.ClusterType.CloudManaged;
|
||||
allocationState = Grouping.AllocationState.Enabled;
|
||||
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
this.engineState = State.Disabled;
|
||||
}
|
||||
|
||||
public ClusterVO(long dataCenterId, long podId, String name) {
|
||||
public EngineClusterVO(long dataCenterId, long podId, String name) {
|
||||
this.dataCenterId = dataCenterId;
|
||||
this.podId = podId;
|
||||
this.name = name;
|
||||
@ -119,7 +119,7 @@ public class ClusterVO implements Cluster, Identity {
|
||||
this.allocationState = Grouping.AllocationState.Enabled;
|
||||
this.managedState = ManagedState.Managed;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
this.engineState = State.Disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -169,7 +169,7 @@ public class ClusterVO implements Cluster, Identity {
|
||||
this.managedState = managedState;
|
||||
}
|
||||
|
||||
public ClusterVO(long clusterId) {
|
||||
public EngineClusterVO(long clusterId) {
|
||||
this.id = clusterId;
|
||||
}
|
||||
|
||||
@ -180,10 +180,10 @@ public class ClusterVO implements Cluster, Identity {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ClusterVO)) {
|
||||
if (!(obj instanceof EngineClusterVO)) {
|
||||
return false;
|
||||
}
|
||||
ClusterVO that = (ClusterVO)obj;
|
||||
EngineClusterVO that = (EngineClusterVO)obj;
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@ -238,6 +238,6 @@ public class ClusterVO implements Cluster, Identity {
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
return engineState;
|
||||
}
|
||||
}
|
||||
@ -42,7 +42,7 @@ import com.cloud.utils.db.StateMachine;
|
||||
|
||||
@Entity
|
||||
@Table(name="data_center")
|
||||
public class DataCenterVO implements DataCenter, Identity {
|
||||
public class EngineDataCenterVO implements DataCenter, Identity {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@ -151,8 +151,8 @@ public class DataCenterVO implements DataCenter, Identity {
|
||||
*/
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
@StateMachine(state=State.class, event=Event.class)
|
||||
@Column(name="state", updatable=true, nullable=false, length=32)
|
||||
protected State state = null;
|
||||
@Column(name="engine_state", updatable=true, nullable=false, length=32)
|
||||
protected State engineState = null;
|
||||
|
||||
|
||||
@Override
|
||||
@ -200,14 +200,14 @@ public class DataCenterVO implements DataCenter, Identity {
|
||||
this.firewallProvider = firewallProvider;
|
||||
}
|
||||
|
||||
public DataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix) {
|
||||
public EngineDataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix) {
|
||||
this(name, description, dns1, dns2, dns3, dns4, guestCidr, domain, domainId, zoneType, zoneToken, domainSuffix, false, false);
|
||||
this.id = id;
|
||||
this.allocationState = Grouping.AllocationState.Enabled;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
public DataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled) {
|
||||
public EngineDataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.dns1 = dns1;
|
||||
@ -240,7 +240,7 @@ public class DataCenterVO implements DataCenter, Identity {
|
||||
this.zoneToken = zoneToken;
|
||||
this.domain = domainSuffix;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
this.engineState = State.Disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -310,7 +310,7 @@ public class DataCenterVO implements DataCenter, Identity {
|
||||
return internalDns2;
|
||||
}
|
||||
|
||||
protected DataCenterVO() {
|
||||
protected EngineDataCenterVO() {
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -421,10 +421,10 @@ public class DataCenterVO implements DataCenter, Identity {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof DataCenterVO)) {
|
||||
if (!(obj instanceof EngineDataCenterVO)) {
|
||||
return false;
|
||||
}
|
||||
DataCenterVO that = (DataCenterVO)obj;
|
||||
EngineDataCenterVO that = (EngineDataCenterVO)obj;
|
||||
return this.id == that.id;
|
||||
}
|
||||
|
||||
@ -475,6 +475,6 @@ public class DataCenterVO implements DataCenter, Identity {
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
return engineState;
|
||||
}
|
||||
}
|
||||
@ -38,7 +38,7 @@ import com.cloud.utils.db.StateMachine;
|
||||
|
||||
@Entity
|
||||
@Table(name = "host_pod_ref")
|
||||
public class HostPodVO implements Pod, Identity {
|
||||
public class EngineHostPodVO implements Pod, Identity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
long id;
|
||||
@ -92,10 +92,10 @@ public class HostPodVO implements Pod, Identity {
|
||||
*/
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
@StateMachine(state=State.class, event=Event.class)
|
||||
@Column(name="state", updatable=true, nullable=false, length=32)
|
||||
protected State state = null;
|
||||
@Column(name="engine_state", updatable=true, nullable=false, length=32)
|
||||
protected State engineState = null;
|
||||
|
||||
public HostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) {
|
||||
public EngineHostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) {
|
||||
this.name = name;
|
||||
this.dataCenterId = dcId;
|
||||
this.gateway = gateway;
|
||||
@ -105,13 +105,13 @@ public class HostPodVO implements Pod, Identity {
|
||||
this.allocationState = Grouping.AllocationState.Enabled;
|
||||
this.externalDhcp = false;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
this.engineState = State.Disabled;
|
||||
}
|
||||
|
||||
/*
|
||||
* public HostPodVO(String name, long dcId) { this(null, name, dcId); }
|
||||
*/
|
||||
protected HostPodVO() {
|
||||
protected EngineHostPodVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ public class HostPodVO implements Pod, Identity {
|
||||
}
|
||||
|
||||
// Use for comparisons only.
|
||||
public HostPodVO(Long id) {
|
||||
public EngineHostPodVO(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@ -204,8 +204,8 @@ public class HostPodVO implements Pod, Identity {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof HostPodVO) {
|
||||
return id == ((HostPodVO)obj).id;
|
||||
if (obj instanceof EngineHostPodVO) {
|
||||
return id == ((EngineHostPodVO)obj).id;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -241,6 +241,6 @@ public class HostPodVO implements Pod, Identity {
|
||||
}
|
||||
|
||||
public State getState() {
|
||||
return state;
|
||||
return engineState;
|
||||
}
|
||||
}
|
||||
@ -54,7 +54,7 @@ import com.cloud.utils.db.StateMachine;
|
||||
@Table(name="host")
|
||||
@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS)
|
||||
@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32)
|
||||
public class HostVO implements Host, Identity {
|
||||
public class EngineHostVO implements Host, Identity {
|
||||
@Id
|
||||
@GeneratedValue(strategy=GenerationType.IDENTITY)
|
||||
@Column(name="id")
|
||||
@ -383,26 +383,26 @@ public class HostVO implements Host, Identity {
|
||||
*/
|
||||
@Enumerated(value=EnumType.STRING)
|
||||
@StateMachine(state=State.class, event=Event.class)
|
||||
@Column(name="state", updatable=true, nullable=false, length=32)
|
||||
protected State state = null;
|
||||
@Column(name="engine_state", updatable=true, nullable=false, length=32)
|
||||
protected State engineState = null;
|
||||
|
||||
|
||||
public HostVO(String guid) {
|
||||
public EngineHostVO(String guid) {
|
||||
this.guid = guid;
|
||||
this.status = Status.Creating;
|
||||
this.totalMemory = 0;
|
||||
this.dom0MinMemory = 0;
|
||||
this.resourceState = ResourceState.Creating;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
this.engineState = State.Disabled;
|
||||
}
|
||||
|
||||
protected HostVO() {
|
||||
protected EngineHostVO() {
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
this.engineState = State.Disabled;
|
||||
}
|
||||
|
||||
public HostVO(long id,
|
||||
public EngineHostVO(long id,
|
||||
String name,
|
||||
Type type,
|
||||
String privateIpAddress,
|
||||
@ -434,10 +434,10 @@ public class HostVO implements Host, Identity {
|
||||
this.totalSize = totalSize;
|
||||
this.fsType = fsType;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
this.engineState = State.Disabled;
|
||||
}
|
||||
|
||||
public HostVO(long id,
|
||||
public EngineHostVO(long id,
|
||||
String name,
|
||||
Type type,
|
||||
String privateIpAddress,
|
||||
@ -493,7 +493,7 @@ public class HostVO implements Host, Identity {
|
||||
this.dom0MinMemory = dom0MinMemory;
|
||||
this.storageUrl = url;
|
||||
this.uuid = UUID.randomUUID().toString();
|
||||
this.state = State.Disabled;
|
||||
this.engineState = State.Disabled;
|
||||
}
|
||||
|
||||
public void setPodId(Long podId) {
|
||||
@ -689,8 +689,8 @@ public class HostVO implements Host, Identity {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof HostVO) {
|
||||
return ((HostVO)obj).getId() == this.getId();
|
||||
if (obj instanceof EngineHostVO) {
|
||||
return ((EngineHostVO)obj).getId() == this.getId();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@ -774,6 +774,6 @@ public class HostVO implements Host, Identity {
|
||||
}
|
||||
|
||||
public State getOrchestrationState() {
|
||||
return state;
|
||||
return engineState;
|
||||
}
|
||||
}
|
||||
@ -16,21 +16,21 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.ClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO;
|
||||
|
||||
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.fsm.StateDao;
|
||||
|
||||
public interface ClusterDao extends GenericDao<ClusterVO, Long>, StateDao<DataCenterResourceEntity.State, DataCenterResourceEntity.State.Event, DataCenterResourceEntity> {
|
||||
List<ClusterVO> listByPodId(long podId);
|
||||
ClusterVO findBy(String name, long podId);
|
||||
List<ClusterVO> listByHyTypeWithoutGuid(String hyType);
|
||||
List<ClusterVO> listByZoneId(long zoneId);
|
||||
public interface EngineClusterDao extends GenericDao<EngineClusterVO, Long>, StateDao<DataCenterResourceEntity.State, DataCenterResourceEntity.State.Event, DataCenterResourceEntity> {
|
||||
List<EngineClusterVO> listByPodId(long podId);
|
||||
EngineClusterVO findBy(String name, long podId);
|
||||
List<EngineClusterVO> listByHyTypeWithoutGuid(String hyType);
|
||||
List<EngineClusterVO> listByZoneId(long zoneId);
|
||||
|
||||
List<HypervisorType> getAvailableHypervisorInZone(Long zoneId);
|
||||
List<ClusterVO> listByDcHyType(long dcId, String hyType);
|
||||
List<EngineClusterVO> listByDcHyType(long dcId, String hyType);
|
||||
Map<Long, List<Long>> getPodClusterIdMap(List<Long> clusterIds);
|
||||
List<Long> listDisabledClusters(long zoneId, Long podId);
|
||||
List<Long> listClustersWithDisabledPods(long zoneId);
|
||||
@ -27,8 +27,8 @@ import javax.inject.Inject;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.ClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -46,24 +46,24 @@ import com.cloud.utils.db.UpdateBuilder;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Component(value="EngineClusterDao")
|
||||
@Local(value=ClusterDao.class)
|
||||
public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements ClusterDao {
|
||||
private static final Logger s_logger = Logger.getLogger(ClusterDaoImpl.class);
|
||||
@Local(value=EngineClusterDao.class)
|
||||
public class EngineClusterDaoImpl extends GenericDaoBase<EngineClusterVO, Long> implements EngineClusterDao {
|
||||
private static final Logger s_logger = Logger.getLogger(EngineClusterDaoImpl.class);
|
||||
|
||||
protected final SearchBuilder<ClusterVO> PodSearch;
|
||||
protected final SearchBuilder<ClusterVO> HyTypeWithoutGuidSearch;
|
||||
protected final SearchBuilder<ClusterVO> AvailHyperSearch;
|
||||
protected final SearchBuilder<ClusterVO> ZoneSearch;
|
||||
protected final SearchBuilder<ClusterVO> ZoneHyTypeSearch;
|
||||
protected SearchBuilder<ClusterVO> StateChangeSearch;
|
||||
protected SearchBuilder<ClusterVO> UUIDSearch;
|
||||
protected final SearchBuilder<EngineClusterVO> PodSearch;
|
||||
protected final SearchBuilder<EngineClusterVO> HyTypeWithoutGuidSearch;
|
||||
protected final SearchBuilder<EngineClusterVO> AvailHyperSearch;
|
||||
protected final SearchBuilder<EngineClusterVO> ZoneSearch;
|
||||
protected final SearchBuilder<EngineClusterVO> ZoneHyTypeSearch;
|
||||
protected SearchBuilder<EngineClusterVO> StateChangeSearch;
|
||||
protected SearchBuilder<EngineClusterVO> UUIDSearch;
|
||||
|
||||
private static final String GET_POD_CLUSTER_MAP_PREFIX = "SELECT pod_id, id FROM cloud.cluster WHERE cluster.id IN( ";
|
||||
private static final String GET_POD_CLUSTER_MAP_SUFFIX = " )";
|
||||
|
||||
@Inject protected HostPodDao _hostPodDao;
|
||||
@Inject protected EngineHostPodDao _hostPodDao;
|
||||
|
||||
protected ClusterDaoImpl() {
|
||||
protected EngineClusterDaoImpl() {
|
||||
super();
|
||||
|
||||
HyTypeWithoutGuidSearch = createSearchBuilder();
|
||||
@ -102,23 +102,23 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClusterVO> listByZoneId(long zoneId) {
|
||||
SearchCriteria<ClusterVO> sc = ZoneSearch.create();
|
||||
public List<EngineClusterVO> listByZoneId(long zoneId) {
|
||||
SearchCriteria<EngineClusterVO> sc = ZoneSearch.create();
|
||||
sc.setParameters("dataCenterId", zoneId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClusterVO> listByPodId(long podId) {
|
||||
SearchCriteria<ClusterVO> sc = PodSearch.create();
|
||||
public List<EngineClusterVO> listByPodId(long podId) {
|
||||
SearchCriteria<EngineClusterVO> sc = PodSearch.create();
|
||||
sc.setParameters("pod", podId);
|
||||
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClusterVO findBy(String name, long podId) {
|
||||
SearchCriteria<ClusterVO> sc = PodSearch.create();
|
||||
public EngineClusterVO findBy(String name, long podId) {
|
||||
SearchCriteria<EngineClusterVO> sc = PodSearch.create();
|
||||
sc.setParameters("pod", podId);
|
||||
sc.setParameters("name", name);
|
||||
|
||||
@ -126,16 +126,16 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClusterVO> listByHyTypeWithoutGuid(String hyType) {
|
||||
SearchCriteria<ClusterVO> sc = HyTypeWithoutGuidSearch.create();
|
||||
public List<EngineClusterVO> listByHyTypeWithoutGuid(String hyType) {
|
||||
SearchCriteria<EngineClusterVO> sc = HyTypeWithoutGuidSearch.create();
|
||||
sc.setParameters("hypervisorType", hyType);
|
||||
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ClusterVO> listByDcHyType(long dcId, String hyType) {
|
||||
SearchCriteria<ClusterVO> sc = ZoneHyTypeSearch.create();
|
||||
public List<EngineClusterVO> listByDcHyType(long dcId, String hyType) {
|
||||
SearchCriteria<EngineClusterVO> sc = ZoneHyTypeSearch.create();
|
||||
sc.setParameters("dataCenterId", dcId);
|
||||
sc.setParameters("hypervisorType", hyType);
|
||||
return listBy(sc);
|
||||
@ -143,13 +143,13 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
|
||||
@Override
|
||||
public List<HypervisorType> getAvailableHypervisorInZone(Long zoneId) {
|
||||
SearchCriteria<ClusterVO> sc = AvailHyperSearch.create();
|
||||
SearchCriteria<EngineClusterVO> sc = AvailHyperSearch.create();
|
||||
if (zoneId != null) {
|
||||
sc.setParameters("zoneId", zoneId);
|
||||
}
|
||||
List<ClusterVO> clusters = listBy(sc);
|
||||
List<EngineClusterVO> clusters = listBy(sc);
|
||||
List<HypervisorType> hypers = new ArrayList<HypervisorType>(4);
|
||||
for (ClusterVO cluster : clusters) {
|
||||
for (EngineClusterVO cluster : clusters) {
|
||||
hypers.add(cluster.getHypervisorType());
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
|
||||
@Override
|
||||
public List<Long> listDisabledClusters(long zoneId, Long podId) {
|
||||
GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
|
||||
GenericSearchBuilder<EngineClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
|
||||
clusterIdSearch.selectField(clusterIdSearch.entity().getId());
|
||||
clusterIdSearch.and("dataCenterId", clusterIdSearch.entity().getDataCenterId(), Op.EQ);
|
||||
if(podId != null){
|
||||
@ -219,12 +219,12 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
@Override
|
||||
public List<Long> listClustersWithDisabledPods(long zoneId) {
|
||||
|
||||
GenericSearchBuilder<HostPodVO, Long> disabledPodIdSearch = _hostPodDao.createSearchBuilder(Long.class);
|
||||
GenericSearchBuilder<EngineHostPodVO, Long> disabledPodIdSearch = _hostPodDao.createSearchBuilder(Long.class);
|
||||
disabledPodIdSearch.selectField(disabledPodIdSearch.entity().getId());
|
||||
disabledPodIdSearch.and("dataCenterId", disabledPodIdSearch.entity().getDataCenterId(), Op.EQ);
|
||||
disabledPodIdSearch.and("allocationState", disabledPodIdSearch.entity().getAllocationState(), Op.EQ);
|
||||
|
||||
GenericSearchBuilder<ClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
|
||||
GenericSearchBuilder<EngineClusterVO, Long> clusterIdSearch = createSearchBuilder(Long.class);
|
||||
clusterIdSearch.selectField(clusterIdSearch.entity().getId());
|
||||
clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(), JoinBuilder.JoinType.INNER);
|
||||
clusterIdSearch.done();
|
||||
@ -241,7 +241,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
public boolean remove(Long id) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
ClusterVO cluster = createForUpdate();
|
||||
EngineClusterVO cluster = createForUpdate();
|
||||
cluster.setName(null);
|
||||
cluster.setGuid(null);
|
||||
|
||||
@ -255,11 +255,11 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
@Override
|
||||
public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity clusterEntity, Object data) {
|
||||
|
||||
ClusterVO vo = findById(clusterEntity.getId());
|
||||
EngineClusterVO vo = findById(clusterEntity.getId());
|
||||
|
||||
Date oldUpdatedTime = vo.getLastUpdated();
|
||||
|
||||
SearchCriteria<ClusterVO> sc = StateChangeSearch.create();
|
||||
SearchCriteria<EngineClusterVO> sc = StateChangeSearch.create();
|
||||
sc.setParameters("id", vo.getId());
|
||||
sc.setParameters("state", currentState);
|
||||
|
||||
@ -270,7 +270,7 @@ public class ClusterDaoImpl extends GenericDaoBase<ClusterVO, Long> implements C
|
||||
int rows = update(vo, sc);
|
||||
|
||||
if (rows == 0 && s_logger.isDebugEnabled()) {
|
||||
ClusterVO dbCluster = findByIdIncludingRemoved(vo.getId());
|
||||
EngineClusterVO dbCluster = findByIdIncludingRemoved(vo.getId());
|
||||
if (dbCluster != null) {
|
||||
StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
|
||||
str.append(": DB Data={id=").append(dbCluster.getId()).append("; state=").append(dbCluster.getState()).append(";updatedTime=")
|
||||
@ -16,15 +16,15 @@ import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.DataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO;
|
||||
|
||||
import com.cloud.utils.Pair;
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.fsm.StateDao;
|
||||
|
||||
|
||||
public interface DataCenterDao extends GenericDao<DataCenterVO, Long>, StateDao<DataCenterResourceEntity.State, DataCenterResourceEntity.State.Event, DataCenterResourceEntity> {
|
||||
DataCenterVO findByName(String name);
|
||||
public interface EngineDataCenterDao extends GenericDao<EngineDataCenterVO, Long>, StateDao<DataCenterResourceEntity.State, DataCenterResourceEntity.State.Event, DataCenterResourceEntity> {
|
||||
EngineDataCenterVO findByName(String name);
|
||||
|
||||
/**
|
||||
* @param id data center id
|
||||
@ -32,24 +32,24 @@ public interface DataCenterDao extends GenericDao<DataCenterVO, Long>, StateDao<
|
||||
*/
|
||||
String[] getNextAvailableMacAddressPair(long id);
|
||||
String[] getNextAvailableMacAddressPair(long id, long mask);
|
||||
List<DataCenterVO> findZonesByDomainId(Long domainId);
|
||||
List<EngineDataCenterVO> findZonesByDomainId(Long domainId);
|
||||
|
||||
List<DataCenterVO> listPublicZones(String keyword);
|
||||
List<EngineDataCenterVO> listPublicZones(String keyword);
|
||||
|
||||
List<DataCenterVO> findChildZones(Object[] ids, String keyword);
|
||||
List<EngineDataCenterVO> findChildZones(Object[] ids, String keyword);
|
||||
|
||||
void loadDetails(DataCenterVO zone);
|
||||
void saveDetails(DataCenterVO zone);
|
||||
void loadDetails(EngineDataCenterVO zone);
|
||||
void saveDetails(EngineDataCenterVO zone);
|
||||
|
||||
List<DataCenterVO> listDisabledZones();
|
||||
List<DataCenterVO> listEnabledZones();
|
||||
DataCenterVO findByToken(String zoneToken);
|
||||
DataCenterVO findByTokenOrIdOrName(String tokenIdOrName);
|
||||
List<EngineDataCenterVO> listDisabledZones();
|
||||
List<EngineDataCenterVO> listEnabledZones();
|
||||
EngineDataCenterVO findByToken(String zoneToken);
|
||||
EngineDataCenterVO findByTokenOrIdOrName(String tokenIdOrName);
|
||||
|
||||
|
||||
|
||||
List<DataCenterVO> findZonesByDomainId(Long domainId, String keyword);
|
||||
List<EngineDataCenterVO> findZonesByDomainId(Long domainId, String keyword);
|
||||
|
||||
List<DataCenterVO> findByKeyword(String keyword);
|
||||
List<EngineDataCenterVO> findByKeyword(String keyword);
|
||||
|
||||
}
|
||||
@ -25,7 +25,7 @@ import javax.persistence.TableGenerator;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.DataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -48,18 +48,18 @@ import com.cloud.utils.net.NetUtils;
|
||||
* }
|
||||
**/
|
||||
@Component(value="EngineDataCenterDao")
|
||||
@Local(value={DataCenterDao.class})
|
||||
public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implements DataCenterDao {
|
||||
private static final Logger s_logger = Logger.getLogger(DataCenterDaoImpl.class);
|
||||
@Local(value={EngineDataCenterDao.class})
|
||||
public class EngineDataCenterDaoImpl extends GenericDaoBase<EngineDataCenterVO, Long> implements EngineDataCenterDao {
|
||||
private static final Logger s_logger = Logger.getLogger(EngineDataCenterDaoImpl.class);
|
||||
|
||||
protected SearchBuilder<DataCenterVO> NameSearch;
|
||||
protected SearchBuilder<DataCenterVO> ListZonesByDomainIdSearch;
|
||||
protected SearchBuilder<DataCenterVO> PublicZonesSearch;
|
||||
protected SearchBuilder<DataCenterVO> ChildZonesSearch;
|
||||
protected SearchBuilder<DataCenterVO> DisabledZonesSearch;
|
||||
protected SearchBuilder<DataCenterVO> TokenSearch;
|
||||
protected SearchBuilder<DataCenterVO> StateChangeSearch;
|
||||
protected SearchBuilder<DataCenterVO> UUIDSearch;
|
||||
protected SearchBuilder<EngineDataCenterVO> NameSearch;
|
||||
protected SearchBuilder<EngineDataCenterVO> ListZonesByDomainIdSearch;
|
||||
protected SearchBuilder<EngineDataCenterVO> PublicZonesSearch;
|
||||
protected SearchBuilder<EngineDataCenterVO> ChildZonesSearch;
|
||||
protected SearchBuilder<EngineDataCenterVO> DisabledZonesSearch;
|
||||
protected SearchBuilder<EngineDataCenterVO> TokenSearch;
|
||||
protected SearchBuilder<EngineDataCenterVO> StateChangeSearch;
|
||||
protected SearchBuilder<EngineDataCenterVO> UUIDSearch;
|
||||
|
||||
protected long _prefix;
|
||||
protected Random _rand = new Random(System.currentTimeMillis());
|
||||
@ -69,33 +69,33 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
|
||||
|
||||
@Override
|
||||
public DataCenterVO findByName(String name) {
|
||||
SearchCriteria<DataCenterVO> sc = NameSearch.create();
|
||||
public EngineDataCenterVO findByName(String name) {
|
||||
SearchCriteria<EngineDataCenterVO> sc = NameSearch.create();
|
||||
sc.setParameters("name", name);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public DataCenterVO findByToken(String zoneToken){
|
||||
SearchCriteria<DataCenterVO> sc = TokenSearch.create();
|
||||
public EngineDataCenterVO findByToken(String zoneToken){
|
||||
SearchCriteria<EngineDataCenterVO> sc = TokenSearch.create();
|
||||
sc.setParameters("zoneToken", zoneToken);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCenterVO> findZonesByDomainId(Long domainId){
|
||||
SearchCriteria<DataCenterVO> sc = ListZonesByDomainIdSearch.create();
|
||||
public List<EngineDataCenterVO> findZonesByDomainId(Long domainId){
|
||||
SearchCriteria<EngineDataCenterVO> sc = ListZonesByDomainIdSearch.create();
|
||||
sc.setParameters("domainId", domainId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCenterVO> findZonesByDomainId(Long domainId, String keyword){
|
||||
SearchCriteria<DataCenterVO> sc = ListZonesByDomainIdSearch.create();
|
||||
public List<EngineDataCenterVO> findZonesByDomainId(Long domainId, String keyword){
|
||||
SearchCriteria<EngineDataCenterVO> sc = ListZonesByDomainIdSearch.create();
|
||||
sc.setParameters("domainId", domainId);
|
||||
if (keyword != null) {
|
||||
SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
|
||||
SearchCriteria<EngineDataCenterVO> ssc = createSearchCriteria();
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
|
||||
@ -104,11 +104,11 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCenterVO> findChildZones(Object[] ids, String keyword){
|
||||
SearchCriteria<DataCenterVO> sc = ChildZonesSearch.create();
|
||||
public List<EngineDataCenterVO> findChildZones(Object[] ids, String keyword){
|
||||
SearchCriteria<EngineDataCenterVO> sc = ChildZonesSearch.create();
|
||||
sc.setParameters("domainid", ids);
|
||||
if (keyword != null) {
|
||||
SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
|
||||
SearchCriteria<EngineDataCenterVO> ssc = createSearchCriteria();
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
|
||||
@ -117,10 +117,10 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCenterVO> listPublicZones(String keyword){
|
||||
SearchCriteria<DataCenterVO> sc = PublicZonesSearch.create();
|
||||
public List<EngineDataCenterVO> listPublicZones(String keyword){
|
||||
SearchCriteria<EngineDataCenterVO> sc = PublicZonesSearch.create();
|
||||
if (keyword != null) {
|
||||
SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
|
||||
SearchCriteria<EngineDataCenterVO> ssc = createSearchCriteria();
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
|
||||
@ -130,8 +130,8 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCenterVO> findByKeyword(String keyword){
|
||||
SearchCriteria<DataCenterVO> ssc = createSearchCriteria();
|
||||
public List<EngineDataCenterVO> findByKeyword(String keyword){
|
||||
SearchCriteria<EngineDataCenterVO> ssc = createSearchCriteria();
|
||||
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
|
||||
return listBy(ssc);
|
||||
@ -170,7 +170,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
return true;
|
||||
}
|
||||
|
||||
protected DataCenterDaoImpl() {
|
||||
protected EngineDataCenterDaoImpl() {
|
||||
super();
|
||||
NameSearch = createSearchBuilder();
|
||||
NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
@ -211,7 +211,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public boolean update(Long zoneId, DataCenterVO zone) {
|
||||
public boolean update(Long zoneId, EngineDataCenterVO zone) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
boolean persisted = super.update(zoneId, zone);
|
||||
@ -224,13 +224,13 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadDetails(DataCenterVO zone) {
|
||||
public void loadDetails(EngineDataCenterVO zone) {
|
||||
Map<String, String> details =_detailsDao.findDetails(zone.getId());
|
||||
zone.setDetails(details);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDetails(DataCenterVO zone) {
|
||||
public void saveDetails(EngineDataCenterVO zone) {
|
||||
Map<String, String> details = zone.getDetails();
|
||||
if (details == null) {
|
||||
return;
|
||||
@ -239,28 +239,28 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCenterVO> listDisabledZones(){
|
||||
SearchCriteria<DataCenterVO> sc = DisabledZonesSearch.create();
|
||||
public List<EngineDataCenterVO> listDisabledZones(){
|
||||
SearchCriteria<EngineDataCenterVO> sc = DisabledZonesSearch.create();
|
||||
sc.setParameters("allocationState", Grouping.AllocationState.Disabled);
|
||||
|
||||
List<DataCenterVO> dcs = listBy(sc);
|
||||
List<EngineDataCenterVO> dcs = listBy(sc);
|
||||
|
||||
return dcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataCenterVO> listEnabledZones(){
|
||||
SearchCriteria<DataCenterVO> sc = DisabledZonesSearch.create();
|
||||
public List<EngineDataCenterVO> listEnabledZones(){
|
||||
SearchCriteria<EngineDataCenterVO> sc = DisabledZonesSearch.create();
|
||||
sc.setParameters("allocationState", Grouping.AllocationState.Enabled);
|
||||
|
||||
List<DataCenterVO> dcs = listBy(sc);
|
||||
List<EngineDataCenterVO> dcs = listBy(sc);
|
||||
|
||||
return dcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataCenterVO findByTokenOrIdOrName(String tokenOrIdOrName) {
|
||||
DataCenterVO result = findByToken(tokenOrIdOrName);
|
||||
public EngineDataCenterVO findByTokenOrIdOrName(String tokenOrIdOrName) {
|
||||
EngineDataCenterVO result = findByToken(tokenOrIdOrName);
|
||||
if (result == null) {
|
||||
result = findByName(tokenOrIdOrName);
|
||||
if (result == null) {
|
||||
@ -279,7 +279,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
public boolean remove(Long id) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
DataCenterVO zone = createForUpdate();
|
||||
EngineDataCenterVO zone = createForUpdate();
|
||||
zone.setName(null);
|
||||
|
||||
update(id, zone);
|
||||
@ -293,11 +293,11 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
@Override
|
||||
public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity zoneEntity, Object data) {
|
||||
|
||||
DataCenterVO vo = findById(zoneEntity.getId());
|
||||
EngineDataCenterVO vo = findById(zoneEntity.getId());
|
||||
|
||||
Date oldUpdatedTime = vo.getLastUpdated();
|
||||
|
||||
SearchCriteria<DataCenterVO> sc = StateChangeSearch.create();
|
||||
SearchCriteria<EngineDataCenterVO> sc = StateChangeSearch.create();
|
||||
sc.setParameters("id", vo.getId());
|
||||
sc.setParameters("state", currentState);
|
||||
|
||||
@ -308,7 +308,7 @@ public class DataCenterDaoImpl extends GenericDaoBase<DataCenterVO, Long> implem
|
||||
int rows = update(vo, sc);
|
||||
|
||||
if (rows == 0 && s_logger.isDebugEnabled()) {
|
||||
DataCenterVO dbDC = findByIdIncludingRemoved(vo.getId());
|
||||
EngineDataCenterVO dbDC = findByIdIncludingRemoved(vo.getId());
|
||||
if (dbDC != null) {
|
||||
StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
|
||||
str.append(": DB Data={id=").append(dbDC.getId()).append("; state=").append(dbDC.getState()).append(";updatedTime=")
|
||||
@ -20,7 +20,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO;
|
||||
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Host.Type;
|
||||
@ -34,7 +34,7 @@ import com.cloud.utils.fsm.StateDao;
|
||||
* Data Access Object for server
|
||||
*
|
||||
*/
|
||||
public interface HostDao extends GenericDao<HostVO, Long>, StateDao<DataCenterResourceEntity.State, DataCenterResourceEntity.State.Event, DataCenterResourceEntity> {
|
||||
public interface EngineHostDao extends GenericDao<EngineHostVO, Long>, StateDao<DataCenterResourceEntity.State, DataCenterResourceEntity.State.Event, DataCenterResourceEntity> {
|
||||
long countBy(long clusterId, ResourceState... states);
|
||||
|
||||
/**
|
||||
@ -45,32 +45,32 @@ public interface HostDao extends GenericDao<HostVO, Long>, StateDao<DataCenterRe
|
||||
*/
|
||||
void markHostsAsDisconnected(long msId, long lastPing);
|
||||
|
||||
List<HostVO> findLostHosts(long timeout);
|
||||
List<EngineHostVO> findLostHosts(long timeout);
|
||||
|
||||
List<HostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId);
|
||||
List<EngineHostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId);
|
||||
|
||||
List<RunningHostCountInfo> getRunningHostCounts(Date cutTime);
|
||||
|
||||
long getNextSequence(long hostId);
|
||||
|
||||
void loadDetails(HostVO host);
|
||||
void loadDetails(EngineHostVO host);
|
||||
|
||||
void saveDetails(HostVO host);
|
||||
void saveDetails(EngineHostVO host);
|
||||
|
||||
void loadHostTags(HostVO host);
|
||||
void loadHostTags(EngineHostVO host);
|
||||
|
||||
List<HostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag);
|
||||
List<EngineHostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag);
|
||||
|
||||
long countRoutingHostsByDataCenter(long dcId);
|
||||
|
||||
List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId);
|
||||
List<EngineHostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId);
|
||||
|
||||
boolean updateResourceState(ResourceState oldState, ResourceState.Event event, ResourceState newState, Host vo);
|
||||
|
||||
HostVO findByGuid(String guid);
|
||||
EngineHostVO findByGuid(String guid);
|
||||
|
||||
HostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type);
|
||||
List<HostVO> findHypervisorHostInCluster(long clusterId);
|
||||
EngineHostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type);
|
||||
List<EngineHostVO> findHypervisorHostInCluster(long clusterId);
|
||||
|
||||
|
||||
/**
|
||||
@ -81,5 +81,5 @@ public interface HostDao extends GenericDao<HostVO, Long>, StateDao<DataCenterRe
|
||||
* @param haTag TODO
|
||||
* @return
|
||||
*/
|
||||
List<HostVO> listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag);
|
||||
List<EngineHostVO> listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag);
|
||||
}
|
||||
@ -31,7 +31,7 @@ import javax.persistence.TableGenerator;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -58,52 +58,52 @@ import com.cloud.utils.db.UpdateBuilder;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
@Component(value="EngineHostDao")
|
||||
@Local(value = { HostDao.class })
|
||||
@Local(value = { EngineHostDao.class })
|
||||
@DB(txn = false)
|
||||
@TableGenerator(name = "host_req_sq", table = "op_host", pkColumnName = "id", valueColumnName = "sequence", allocationSize = 1)
|
||||
public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao {
|
||||
private static final Logger s_logger = Logger.getLogger(HostDaoImpl.class);
|
||||
public class EngineHostDaoImpl extends GenericDaoBase<EngineHostVO, Long> implements EngineHostDao {
|
||||
private static final Logger s_logger = Logger.getLogger(EngineHostDaoImpl.class);
|
||||
private static final Logger status_logger = Logger.getLogger(Status.class);
|
||||
private static final Logger state_logger = Logger.getLogger(ResourceState.class);
|
||||
|
||||
protected final SearchBuilder<HostVO> TypePodDcStatusSearch;
|
||||
protected final SearchBuilder<EngineHostVO> TypePodDcStatusSearch;
|
||||
|
||||
protected final SearchBuilder<HostVO> IdStatusSearch;
|
||||
protected final SearchBuilder<HostVO> TypeDcSearch;
|
||||
protected final SearchBuilder<HostVO> TypeDcStatusSearch;
|
||||
protected final SearchBuilder<HostVO> TypeClusterStatusSearch;
|
||||
protected final SearchBuilder<HostVO> MsStatusSearch;
|
||||
protected final SearchBuilder<HostVO> DcPrivateIpAddressSearch;
|
||||
protected final SearchBuilder<HostVO> DcStorageIpAddressSearch;
|
||||
protected final SearchBuilder<EngineHostVO> IdStatusSearch;
|
||||
protected final SearchBuilder<EngineHostVO> TypeDcSearch;
|
||||
protected final SearchBuilder<EngineHostVO> TypeDcStatusSearch;
|
||||
protected final SearchBuilder<EngineHostVO> TypeClusterStatusSearch;
|
||||
protected final SearchBuilder<EngineHostVO> MsStatusSearch;
|
||||
protected final SearchBuilder<EngineHostVO> DcPrivateIpAddressSearch;
|
||||
protected final SearchBuilder<EngineHostVO> DcStorageIpAddressSearch;
|
||||
|
||||
protected final SearchBuilder<HostVO> GuidSearch;
|
||||
protected final SearchBuilder<HostVO> DcSearch;
|
||||
protected final SearchBuilder<HostVO> PodSearch;
|
||||
protected final SearchBuilder<HostVO> TypeSearch;
|
||||
protected final SearchBuilder<HostVO> StatusSearch;
|
||||
protected final SearchBuilder<HostVO> ResourceStateSearch;
|
||||
protected final SearchBuilder<HostVO> NameLikeSearch;
|
||||
protected final SearchBuilder<HostVO> NameSearch;
|
||||
protected final SearchBuilder<HostVO> SequenceSearch;
|
||||
protected final SearchBuilder<HostVO> DirectlyConnectedSearch;
|
||||
protected final SearchBuilder<HostVO> UnmanagedDirectConnectSearch;
|
||||
protected final SearchBuilder<HostVO> UnmanagedApplianceSearch;
|
||||
protected final SearchBuilder<HostVO> MaintenanceCountSearch;
|
||||
protected final SearchBuilder<HostVO> ClusterStatusSearch;
|
||||
protected final SearchBuilder<HostVO> TypeNameZoneSearch;
|
||||
protected final SearchBuilder<HostVO> AvailHypevisorInZone;
|
||||
protected final SearchBuilder<EngineHostVO> GuidSearch;
|
||||
protected final SearchBuilder<EngineHostVO> DcSearch;
|
||||
protected final SearchBuilder<EngineHostVO> PodSearch;
|
||||
protected final SearchBuilder<EngineHostVO> TypeSearch;
|
||||
protected final SearchBuilder<EngineHostVO> StatusSearch;
|
||||
protected final SearchBuilder<EngineHostVO> ResourceStateSearch;
|
||||
protected final SearchBuilder<EngineHostVO> NameLikeSearch;
|
||||
protected final SearchBuilder<EngineHostVO> NameSearch;
|
||||
protected final SearchBuilder<EngineHostVO> SequenceSearch;
|
||||
protected final SearchBuilder<EngineHostVO> DirectlyConnectedSearch;
|
||||
protected final SearchBuilder<EngineHostVO> UnmanagedDirectConnectSearch;
|
||||
protected final SearchBuilder<EngineHostVO> UnmanagedApplianceSearch;
|
||||
protected final SearchBuilder<EngineHostVO> MaintenanceCountSearch;
|
||||
protected final SearchBuilder<EngineHostVO> ClusterStatusSearch;
|
||||
protected final SearchBuilder<EngineHostVO> TypeNameZoneSearch;
|
||||
protected final SearchBuilder<EngineHostVO> AvailHypevisorInZone;
|
||||
|
||||
protected final SearchBuilder<HostVO> DirectConnectSearch;
|
||||
protected final SearchBuilder<HostVO> ManagedDirectConnectSearch;
|
||||
protected final SearchBuilder<HostVO> ManagedRoutingServersSearch;
|
||||
protected final SearchBuilder<HostVO> SecondaryStorageVMSearch;
|
||||
protected SearchBuilder<HostVO> StateChangeSearch;
|
||||
protected final SearchBuilder<EngineHostVO> DirectConnectSearch;
|
||||
protected final SearchBuilder<EngineHostVO> ManagedDirectConnectSearch;
|
||||
protected final SearchBuilder<EngineHostVO> ManagedRoutingServersSearch;
|
||||
protected final SearchBuilder<EngineHostVO> SecondaryStorageVMSearch;
|
||||
protected SearchBuilder<EngineHostVO> StateChangeSearch;
|
||||
|
||||
protected SearchBuilder<HostVO> UUIDSearch;
|
||||
protected SearchBuilder<EngineHostVO> UUIDSearch;
|
||||
|
||||
protected final GenericSearchBuilder<HostVO, Long> HostsInStatusSearch;
|
||||
protected final GenericSearchBuilder<HostVO, Long> CountRoutingByDc;
|
||||
protected final SearchBuilder<HostVO> RoutingSearch;
|
||||
protected final GenericSearchBuilder<EngineHostVO, Long> HostsInStatusSearch;
|
||||
protected final GenericSearchBuilder<EngineHostVO, Long> CountRoutingByDc;
|
||||
protected final SearchBuilder<EngineHostVO> RoutingSearch;
|
||||
|
||||
protected final Attribute _statusAttr;
|
||||
protected final Attribute _resourceStateAttr;
|
||||
@ -112,10 +112,10 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
@Inject protected HostDetailsDao _detailsDao;
|
||||
@Inject protected HostTagsDao _hostTagsDao;
|
||||
@Inject protected ClusterDao _clusterDao;
|
||||
@Inject protected EngineClusterDao _clusterDao;
|
||||
|
||||
|
||||
public HostDaoImpl() {
|
||||
public EngineHostDaoImpl() {
|
||||
|
||||
MaintenanceCountSearch = createSearchBuilder();
|
||||
MaintenanceCountSearch.and("cluster", MaintenanceCountSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
|
||||
@ -123,7 +123,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
MaintenanceCountSearch.done();
|
||||
|
||||
TypePodDcStatusSearch = createSearchBuilder();
|
||||
HostVO entity = TypePodDcStatusSearch.entity();
|
||||
EngineHostVO entity = TypePodDcStatusSearch.entity();
|
||||
TypePodDcStatusSearch.and("type", entity.getType(), SearchCriteria.Op.EQ);
|
||||
TypePodDcStatusSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ);
|
||||
TypePodDcStatusSearch.and("dc", entity.getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
@ -317,33 +317,33 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
@Override
|
||||
public long countBy(long clusterId, ResourceState... states) {
|
||||
SearchCriteria<HostVO> sc = MaintenanceCountSearch.create();
|
||||
SearchCriteria<EngineHostVO> sc = MaintenanceCountSearch.create();
|
||||
|
||||
sc.setParameters("resourceState", (Object[]) states);
|
||||
sc.setParameters("cluster", clusterId);
|
||||
|
||||
List<HostVO> hosts = listBy(sc);
|
||||
List<EngineHostVO> hosts = listBy(sc);
|
||||
return hosts.size();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HostVO findByGuid(String guid) {
|
||||
SearchCriteria<HostVO> sc = GuidSearch.create("guid", guid);
|
||||
public EngineHostVO findByGuid(String guid) {
|
||||
SearchCriteria<EngineHostVO> sc = GuidSearch.create("guid", guid);
|
||||
return findOneBy(sc);
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public List<HostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId) {
|
||||
public List<EngineHostVO> findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
SearchCriteria<HostVO> sc = UnmanagedDirectConnectSearch.create();
|
||||
SearchCriteria<EngineHostVO> sc = UnmanagedDirectConnectSearch.create();
|
||||
sc.setParameters("lastPinged", lastPingSecondsAfter);
|
||||
//sc.setParameters("resourceStates", ResourceState.ErrorInMaintenance, ResourceState.Maintenance, ResourceState.PrepareForMaintenance, ResourceState.Disabled);
|
||||
sc.setJoinParameters("ClusterManagedSearch", "managed", Managed.ManagedState.Managed);
|
||||
List<HostVO> hosts = lockRows(sc, new Filter(HostVO.class, "clusterId", true, 0L, limit), true);
|
||||
List<EngineHostVO> hosts = lockRows(sc, new Filter(EngineHostVO.class, "clusterId", true, 0L, limit), true);
|
||||
|
||||
for (HostVO host : hosts) {
|
||||
for (EngineHostVO host : hosts) {
|
||||
host.setManagementServerId(managementServerId);
|
||||
update(host.getId(), host);
|
||||
}
|
||||
@ -354,16 +354,16 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
}
|
||||
|
||||
@Override @DB
|
||||
public List<HostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId) {
|
||||
public List<EngineHostVO> findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
|
||||
txn.start();
|
||||
SearchCriteria<HostVO> sc = UnmanagedApplianceSearch.create();
|
||||
SearchCriteria<EngineHostVO> sc = UnmanagedApplianceSearch.create();
|
||||
sc.setParameters("lastPinged", lastPingSecondsAfter);
|
||||
sc.setParameters("types", Type.ExternalDhcp, Type.ExternalFirewall, Type.ExternalLoadBalancer, Type.PxeServer, Type.TrafficMonitor, Type.L2Networking);
|
||||
List<HostVO> hosts = lockRows(sc, null, true);
|
||||
List<EngineHostVO> hosts = lockRows(sc, null, true);
|
||||
|
||||
for (HostVO host : hosts) {
|
||||
for (EngineHostVO host : hosts) {
|
||||
host.setManagementServerId(managementServerId);
|
||||
update(host.getId(), host);
|
||||
}
|
||||
@ -375,10 +375,10 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
@Override
|
||||
public void markHostsAsDisconnected(long msId, long lastPing) {
|
||||
SearchCriteria<HostVO> sc = MsStatusSearch.create();
|
||||
SearchCriteria<EngineHostVO> sc = MsStatusSearch.create();
|
||||
sc.setParameters("ms", msId);
|
||||
|
||||
HostVO host = createForUpdate();
|
||||
EngineHostVO host = createForUpdate();
|
||||
host.setLastPinged(lastPing);
|
||||
host.setDisconnectedOn(new Date());
|
||||
UpdateBuilder ub = getUpdateBuilder(host);
|
||||
@ -398,14 +398,14 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag) {
|
||||
public List<EngineHostVO> listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag) {
|
||||
|
||||
SearchBuilder<HostTagVO> hostTagSearch = _hostTagsDao.createSearchBuilder();
|
||||
HostTagVO tagEntity = hostTagSearch.entity();
|
||||
hostTagSearch.and("tag", tagEntity.getTag(), SearchCriteria.Op.EQ);
|
||||
|
||||
SearchBuilder<HostVO> hostSearch = createSearchBuilder();
|
||||
HostVO entity = hostSearch.entity();
|
||||
SearchBuilder<EngineHostVO> hostSearch = createSearchBuilder();
|
||||
EngineHostVO entity = hostSearch.entity();
|
||||
hostSearch.and("type", entity.getType(), SearchCriteria.Op.EQ);
|
||||
hostSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ);
|
||||
hostSearch.and("dc", entity.getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
@ -414,7 +414,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
hostSearch.and("resourceState", entity.getResourceState(), SearchCriteria.Op.EQ);
|
||||
hostSearch.join("hostTagSearch", hostTagSearch, entity.getId(), tagEntity.getHostId(), JoinBuilder.JoinType.INNER);
|
||||
|
||||
SearchCriteria<HostVO> sc = hostSearch.create();
|
||||
SearchCriteria<EngineHostVO> sc = hostSearch.create();
|
||||
sc.setJoinParameters("hostTagSearch", "tag", hostTag);
|
||||
sc.setParameters("type", type.toString());
|
||||
if (podId != null) {
|
||||
@ -432,7 +432,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
|
||||
@Override
|
||||
public List<HostVO> listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag) {
|
||||
public List<EngineHostVO> listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag) {
|
||||
SearchBuilder<HostTagVO> hostTagSearch = null;
|
||||
if (haTag != null && !haTag.isEmpty()) {
|
||||
hostTagSearch = _hostTagsDao.createSearchBuilder();
|
||||
@ -441,7 +441,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
hostTagSearch.cp();
|
||||
}
|
||||
|
||||
SearchBuilder<HostVO> hostSearch = createSearchBuilder();
|
||||
SearchBuilder<EngineHostVO> hostSearch = createSearchBuilder();
|
||||
|
||||
hostSearch.and("type", hostSearch.entity().getType(), SearchCriteria.Op.EQ);
|
||||
hostSearch.and("clusterId", hostSearch.entity().getClusterId(), SearchCriteria.Op.EQ);
|
||||
@ -454,7 +454,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
hostSearch.join("hostTagSearch", hostTagSearch, hostSearch.entity().getId(), hostTagSearch.entity().getHostId(), JoinBuilder.JoinType.LEFTOUTER);
|
||||
}
|
||||
|
||||
SearchCriteria<HostVO> sc = hostSearch.create();
|
||||
SearchCriteria<EngineHostVO> sc = hostSearch.create();
|
||||
|
||||
if (haTag != null && !haTag.isEmpty()) {
|
||||
sc.setJoinParameters("hostTagSearch", "tag", haTag);
|
||||
@ -480,23 +480,23 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadDetails(HostVO host) {
|
||||
public void loadDetails(EngineHostVO host) {
|
||||
Map<String, String> details = _detailsDao.findDetails(host.getId());
|
||||
host.setDetails(details);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadHostTags(HostVO host) {
|
||||
public void loadHostTags(EngineHostVO host) {
|
||||
List<String> hostTags = _hostTagsDao.gethostTags(host.getId());
|
||||
host.setHostTags(hostTags);
|
||||
}
|
||||
|
||||
@DB
|
||||
@Override
|
||||
public List<HostVO> findLostHosts(long timeout) {
|
||||
public List<EngineHostVO> findLostHosts(long timeout) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
PreparedStatement pstmt = null;
|
||||
List<HostVO> result = new ArrayList<HostVO>();
|
||||
List<EngineHostVO> result = new ArrayList<EngineHostVO>();
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
String sql = "select h.id from host h left join cluster c on h.cluster_id=c.id where h.mgmt_server_id is not null and h.last_ping < ? and h.status in ('Up', 'Updating', 'Disconnected', 'Connecting') and h.type not in ('ExternalFirewall', 'ExternalLoadBalancer', 'TrafficMonitor', 'SecondaryStorage', 'LocalSecondaryStorage', 'L2Networking') and (h.cluster_id is null or c.managed_state = 'Managed') ;" ;
|
||||
@ -524,7 +524,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDetails(HostVO host) {
|
||||
public void saveDetails(EngineHostVO host) {
|
||||
Map<String, String> details = host.getDetails();
|
||||
if (details == null) {
|
||||
return;
|
||||
@ -532,7 +532,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
_detailsDao.persist(host.getId(), details);
|
||||
}
|
||||
|
||||
protected void saveHostTags(HostVO host) {
|
||||
protected void saveHostTags(EngineHostVO host) {
|
||||
List<String> hostTags = host.getHostTags();
|
||||
if (hostTags == null || (hostTags != null && hostTags.isEmpty())) {
|
||||
return;
|
||||
@ -542,13 +542,13 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public HostVO persist(HostVO host) {
|
||||
public EngineHostVO persist(EngineHostVO host) {
|
||||
final String InsertSequenceSql = "INSERT INTO op_host(id) VALUES(?)";
|
||||
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
HostVO dbHost = super.persist(host);
|
||||
EngineHostVO dbHost = super.persist(host);
|
||||
|
||||
try {
|
||||
PreparedStatement pstmt = txn.prepareAutoCloseStatement(InsertSequenceSql);
|
||||
@ -570,7 +570,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
@Override
|
||||
@DB
|
||||
public boolean update(Long hostId, HostVO host) {
|
||||
public boolean update(Long hostId, EngineHostVO host) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
|
||||
@ -646,10 +646,10 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
@Override
|
||||
public boolean updateState(State currentState, DataCenterResourceEntity.State.Event event, State nextState, DataCenterResourceEntity hostEntity, Object data) {
|
||||
HostVO vo = findById(hostEntity.getId());
|
||||
EngineHostVO vo = findById(hostEntity.getId());
|
||||
Date oldUpdatedTime = vo.getLastUpdated();
|
||||
|
||||
SearchCriteria<HostVO> sc = StateChangeSearch.create();
|
||||
SearchCriteria<EngineHostVO> sc = StateChangeSearch.create();
|
||||
sc.setParameters("id", hostEntity.getId());
|
||||
sc.setParameters("state", currentState);
|
||||
|
||||
@ -660,7 +660,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
int rows = update(vo, sc);
|
||||
|
||||
if (rows == 0 && s_logger.isDebugEnabled()) {
|
||||
HostVO dbHost = findByIdIncludingRemoved(vo.getId());
|
||||
EngineHostVO dbHost = findByIdIncludingRemoved(vo.getId());
|
||||
if (dbHost != null) {
|
||||
StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
|
||||
str.append(": DB Data={id=").append(dbHost.getId()).append("; state=").append(dbHost.getState()).append(";updatedTime=")
|
||||
@ -676,13 +676,13 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
@Override
|
||||
public boolean updateResourceState(ResourceState oldState, ResourceState.Event event, ResourceState newState, Host vo) {
|
||||
HostVO host = (HostVO)vo;
|
||||
SearchBuilder<HostVO> sb = createSearchBuilder();
|
||||
EngineHostVO host = (EngineHostVO)vo;
|
||||
SearchBuilder<EngineHostVO> sb = createSearchBuilder();
|
||||
sb.and("resource_state", sb.entity().getResourceState(), SearchCriteria.Op.EQ);
|
||||
sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ);
|
||||
sb.done();
|
||||
|
||||
SearchCriteria<HostVO> sc = sb.create();
|
||||
SearchCriteria<EngineHostVO> sc = sb.create();
|
||||
|
||||
sc.setParameters("resource_state", oldState);
|
||||
sc.setParameters("id", host.getId());
|
||||
@ -693,7 +693,7 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
assert result <= 1 : "How can this update " + result + " rows? ";
|
||||
|
||||
if (state_logger.isDebugEnabled() && result == 0) {
|
||||
HostVO ho = findById(host.getId());
|
||||
EngineHostVO ho = findById(host.getId());
|
||||
assert ho != null : "How how how? : " + host.getId();
|
||||
|
||||
StringBuilder str = new StringBuilder("Unable to update resource state: [");
|
||||
@ -717,8 +717,8 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type) {
|
||||
SearchCriteria<HostVO> sc = TypeNameZoneSearch.create();
|
||||
public EngineHostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type) {
|
||||
SearchCriteria<EngineHostVO> sc = TypeNameZoneSearch.create();
|
||||
sc.setParameters("type", type);
|
||||
sc.setParameters("name", name);
|
||||
sc.setParameters("zoneId", zoneId);
|
||||
@ -726,8 +726,8 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> findHypervisorHostInCluster(long clusterId) {
|
||||
SearchCriteria<HostVO> sc = TypeClusterStatusSearch.create();
|
||||
public List<EngineHostVO> findHypervisorHostInCluster(long clusterId) {
|
||||
SearchCriteria<EngineHostVO> sc = TypeClusterStatusSearch.create();
|
||||
sc.setParameters("type", Host.Type.Routing);
|
||||
sc.setParameters("cluster", clusterId);
|
||||
sc.setParameters("status", Status.Up);
|
||||
@ -737,16 +737,16 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> lockRows(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
|
||||
public List<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> lockRows(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> sc,
|
||||
Filter filter, boolean exclusive) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO lockOneRandomRow(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
|
||||
public org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO lockOneRandomRow(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> sc,
|
||||
boolean exclusive) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
@ -754,32 +754,32 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
|
||||
@Override
|
||||
public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> search(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
|
||||
public List<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> search(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> sc,
|
||||
Filter filter) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> search(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
|
||||
public List<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> search(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> sc,
|
||||
Filter filter, boolean enable_query_cache) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> searchIncludingRemoved(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO> sc,
|
||||
public List<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> searchIncludingRemoved(
|
||||
SearchCriteria<org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO> sc,
|
||||
Filter filter, Boolean lock, boolean cache) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostVO> searchIncludingRemoved(
|
||||
SearchCriteria<HostVO> sc,
|
||||
public List<EngineHostVO> searchIncludingRemoved(
|
||||
SearchCriteria<EngineHostVO> sc,
|
||||
Filter filter, Boolean lock, boolean cache,
|
||||
boolean enable_query_cache) {
|
||||
// TODO Auto-generated method stub
|
||||
@ -789,19 +789,19 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
|
||||
|
||||
@Override
|
||||
public int remove(
|
||||
SearchCriteria<HostVO> sc) {
|
||||
SearchCriteria<EngineHostVO> sc) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int expunge(SearchCriteria<HostVO> sc) {
|
||||
public int expunge(SearchCriteria<EngineHostVO> sc) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostVO findOneBy(SearchCriteria<HostVO> sc) {
|
||||
public EngineHostVO findOneBy(SearchCriteria<EngineHostVO> sc) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
@ -16,16 +16,16 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO;
|
||||
|
||||
|
||||
import com.cloud.utils.db.GenericDao;
|
||||
import com.cloud.utils.fsm.StateDao;
|
||||
|
||||
public interface HostPodDao extends GenericDao<HostPodVO, Long>, StateDao<DataCenterResourceEntity.State, DataCenterResourceEntity.State.Event, DataCenterResourceEntity> {
|
||||
public List<HostPodVO> listByDataCenterId(long id);
|
||||
public interface EngineHostPodDao extends GenericDao<EngineHostPodVO, Long>, StateDao<DataCenterResourceEntity.State, DataCenterResourceEntity.State.Event, DataCenterResourceEntity> {
|
||||
public List<EngineHostPodVO> listByDataCenterId(long id);
|
||||
|
||||
public HostPodVO findByName(String name, long dcId);
|
||||
public EngineHostPodVO findByName(String name, long dcId);
|
||||
|
||||
public HashMap<Long, List<Object>> getCurrentPodCidrSubnets(long zoneId, long podIdToSkip);
|
||||
|
||||
@ -25,7 +25,7 @@ import javax.ejb.Local;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -40,16 +40,16 @@ import com.cloud.utils.db.SearchCriteria.Op;
|
||||
import com.cloud.utils.db.Transaction;
|
||||
|
||||
@Component(value="EngineHostPodDao")
|
||||
@Local(value={HostPodDao.class})
|
||||
public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements HostPodDao {
|
||||
private static final Logger s_logger = Logger.getLogger(HostPodDaoImpl.class);
|
||||
@Local(value={EngineHostPodDao.class})
|
||||
public class EngineHostPodDaoImpl extends GenericDaoBase<EngineHostPodVO, Long> implements EngineHostPodDao {
|
||||
private static final Logger s_logger = Logger.getLogger(EngineHostPodDaoImpl.class);
|
||||
|
||||
protected SearchBuilder<HostPodVO> DataCenterAndNameSearch;
|
||||
protected SearchBuilder<HostPodVO> DataCenterIdSearch;
|
||||
protected SearchBuilder<HostPodVO> UUIDSearch;
|
||||
protected SearchBuilder<HostPodVO> StateChangeSearch;
|
||||
protected SearchBuilder<EngineHostPodVO> DataCenterAndNameSearch;
|
||||
protected SearchBuilder<EngineHostPodVO> DataCenterIdSearch;
|
||||
protected SearchBuilder<EngineHostPodVO> UUIDSearch;
|
||||
protected SearchBuilder<EngineHostPodVO> StateChangeSearch;
|
||||
|
||||
protected HostPodDaoImpl() {
|
||||
protected EngineHostPodDaoImpl() {
|
||||
DataCenterAndNameSearch = createSearchBuilder();
|
||||
DataCenterAndNameSearch.and("dc", DataCenterAndNameSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ);
|
||||
DataCenterAndNameSearch.and("name", DataCenterAndNameSearch.entity().getName(), SearchCriteria.Op.EQ);
|
||||
@ -72,16 +72,16 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HostPodVO> listByDataCenterId(long id) {
|
||||
SearchCriteria<HostPodVO> sc = DataCenterIdSearch.create();
|
||||
public List<EngineHostPodVO> listByDataCenterId(long id) {
|
||||
SearchCriteria<EngineHostPodVO> sc = DataCenterIdSearch.create();
|
||||
sc.setParameters("dcId", id);
|
||||
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HostPodVO findByName(String name, long dcId) {
|
||||
SearchCriteria<HostPodVO> sc = DataCenterAndNameSearch.create();
|
||||
public EngineHostPodVO findByName(String name, long dcId) {
|
||||
SearchCriteria<EngineHostPodVO> sc = DataCenterAndNameSearch.create();
|
||||
sc.setParameters("dc", dcId);
|
||||
sc.setParameters("name", name);
|
||||
|
||||
@ -121,7 +121,7 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
|
||||
public boolean remove(Long id) {
|
||||
Transaction txn = Transaction.currentTxn();
|
||||
txn.start();
|
||||
HostPodVO pod = createForUpdate();
|
||||
EngineHostPodVO pod = createForUpdate();
|
||||
pod.setName(null);
|
||||
|
||||
update(id, pod);
|
||||
@ -133,7 +133,7 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
|
||||
|
||||
@Override
|
||||
public List<Long> listDisabledPods(long zoneId) {
|
||||
GenericSearchBuilder<HostPodVO, Long> podIdSearch = createSearchBuilder(Long.class);
|
||||
GenericSearchBuilder<EngineHostPodVO, Long> podIdSearch = createSearchBuilder(Long.class);
|
||||
podIdSearch.selectField(podIdSearch.entity().getId());
|
||||
podIdSearch.and("dataCenterId", podIdSearch.entity().getDataCenterId(), Op.EQ);
|
||||
podIdSearch.and("allocationState", podIdSearch.entity().getAllocationState(), Op.EQ);
|
||||
@ -150,11 +150,11 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
|
||||
@Override
|
||||
public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity podEntity, Object data) {
|
||||
|
||||
HostPodVO vo = findById(podEntity.getId());
|
||||
EngineHostPodVO vo = findById(podEntity.getId());
|
||||
|
||||
Date oldUpdatedTime = vo.getLastUpdated();
|
||||
|
||||
SearchCriteria<HostPodVO> sc = StateChangeSearch.create();
|
||||
SearchCriteria<EngineHostPodVO> sc = StateChangeSearch.create();
|
||||
sc.setParameters("id", vo.getId());
|
||||
sc.setParameters("state", currentState);
|
||||
|
||||
@ -162,10 +162,10 @@ public class HostPodDaoImpl extends GenericDaoBase<HostPodVO, Long> implements H
|
||||
builder.set(vo, "state", nextState);
|
||||
builder.set(vo, "lastUpdated", new Date());
|
||||
|
||||
int rows = update((HostPodVO) vo, sc);
|
||||
int rows = update((EngineHostPodVO) vo, sc);
|
||||
|
||||
if (rows == 0 && s_logger.isDebugEnabled()) {
|
||||
HostPodVO dbDC = findByIdIncludingRemoved(vo.getId());
|
||||
EngineHostPodVO dbDC = findByIdIncludingRemoved(vo.getId());
|
||||
if (dbDC != null) {
|
||||
StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString());
|
||||
str.append(": DB Data={id=").append(dbDC.getId()).append("; state=").append(dbDC.getState()).append(";updatedTime=")
|
||||
@ -17,10 +17,10 @@
|
||||
package org.apache.cloudstack.engine.provisioning.test;
|
||||
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.ClusterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.DataCenterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.HostDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.HostPodDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineClusterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineDataCenterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
||||
@ -30,22 +30,22 @@ import org.springframework.context.annotation.Bean;
|
||||
public class ChildTestConfiguration {
|
||||
|
||||
@Bean
|
||||
public DataCenterDao dataCenterDao() {
|
||||
return Mockito.mock(DataCenterDao.class);
|
||||
public EngineDataCenterDao dataCenterDao() {
|
||||
return Mockito.mock(EngineDataCenterDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HostPodDao hostPodDao() {
|
||||
return Mockito.mock(HostPodDao.class);
|
||||
public EngineHostPodDao hostPodDao() {
|
||||
return Mockito.mock(EngineHostPodDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClusterDao clusterDao() {
|
||||
return Mockito.mock(ClusterDao.class);
|
||||
public EngineClusterDao clusterDao() {
|
||||
return Mockito.mock(EngineClusterDao.class);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HostDao hostDao() {
|
||||
return Mockito.mock(HostDao.class);
|
||||
public EngineHostDao hostDao() {
|
||||
return Mockito.mock(EngineHostDao.class);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,10 +31,10 @@ import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEnti
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.HostEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.ClusterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.DataCenterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.HostDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.HostPodDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineClusterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineDataCenterDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao;
|
||||
import org.apache.cloudstack.engine.service.api.ProvisioningService;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@ -43,10 +43,10 @@ import org.mockito.Mockito;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.ClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.DataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.HostVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO;
|
||||
import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO;
|
||||
|
||||
import com.cloud.dc.DataCenter.NetworkType;
|
||||
|
||||
@ -60,35 +60,35 @@ public class ProvisioningTest extends TestCase {
|
||||
ProvisioningService service;
|
||||
|
||||
@Inject
|
||||
DataCenterDao dcDao;
|
||||
EngineDataCenterDao dcDao;
|
||||
|
||||
@Inject
|
||||
HostPodDao _podDao;
|
||||
EngineHostPodDao _podDao;
|
||||
|
||||
@Inject
|
||||
ClusterDao _clusterDao;
|
||||
EngineClusterDao _clusterDao;
|
||||
|
||||
@Inject
|
||||
HostDao _hostDao;
|
||||
EngineHostDao _hostDao;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
DataCenterVO dc = new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24",
|
||||
EngineDataCenterVO dc = new EngineDataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24",
|
||||
null, null, NetworkType.Basic, null, null, true, true);
|
||||
Mockito.when(dcDao.findByUUID(Mockito.anyString())).thenReturn(dc);
|
||||
Mockito.when(dcDao.persist((DataCenterVO) Mockito.anyObject())).thenReturn(dc);
|
||||
Mockito.when(dcDao.findByUuid(Mockito.anyString())).thenReturn(dc);
|
||||
Mockito.when(dcDao.persist((EngineDataCenterVO) Mockito.anyObject())).thenReturn(dc);
|
||||
|
||||
HostPodVO pod = new HostPodVO("lab", 123, "10.0.0.1", "10.0.0.1", 24, "test");
|
||||
Mockito.when(_podDao.findByUUID(Mockito.anyString())).thenReturn(pod);
|
||||
Mockito.when(_podDao.persist((HostPodVO) Mockito.anyObject())).thenReturn(pod);
|
||||
EngineHostPodVO pod = new EngineHostPodVO("lab", 123, "10.0.0.1", "10.0.0.1", 24, "test");
|
||||
Mockito.when(_podDao.findByUuid(Mockito.anyString())).thenReturn(pod);
|
||||
Mockito.when(_podDao.persist((EngineHostPodVO) Mockito.anyObject())).thenReturn(pod);
|
||||
|
||||
ClusterVO cluster = new ClusterVO();
|
||||
Mockito.when(_clusterDao.findByUUID(Mockito.anyString())).thenReturn(cluster);
|
||||
Mockito.when(_clusterDao.persist((ClusterVO) Mockito.anyObject())).thenReturn(cluster);
|
||||
EngineClusterVO cluster = new EngineClusterVO();
|
||||
Mockito.when(_clusterDao.findByUuid(Mockito.anyString())).thenReturn(cluster);
|
||||
Mockito.when(_clusterDao.persist((EngineClusterVO) Mockito.anyObject())).thenReturn(cluster);
|
||||
|
||||
HostVO host = new HostVO("68765876598");
|
||||
Mockito.when(_hostDao.findByUUID(Mockito.anyString())).thenReturn(host);
|
||||
Mockito.when(_hostDao.persist((HostVO) Mockito.anyObject())).thenReturn(host);
|
||||
EngineHostVO host = new EngineHostVO("68765876598");
|
||||
Mockito.when(_hostDao.findByUuid(Mockito.anyString())).thenReturn(host);
|
||||
Mockito.when(_hostDao.persist((EngineHostVO) Mockito.anyObject())).thenReturn(host);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -354,7 +354,7 @@ public class BareMetalVmManagerImpl extends UserVmManagerImpl implements BareMet
|
||||
}
|
||||
|
||||
UserVmVO vm = new UserVmVO(id, instanceName, cmd.getDisplayName(), template.getId(), HypervisorType.BareMetal,
|
||||
template.getGuestOSId(), offering.getOfferHA(), false, domainId, owner.getId(), offering.getId(), userData, hostName);
|
||||
template.getGuestOSId(), offering.getOfferHA(), false, domainId, owner.getId(), offering.getId(), userData, hostName, null);
|
||||
|
||||
if (sshPublicKey != null) {
|
||||
vm.setDetail("SSH.PublicKey", sshPublicKey);
|
||||
|
||||
@ -33,7 +33,7 @@ public class UserVmDaoImplTest extends TestCase {
|
||||
|
||||
dao.expunge(1000l);
|
||||
|
||||
UserVmVO vo = new UserVmVO(1000l, "instancename", "displayname", 1, HypervisorType.XenServer, 1, true, true, 1, 1, 1, "userdata", "name");
|
||||
UserVmVO vo = new UserVmVO(1000l, "instancename", "displayname", 1, HypervisorType.XenServer, 1, true, true, 1, 1, 1, "userdata", "name", null);
|
||||
dao.persist(vo);
|
||||
|
||||
vo = dao.findById(1000l);
|
||||
|
||||
@ -23,6 +23,27 @@ alter table template_spool_ref add state varchar(255);
|
||||
alter table template_spool_ref add update_count bigint unsigned;
|
||||
alter table volumes add disk_type varchar(255);
|
||||
alter table volumes drop foreign key `fk_volumes__account_id`;
|
||||
alter table vm_instance add column disk_offering_id bigint unsigned;
|
||||
alter table data_center add column owner varchar(255);
|
||||
alter table data_center add column created datetime COMMENT 'date created';
|
||||
alter table data_center add column lastUpdated datetime COMMENT 'last updated';
|
||||
alter table data_center add column engine_state varchar(32) NOT NULL COMMENT 'the engine state of the zone';
|
||||
alter table host_pod_ref add column owner varchar(255);
|
||||
alter table host_pod_ref add column created datetime COMMENT 'date created';
|
||||
alter table host_pod_ref add column lastUpdated datetime COMMENT 'last updated';
|
||||
alter table host_pod_ref add column engine_state varchar(32) NOT NULL COMMENT 'the engine state of the zone';
|
||||
alter table host add column owner varchar(255);
|
||||
alter table host add column lastUpdated datetime COMMENT 'last updated';
|
||||
alter table host add column engine_state varchar(32) NOT NULL COMMENT 'the engine state of the zone';
|
||||
|
||||
|
||||
alter table cluster add column owner varchar(255);
|
||||
alter table cluster add column created datetime COMMENT 'date created';
|
||||
alter table cluster add column lastUpdated datetime COMMENT 'last updated';
|
||||
alter table cluster add column engine_state varchar(32) NOT NULL COMMENT 'the engine state of the zone';
|
||||
|
||||
alter table data_center add column removed datetime COMMENT 'date removed';
|
||||
|
||||
CREATE TABLE `cloud`.`data_store_provider` (
|
||||
`id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`name` varchar(255) NOT NULL COMMENT 'name of primary data store provider',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user