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;
}
Aggregations