|
23 | 23 |
|
24 | 24 | import javax.inject.Inject; |
25 | 25 |
|
26 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; |
27 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; |
28 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; |
29 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; |
30 | | -import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; |
31 | | -import org.apache.cloudstack.engine.subsystem.api.storage.Scope; |
| 26 | +import org.apache.cloudstack.engine.subsystem.api.storage.*; |
32 | 27 | import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
33 | 28 | import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; |
34 | 29 | import org.apache.log4j.Logger; |
@@ -137,6 +132,7 @@ public boolean maintain(DataStore store) { |
137 | 132 | //Handeling the Zone wide and cluster wide primay storage |
138 | 133 | List<HostVO> hosts = new ArrayList<HostVO>(); |
139 | 134 | // if the storage scope is ZONE wide, then get all the hosts for which hypervisor ZWSP created to send Modifystoragepoolcommand |
| 135 | + //TODO: if it's zone wide, this code will list a lot of hosts in the zone, which may cause performance/OOM issue. |
140 | 136 | if (pool.getScope().equals(ScopeType.ZONE)) { |
141 | 137 | hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(pool.getHypervisor() , pool.getDataCenterId()); |
142 | 138 | } else { |
@@ -366,8 +362,16 @@ public boolean cancelMaintain(DataStore store) { |
366 | 362 | .findById(store.getId()); |
367 | 363 | StoragePool pool = (StoragePool)store; |
368 | 364 |
|
369 | | - List<HostVO> hosts = _resourceMgr.listHostsInClusterByStatus( |
| 365 | + //Handeling the Zone wide and cluster wide primay storage |
| 366 | + List<HostVO> hosts = new ArrayList<HostVO>(); |
| 367 | + // if the storage scope is ZONE wide, then get all the hosts for which hypervisor ZWSP created to send Modifystoragepoolcommand |
| 368 | + if (poolVO.getScope().equals(ScopeType.ZONE)) { |
| 369 | + hosts = _resourceMgr.listAllUpAndEnabledHostsInOneZoneByHypervisor(poolVO.getHypervisor(), pool.getDataCenterId()); |
| 370 | + } else { |
| 371 | + hosts = _resourceMgr.listHostsInClusterByStatus( |
370 | 372 | pool.getClusterId(), Status.Up); |
| 373 | + } |
| 374 | + |
371 | 375 | if (hosts == null || hosts.size() == 0) { |
372 | 376 | return true; |
373 | 377 | } |
|
0 commit comments