mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-2029 zone wide primary storage support for cloudstack over vmware deployments
DB changes to support hypervisor specific zone wide storage pool. Added method findZoneWideStoragePoolsByHypervisor to PrimaryStorageDaoImpl to find suitable zone wide storage pool of specific hypervisor type. Added column 'hypervisor' to table storage_pool. This column can be NULL. Used/populated only for zone wide primary storage pools. Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>
This commit is contained in:
parent
2705f01651
commit
e7d468e221
@ -22,6 +22,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
||||||
|
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
/**
|
/**
|
||||||
@ -109,4 +110,6 @@ public interface PrimaryDataStoreDao extends GenericDao<StoragePoolVO, Long> {
|
|||||||
Long clusterId, String[] tags);
|
Long clusterId, String[] tags);
|
||||||
|
|
||||||
List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags);
|
List<StoragePoolVO> findZoneWideStoragePoolsByTags(long dcId, String[] tags);
|
||||||
|
|
||||||
|
List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import com.cloud.host.Status;
|
import com.cloud.host.Status;
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
|
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
|
|
||||||
@ -427,4 +428,14 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
|
|||||||
|
|
||||||
return listBy(sc);
|
return listBy(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StoragePoolVO> findZoneWideStoragePoolsByHypervisor(long dataCenterId, HypervisorType hypervisorType) {
|
||||||
|
SearchCriteriaService<StoragePoolVO, StoragePoolVO> sc = SearchCriteria2.create(StoragePoolVO.class);
|
||||||
|
sc.addAnd(sc.getEntity().getDataCenterId(), Op.EQ, dataCenterId);
|
||||||
|
sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up);
|
||||||
|
sc.addAnd(sc.getEntity().getScope(), Op.EQ, ScopeType.ZONE);
|
||||||
|
sc.addAnd(sc.getEntity().getHypervisor(), Op.EQ, hypervisorType);
|
||||||
|
return sc.list();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,6 +31,7 @@ import javax.persistence.TemporalType;
|
|||||||
|
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
||||||
|
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.StoragePool;
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
@ -102,6 +103,10 @@ public class StoragePoolVO implements StoragePool{
|
|||||||
@Enumerated(value = EnumType.STRING)
|
@Enumerated(value = EnumType.STRING)
|
||||||
private ScopeType scope;
|
private ScopeType scope;
|
||||||
|
|
||||||
|
@Column(name = "hypervisor")
|
||||||
|
@Enumerated(value = EnumType.STRING)
|
||||||
|
private HypervisorType hypervisor;
|
||||||
|
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@ -276,6 +281,14 @@ public class StoragePoolVO implements StoragePool{
|
|||||||
return this.scope;
|
return this.scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HypervisorType getHypervisor() {
|
||||||
|
return hypervisor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHypervisor(HypervisorType hypervisor) {
|
||||||
|
this.hypervisor = hypervisor;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (!(obj instanceof StoragePoolVO) || obj == null) {
|
if (!(obj instanceof StoragePoolVO) || obj == null) {
|
||||||
|
|||||||
@ -85,6 +85,9 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Lo
|
|||||||
poolResponse.setPodName(pool.getPodName());
|
poolResponse.setPodName(pool.getPodName());
|
||||||
poolResponse.setCreated(pool.getCreated());
|
poolResponse.setCreated(pool.getCreated());
|
||||||
poolResponse.setScope(pool.getScope().toString());
|
poolResponse.setScope(pool.getScope().toString());
|
||||||
|
if (pool.getHypervisor() != null) {
|
||||||
|
poolResponse.setHypervisor(pool.getHypervisor().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity();
|
long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity();
|
||||||
@ -143,6 +146,9 @@ public class StoragePoolJoinDaoImpl extends GenericDaoBase<StoragePoolJoinVO, Lo
|
|||||||
poolResponse.setPodName(pool.getPodName());
|
poolResponse.setPodName(pool.getPodName());
|
||||||
poolResponse.setCreated(pool.getCreated());
|
poolResponse.setCreated(pool.getCreated());
|
||||||
poolResponse.setScope(pool.getScope().toString());
|
poolResponse.setScope(pool.getScope().toString());
|
||||||
|
if (pool.getHypervisor() != null) {
|
||||||
|
poolResponse.setHypervisor(pool.getHypervisor().toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity();
|
long allocatedSize = pool.getUsedCapacity() + pool.getReservedCapacity();
|
||||||
|
|||||||
@ -24,15 +24,17 @@ import javax.persistence.EnumType;
|
|||||||
import javax.persistence.Enumerated;
|
import javax.persistence.Enumerated;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
import com.cloud.org.Cluster;
|
|
||||||
import com.cloud.storage.StoragePoolStatus;
|
|
||||||
import com.cloud.storage.Storage.StoragePoolType;
|
|
||||||
import com.cloud.utils.db.GenericDao;
|
|
||||||
|
|
||||||
import org.apache.cloudstack.api.Identity;
|
import org.apache.cloudstack.api.Identity;
|
||||||
import org.apache.cloudstack.api.InternalIdentity;
|
import org.apache.cloudstack.api.InternalIdentity;
|
||||||
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType;
|
||||||
|
|
||||||
|
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||||
|
import com.cloud.org.Cluster;
|
||||||
|
import com.cloud.storage.Storage.StoragePoolType;
|
||||||
|
import com.cloud.storage.StoragePoolStatus;
|
||||||
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Storage Pool DB view.
|
* Storage Pool DB view.
|
||||||
*
|
*
|
||||||
@ -99,7 +101,7 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||||||
|
|
||||||
@Column(name="data_center_type")
|
@Column(name="data_center_type")
|
||||||
private String zoneType;
|
private String zoneType;
|
||||||
|
|
||||||
@Column(name="pod_id")
|
@Column(name="pod_id")
|
||||||
private long podId;
|
private long podId;
|
||||||
|
|
||||||
@ -128,11 +130,16 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||||||
|
|
||||||
@Column(name="job_status")
|
@Column(name="job_status")
|
||||||
private int jobStatus;
|
private int jobStatus;
|
||||||
|
|
||||||
@Column(name = "scope")
|
@Column(name = "scope")
|
||||||
@Enumerated(value = EnumType.STRING)
|
@Enumerated(value = EnumType.STRING)
|
||||||
private ScopeType scope;
|
private ScopeType scope;
|
||||||
|
|
||||||
|
|
||||||
|
@Column(name = "hypervisor")
|
||||||
|
@Enumerated(value = EnumType.STRING)
|
||||||
|
private HypervisorType hypervisor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the scope
|
* @return the scope
|
||||||
*/
|
*/
|
||||||
@ -147,6 +154,14 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HypervisorType getHypervisor() {
|
||||||
|
return hypervisor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHypervisor(HypervisorType hypervisor) {
|
||||||
|
this.hypervisor = hypervisor;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -293,7 +308,7 @@ public class StoragePoolJoinVO extends BaseViewVO implements InternalIdentity, I
|
|||||||
public void setZoneType(String zoneType) {
|
public void setZoneType(String zoneType) {
|
||||||
this.zoneType = zoneType;
|
this.zoneType = zoneType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getPodId() {
|
public long getPodId() {
|
||||||
return podId;
|
return podId;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user