This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch 4.18
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.18 by this push:
new b774ee5d117 vmware: Datastore cluster synchronization should check if
the child datastores are in UP state or not (#7385)
b774ee5d117 is described below
commit b774ee5d117ff3d0ffa2ea0e3973c733262b2617
Author: Harikrishna <[email protected]>
AuthorDate: Tue Apr 11 22:23:12 2023 +0530
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.
---
.../src/main/java/com/cloud/storage/StorageManager.java | 2 ++
.../cloudstack/storage/datastore/provider/DefaultHostListener.java | 1 +
server/src/main/java/com/cloud/storage/StorageManagerImpl.java | 6 +++---
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git
a/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java
b/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java
index 8437b56f2e0..28e7c89419a 100644
--- a/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java
+++ b/engine/components-api/src/main/java/com/cloud/storage/StorageManager.java
@@ -356,4 +356,6 @@ public interface StorageManager extends StorageService {
void syncDatastoreClusterStoragePool(long datastoreClusterPoolId,
List<ModifyStoragePoolAnswer> childDatastoreAnswerList, long hostId);
+ void validateChildDatastoresToBeAddedInUpState(StoragePoolVO
datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList);
+
}
diff --git
a/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java
b/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java
index c3d3cf5c65c..e344a87831d 100644
---
a/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java
+++
b/engine/storage/volume/src/main/java/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java
@@ -152,6 +152,7 @@ public class DefaultHostListener implements
HypervisorHostListener {
updateStoragePoolHostVOAndDetails(poolVO, hostId, mspAnswer);
if (pool.getPoolType() == Storage.StoragePoolType.DatastoreCluster) {
+ storageManager.validateChildDatastoresToBeAddedInUpState(poolVO,
mspAnswer.getDatastoreClusterChildren());
storageManager.syncDatastoreClusterStoragePool(poolId,
((ModifyStoragePoolAnswer) answer).getDatastoreClusterChildren(), hostId);
}
diff --git a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
index 93a805a9afd..c1d17cc8f70 100644
--- a/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/main/java/com/cloud/storage/StorageManagerImpl.java
@@ -1889,7 +1889,7 @@ public class StorageManagerImpl extends ManagerBase
implements StorageManager, C
return _storagePoolDao.findByUuid(uuid);
}
- private void validateChildDatastoresToBeAddedInUpState(StoragePoolVO
datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList) {
+ public void validateChildDatastoresToBeAddedInUpState(StoragePoolVO
datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList) {
for (ModifyStoragePoolAnswer childDataStoreAnswer :
childDatastoreAnswerList) {
StoragePoolInfo childStoragePoolInfo =
childDataStoreAnswer.getPoolInfo();
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)) {
- String msg = String.format("Cannot synchronise datastore
cluster %s because primary storage with id %s is not ready for syncing, " +
- "as the status is %s", datastoreClusterPool.getUuid(),
dataStoreVO.getUuid(), dataStoreVO.getStatus().toString());
+ String msg = String.format("Cannot synchronise datastore
cluster %s because primary storage with id %s is not in Up state, " +
+ "current state is %s", datastoreClusterPool.getUuid(),
dataStoreVO.getUuid(), dataStoreVO.getStatus().toString());
throw new CloudRuntimeException(msg);
}
}