Search in sources :

Example 1 with PbmPlacementHub

use of com.vmware.pbm.PbmPlacementHub in project cloudstack by apache.

the class PbmPlacementSolverMO method isDatastoreCompatibleWithStorageProfile.

public boolean isDatastoreCompatibleWithStorageProfile(ManagedObjectReference dsMor, PbmProfile profile) throws Exception {
    boolean isDatastoreCompatibleWithStorageProfile = false;
    PbmPlacementHub placementHub = new PbmPlacementHub();
    placementHub.setHubId(dsMor.getValue());
    placementHub.setHubType(dsMor.getType());
    List<PbmPlacementHub> placementHubList = new ArrayList<PbmPlacementHub>();
    placementHubList.add(placementHub);
    PbmProfileId profileId = profile.getProfileId();
    List<PbmPlacementCompatibilityResult> placementCompatibilityResultList = _context.getPbmService().pbmCheckCompatibility(_mor, placementHubList, profileId);
    if (CollectionUtils.isNotEmpty(placementCompatibilityResultList)) {
        for (PbmPlacementCompatibilityResult placementResult : placementCompatibilityResultList) {
            // Check for error and warning
            if (CollectionUtils.isEmpty(placementResult.getError()) && CollectionUtils.isEmpty(placementResult.getWarning())) {
                isDatastoreCompatibleWithStorageProfile = true;
            }
        }
    }
    return isDatastoreCompatibleWithStorageProfile;
}
Also used : PbmProfileId(com.vmware.pbm.PbmProfileId) ArrayList(java.util.ArrayList) PbmPlacementCompatibilityResult(com.vmware.pbm.PbmPlacementCompatibilityResult) PbmPlacementHub(com.vmware.pbm.PbmPlacementHub)

Aggregations

PbmPlacementCompatibilityResult (com.vmware.pbm.PbmPlacementCompatibilityResult)1 PbmPlacementHub (com.vmware.pbm.PbmPlacementHub)1 PbmProfileId (com.vmware.pbm.PbmProfileId)1 ArrayList (java.util.ArrayList)1