@@ -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 }
0 commit comments