mirror of https://github.com/apache/cloudstack.git
filter hosts to query on zone wide storage (#3733)
This commit is contained in:
parent
90ce1d8c39
commit
3ac03c8858
|
|
@ -40,6 +40,7 @@ import java.util.stream.Stream;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.storage.ScopeType;
|
||||
import org.apache.cloudstack.acl.ControlledEntity.ACLType;
|
||||
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
|
||||
import org.apache.cloudstack.affinity.AffinityGroupService;
|
||||
|
|
@ -1942,14 +1943,23 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager, Vir
|
|||
@Override
|
||||
public HashMap<String, VolumeStatsEntry> getVolumeStatistics(long clusterId, String poolUuid, StoragePoolType poolType, List<String> volumeLocators, int timeout) {
|
||||
List<HostVO> neighbors = _resourceMgr.listHostsInClusterByStatus(clusterId, Status.Up);
|
||||
StoragePool storagePool = _storagePoolDao.findPoolByUUID(poolUuid);
|
||||
StoragePoolVO storagePool = _storagePoolDao.findPoolByUUID(poolUuid);
|
||||
for (HostVO neighbor : neighbors) {
|
||||
if (storagePool.isManaged()) {
|
||||
// apply filters:
|
||||
// - managed storage
|
||||
// - local storage
|
||||
if (storagePool.isManaged() || storagePool.isLocal()) {
|
||||
|
||||
volumeLocators = getVolumesByHost(neighbor, storagePool);
|
||||
|
||||
}
|
||||
|
||||
// - zone wide storage for specific hypervisortypes
|
||||
if (ScopeType.ZONE.equals(storagePool.getScope()) && storagePool.getHypervisor() != neighbor.getHypervisorType()) {
|
||||
// skip this neighbour if their hypervisor type is not the same as that of the store
|
||||
continue;
|
||||
}
|
||||
|
||||
GetVolumeStatsCommand cmd = new GetVolumeStatsCommand(poolType, poolUuid, volumeLocators);
|
||||
|
||||
if (timeout > 0) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue