Skip to content

Commit 6912c7c

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
Fix cancel maintain and maintain
1 parent 2c61e76 commit 6912c7c

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,13 +352,19 @@ public boolean attachZone(DataStore dataStore, ZoneScope scope, Hypervisor.Hyper
352352

353353
@Override
354354
public boolean maintain(DataStore store) {
355-
_storagePoolAutomation.maintain(store);
355+
s_logger.info("Enable maintenance mode for datastore {}", store.getId());
356+
Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(store.getId());
357+
_storagePoolAutomation.maintain(store, details);
358+
s_logger.info("Enabled maintenance mode for datastore {}", store.getId());
356359
return _dataStoreHelper.maintain(store);
357360
}
358361

359362
@Override
360363
public boolean cancelMaintain(DataStore store) {
361-
_storagePoolAutomation.cancelMaintain(store);
364+
s_logger.info("Cancel maintenance mode for datastore {}", store.getId());
365+
Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(store.getId());
366+
_storagePoolAutomation.cancelMaintain(store, details);
367+
s_logger.info("Cancelled maintenance mode for datastore {}", store.getId());
362368
return _dataStoreHelper.cancelMaintain(store);
363369
}
364370

@@ -394,6 +400,7 @@ public boolean deleteDataStore(DataStore store) {
394400
// Create AccessGroup object with PrimaryDataStoreInfo
395401
AccessGroup accessGroup = new AccessGroup();
396402
accessGroup.setPrimaryDataStoreInfo(primaryDataStoreInfo);
403+
accessGroup.setScope(store.getScope());
397404

398405
// Call deleteAccessGroup - it will figure out scope, protocol, and all details internally
399406
storageStrategy.deleteAccessGroup(accessGroup);
@@ -403,6 +410,7 @@ public boolean deleteDataStore(DataStore store) {
403410
} catch (Exception e) {
404411
s_logger.error("deleteDataStore: Failed to delete access groups for storage pool id: {}. Error: {}",
405412
storagePoolId, e.getMessage(), e);
413+
// TODO need to ask the reason behind this ? This is keeping stale entries in storage_pool_details, storage_pool etc tables
406414
// Continue with CloudStack entity deletion even if ONTAP cleanup fails
407415
s_logger.warn("deleteDataStore: Proceeding with CloudStack entity deletion despite ONTAP cleanup failure");
408416
}

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/listener/OntapHostListener.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.cloud.alert.AlertManager;
2828
import com.cloud.storage.StoragePoolHostVO;
2929
import com.cloud.storage.dao.StoragePoolHostDao;
30+
import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
3031
import org.apache.logging.log4j.Logger;
3132
import org.apache.logging.log4j.LogManager;
3233
import com.cloud.agent.AgentManager;
@@ -52,6 +53,7 @@ public class OntapHostListener implements HypervisorHostListener {
5253
@Inject
5354
private HostDao _hostDao;
5455
@Inject private StoragePoolHostDao storagePoolHostDao;
56+
@Inject private StoragePoolDetailsDao storagePoolDetailsDao;
5557

5658

5759
@Override
@@ -74,7 +76,8 @@ public boolean hostConnect(long hostId, long poolId) {
7476
// Create the ModifyStoragePoolCommand to send to the agent
7577
// Note: Always send command even if database entry exists, because agent may have restarted
7678
// and lost in-memory pool registration. The command handler is idempotent.
77-
ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true, pool);
79+
java.util.Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(poolId);
80+
ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true, pool, details);
7881

7982
Answer answer = _agentMgr.easySend(hostId, cmd);
8083

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedNASStrategy.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ public AccessGroup createAccessGroup(AccessGroup accessGroup) {
143143

144144
@Override
145145
public void deleteAccessGroup(AccessGroup accessGroup) {
146+
// We need to delete the export policy
146147
//TODO
147148
}
148149

0 commit comments

Comments
 (0)