Skip to content

Commit 15ce0ae

Browse files
Datastore cluster synchronization should check if the child datastores are in UP state or not
1 parent 16694d8 commit 15ce0ae

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

engine/components-api/src/main/java/com/cloud/storage/StorageManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,4 +356,6 @@ static Boolean getFullCloneConfiguration(Long storeId) {
356356

357357
void syncDatastoreClusterStoragePool(long datastoreClusterPoolId, List<ModifyStoragePoolAnswer> childDatastoreAnswerList, long hostId);
358358

359+
void validateChildDatastoresToBeAddedInUpState(StoragePoolVO datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList);
360+
359361
}

engine/storage/volume/src/main/java/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ public boolean hostConnect(long hostId, long poolId) throws StorageConflictExcep
152152
updateStoragePoolHostVOAndDetails(poolVO, hostId, mspAnswer);
153153

154154
if (pool.getPoolType() == Storage.StoragePoolType.DatastoreCluster) {
155+
storageManager.validateChildDatastoresToBeAddedInUpState(poolVO, mspAnswer.getDatastoreClusterChildren());
155156
storageManager.syncDatastoreClusterStoragePool(poolId, ((ModifyStoragePoolAnswer) answer).getDatastoreClusterChildren(), hostId);
156157
}
157158

server/src/main/java/com/cloud/storage/StorageManagerImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1889,7 +1889,7 @@ private StoragePoolVO getExistingPoolByUuid(String uuid){
18891889
return _storagePoolDao.findByUuid(uuid);
18901890
}
18911891

1892-
private void validateChildDatastoresToBeAddedInUpState(StoragePoolVO datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList) {
1892+
public void validateChildDatastoresToBeAddedInUpState(StoragePoolVO datastoreClusterPool, List<ModifyStoragePoolAnswer> childDatastoreAnswerList) {
18931893
for (ModifyStoragePoolAnswer childDataStoreAnswer : childDatastoreAnswerList) {
18941894
StoragePoolInfo childStoragePoolInfo = childDataStoreAnswer.getPoolInfo();
18951895
StoragePoolVO dataStoreVO = _storagePoolDao.findPoolByUUID(childStoragePoolInfo.getUuid());
@@ -1904,8 +1904,8 @@ private void validateChildDatastoresToBeAddedInUpState(StoragePoolVO datastoreCl
19041904
}
19051905
}
19061906
if (dataStoreVO != null && !dataStoreVO.getStatus().equals(StoragePoolStatus.Up)) {
1907-
String msg = String.format("Cannot synchronise datastore cluster %s because primary storage with id %s is not ready for syncing, " +
1908-
"as the status is %s", datastoreClusterPool.getUuid(), dataStoreVO.getUuid(), dataStoreVO.getStatus().toString());
1907+
String msg = String.format("Cannot synchronise datastore cluster %s because primary storage with id %s is not in Up state, " +
1908+
"current state is %s", datastoreClusterPool.getUuid(), dataStoreVO.getUuid(), dataStoreVO.getStatus().toString());
19091909
throw new CloudRuntimeException(msg);
19101910
}
19111911
}

0 commit comments

Comments
 (0)