mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Allocation logic to skip datastore cluster and consider only storagepools inside the datastore cluster
This commit is contained in:
parent
53fa3beecf
commit
b4a23ea5f6
@ -238,4 +238,6 @@ public interface StorageManager extends StorageService {
|
|||||||
|
|
||||||
DiskTO getDiskWithThrottling(DataTO volTO, Volume.Type volumeType, long deviceId, String path, long offeringId, long diskOfferingId);
|
DiskTO getDiskWithThrottling(DataTO volTO, Volume.Type volumeType, long deviceId, String path, long offeringId, long diskOfferingId);
|
||||||
|
|
||||||
|
boolean isStoragePoolDatastoreClusterParent(StoragePool pool);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -123,4 +123,6 @@ public interface PrimaryDataStoreDao extends GenericDao<StoragePoolVO, Long> {
|
|||||||
List<StoragePoolVO> listLocalStoragePoolByPath(long datacenterId, String path);
|
List<StoragePoolVO> listLocalStoragePoolByPath(long datacenterId, String path);
|
||||||
|
|
||||||
void deletePoolTags(long poolId);
|
void deletePoolTags(long poolId);
|
||||||
|
|
||||||
|
List<StoragePoolVO> listChildStoragePoolsInDatastoreCluster(long poolId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -552,4 +552,10 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
|
|||||||
public void deletePoolTags(long poolId) {
|
public void deletePoolTags(long poolId) {
|
||||||
_tagsDao.deleteTags(poolId);
|
_tagsDao.deleteTags(poolId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StoragePoolVO> listChildStoragePoolsInDatastoreCluster(long poolId) {
|
||||||
|
QueryBuilder<StoragePoolVO> sc = QueryBuilder.create(StoragePoolVO.class);
|
||||||
|
sc.and(sc.entity().getParent(), Op.EQ, poolId);
|
||||||
|
return sc.list(); }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,6 +119,9 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
@Enumerated(value = EnumType.STRING)
|
@Enumerated(value = EnumType.STRING)
|
||||||
private HypervisorType hypervisor;
|
private HypervisorType hypervisor;
|
||||||
|
|
||||||
|
@Column(name = "parent")
|
||||||
|
private Long parent;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getId() {
|
public long getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -373,6 +376,14 @@ public class StoragePoolVO implements StoragePool {
|
|||||||
return !isShared();
|
return !isShared();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getParent() {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParent(Long parent) {
|
||||||
|
this.parent = parent;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isInMaintenance() {
|
public boolean isInMaintenance() {
|
||||||
return status == StoragePoolStatus.PrepareForMaintenance || status == StoragePoolStatus.Maintenance || status == StoragePoolStatus.ErrorInMaintenance ||
|
return status == StoragePoolStatus.PrepareForMaintenance || status == StoragePoolStatus.Maintenance || status == StoragePoolStatus.ErrorInMaintenance ||
|
||||||
|
|||||||
@ -217,6 +217,11 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
|
|||||||
List<Volume> requestVolumes = new ArrayList<>();
|
List<Volume> requestVolumes = new ArrayList<>();
|
||||||
requestVolumes.add(volume);
|
requestVolumes.add(volume);
|
||||||
if (dskCh.getHypervisorType() == HypervisorType.VMware) {
|
if (dskCh.getHypervisorType() == HypervisorType.VMware) {
|
||||||
|
// Skip the parent datastore cluster, consider only child storage pools in it
|
||||||
|
if (pool.getPoolType() == Storage.StoragePoolType.DatastoreCluster && storageMgr.isStoragePoolDatastoreClusterParent(pool)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
boolean isStoragePoolStoragepolicyComplaince = storageMgr.isStoragePoolComplaintWithStoragePolicy(requestVolumes, pool);
|
boolean isStoragePoolStoragepolicyComplaince = storageMgr.isStoragePoolComplaintWithStoragePolicy(requestVolumes, pool);
|
||||||
if (!isStoragePoolStoragepolicyComplaince) {
|
if (!isStoragePoolStoragepolicyComplaince) {
|
||||||
|
|||||||
@ -2613,6 +2613,15 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||||||
return disk;
|
return disk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isStoragePoolDatastoreClusterParent(StoragePool pool) {
|
||||||
|
List<StoragePoolVO> childStoragePools = _storagePoolDao.listChildStoragePoolsInDatastoreCluster(pool.getId());
|
||||||
|
if (childStoragePools != null && !childStoragePools.isEmpty()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void setVolumeObjectTOThrottling(VolumeObjectTO volumeTO, final ServiceOffering offering, final DiskOffering diskOffering) {
|
private void setVolumeObjectTOThrottling(VolumeObjectTO volumeTO, final ServiceOffering offering, final DiskOffering diskOffering) {
|
||||||
volumeTO.setBytesReadRate(getDiskBytesReadRate(offering, diskOffering));
|
volumeTO.setBytesReadRate(getDiskBytesReadRate(offering, diskOffering));
|
||||||
volumeTO.setBytesWriteRate(getDiskBytesWriteRate(offering, diskOffering));
|
volumeTO.setBytesWriteRate(getDiskBytesWriteRate(offering, diskOffering));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user