mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
vmware: Datastore cluster synchronization should check if the child datastores are in UP state or not (#7385)
This fix ensures when datastore cluster in VMware is added as a primary storage pool in CloudStack then all the child datastores (which already exists in CS) should be in Up state. For example: 1. Datastore Cluster DS has two child datastores A and B in vCenter. (B is already added as a storage pool in CloudStack) 2. Now try to add datastore cluster DS into CloudStack as a primary storage pool 3. CloudStack tries to add child datastores A and B in CloudStack, since B is already there in CloudStack, it will reuse the existing storagepool entry and will keep under parent Storage pool DS. During Step 3 we are now checking if B is Up state or not.
This commit is contained in:
parent
4c9c1d2d7b
commit
b774ee5d11
@ -356,4 +356,6 @@ public interface StorageManager extends StorageService {
|
|||||||
|
|
||||||
void syncDatastoreClusterStoragePool(long datastoreClusterPoolId, List<ModifyStoragePoolAnswer> childDatastoreAnswerList, long hostId);
|
void syncDatastoreClusterStoragePool(long datastoreClusterPoolId, List<ModifyStoragePoolAnswer> childDatastoreAnswerList, long hostId);
|
||||||
|
|
||||||
|
void validateChildDatastoresToBeAddedInUpState(StoragePoolVO datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,6 +152,7 @@ public class DefaultHostListener implements HypervisorHostListener {
|
|||||||
updateStoragePoolHostVOAndDetails(poolVO, hostId, mspAnswer);
|
updateStoragePoolHostVOAndDetails(poolVO, hostId, mspAnswer);
|
||||||
|
|
||||||
if (pool.getPoolType() == Storage.StoragePoolType.DatastoreCluster) {
|
if (pool.getPoolType() == Storage.StoragePoolType.DatastoreCluster) {
|
||||||
|
storageManager.validateChildDatastoresToBeAddedInUpState(poolVO, mspAnswer.getDatastoreClusterChildren());
|
||||||
storageManager.syncDatastoreClusterStoragePool(poolId, ((ModifyStoragePoolAnswer) answer).getDatastoreClusterChildren(), hostId);
|
storageManager.syncDatastoreClusterStoragePool(poolId, ((ModifyStoragePoolAnswer) answer).getDatastoreClusterChildren(), hostId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1889,7 +1889,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||||||
return _storagePoolDao.findByUuid(uuid);
|
return _storagePoolDao.findByUuid(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateChildDatastoresToBeAddedInUpState(StoragePoolVO datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList) {
|
public void validateChildDatastoresToBeAddedInUpState(StoragePoolVO datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList) {
|
||||||
for (ModifyStoragePoolAnswer childDataStoreAnswer : childDatastoreAnswerList) {
|
for (ModifyStoragePoolAnswer childDataStoreAnswer : childDatastoreAnswerList) {
|
||||||
StoragePoolInfo childStoragePoolInfo = childDataStoreAnswer.getPoolInfo();
|
StoragePoolInfo childStoragePoolInfo = childDataStoreAnswer.getPoolInfo();
|
||||||
StoragePoolVO dataStoreVO = _storagePoolDao.findPoolByUUID(childStoragePoolInfo.getUuid());
|
StoragePoolVO dataStoreVO = _storagePoolDao.findPoolByUUID(childStoragePoolInfo.getUuid());
|
||||||
@ -1904,8 +1904,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dataStoreVO != null && !dataStoreVO.getStatus().equals(StoragePoolStatus.Up)) {
|
if (dataStoreVO != null && !dataStoreVO.getStatus().equals(StoragePoolStatus.Up)) {
|
||||||
String msg = String.format("Cannot synchronise datastore cluster %s because primary storage with id %s is not ready for syncing, " +
|
String msg = String.format("Cannot synchronise datastore cluster %s because primary storage with id %s is not in Up state, " +
|
||||||
"as the status is %s", datastoreClusterPool.getUuid(), dataStoreVO.getUuid(), dataStoreVO.getStatus().toString());
|
"current state is %s", datastoreClusterPool.getUuid(), dataStoreVO.getUuid(), dataStoreVO.getStatus().toString());
|
||||||
throw new CloudRuntimeException(msg);
|
throw new CloudRuntimeException(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user