Search in sources :

Example 1 with StoragePoolDetailsDao

use of org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao in project cloudstack by apache.

the class SolidFireIntegrationTestManagerImpl method getSolidFireVolumeAccessGroupIds.

@Override
public long[] getSolidFireVolumeAccessGroupIds(String csClusterUuid, String storagePoolUuid) {
    long storagePoolId = util.getStoragePoolIdForStoragePoolUuid(storagePoolUuid);
    SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePoolId, storagePoolDetailsDao);
    List<SolidFireUtil.SolidFireVag> sfVags = SolidFireUtil.getAllVags(sfConnection);
    long csClusterId = util.getClusterIdForClusterUuid(csClusterUuid);
    List<HostVO> hosts = hostDao.findByClusterId(csClusterId);
    if (hosts == null) {
        return new long[0];
    }
    List<Long> vagIds = new ArrayList<>(hosts.size());
    for (HostVO host : hosts) {
        String iqn = host.getStorageUrl();
        SolidFireUtil.SolidFireVag sfVag = SolidFireUtil.getVolumeAccessGroup(iqn, sfVags);
        if (sfVag != null) {
            if (!vagIds.contains(sfVag.getId())) {
                vagIds.add(sfVag.getId());
            }
        }
    }
    return vagIds.stream().mapToLong(l -> l).toArray();
}
Also used : HostDao(com.cloud.host.dao.HostDao) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) StoragePoolDetailsDao(org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao) Component(org.springframework.stereotype.Component) List(java.util.List) VolumeDetailVO(com.cloud.storage.VolumeDetailVO) SolidFireUtil(org.apache.cloudstack.storage.datastore.util.SolidFireUtil) VolumeDao(com.cloud.storage.dao.VolumeDao) AccountDetailsDao(com.cloud.user.AccountDetailsDao) SolidFireIntegrationTestUtil(org.apache.cloudstack.util.solidfire.SolidFireIntegrationTestUtil) VolumeDetailsDao(com.cloud.storage.dao.VolumeDetailsDao) VolumeVO(com.cloud.storage.VolumeVO) HostVO(com.cloud.host.HostVO) AccountDetailVO(com.cloud.user.AccountDetailVO) ArrayList(java.util.ArrayList) HostVO(com.cloud.host.HostVO) SolidFireUtil(org.apache.cloudstack.storage.datastore.util.SolidFireUtil)

Aggregations

HostVO (com.cloud.host.HostVO)1 HostDao (com.cloud.host.dao.HostDao)1 VolumeDetailVO (com.cloud.storage.VolumeDetailVO)1 VolumeVO (com.cloud.storage.VolumeVO)1 VolumeDao (com.cloud.storage.dao.VolumeDao)1 VolumeDetailsDao (com.cloud.storage.dao.VolumeDetailsDao)1 AccountDetailVO (com.cloud.user.AccountDetailVO)1 AccountDetailsDao (com.cloud.user.AccountDetailsDao)1 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Inject (javax.inject.Inject)1 StoragePoolDetailsDao (org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao)1 SolidFireUtil (org.apache.cloudstack.storage.datastore.util.SolidFireUtil)1 SolidFireIntegrationTestUtil (org.apache.cloudstack.util.solidfire.SolidFireIntegrationTestUtil)1 Component (org.springframework.stereotype.Component)1