/** * get Matched Virtual Pools For Pool. This is called to calculate supported vpools during * unmanaged objects discovery * * @param poolUri * @return */ public static StringSet getMatchedVirtualPoolsForPool( DbClient dbClient, URI poolUri, String isThinlyProvisionedUnManagedObject) { StringSet vpoolUriSet = new StringSet(); // We should match all virtual pools as below: // 1) Virtual pools which have useMatchedPools set to true and have the storage pool in their // matched pools // 2) Virtual pools which have the storage pool in their assigned pools URIQueryResultList vpoolMatchedPoolsResultList = new URIQueryResultList(); dbClient.queryByConstraint( ContainmentConstraint.Factory.getMatchedPoolVirtualPoolConstraint(poolUri), vpoolMatchedPoolsResultList); List<VirtualPool> vPoolsMatchedPools = dbClient.queryObject(VirtualPool.class, vpoolMatchedPoolsResultList); String provisioningTypeUnManagedObject = UnManagedVolume.SupportedProvisioningType.getProvisioningType( isThinlyProvisionedUnManagedObject); StoragePool storagePool = dbClient.queryObject(StoragePool.class, poolUri); for (VirtualPool vPool : vPoolsMatchedPools) { if (!VirtualPool.vPoolSpecifiesHighAvailability(vPool)) { List<StoragePool> validPools = VirtualPool.getValidStoragePools(vPool, dbClient, true); for (StoragePool sPool : validPools) { if (sPool.getId().equals(storagePool.getId()) && provisioningTypeUnManagedObject.equalsIgnoreCase( vPool.getSupportedProvisioningType())) { vpoolUriSet.add(vPool.getId().toString()); break; } } } } return vpoolUriSet; }
/** * * Check if the request is for vplex. * * @param volume * @return */ private boolean isVplex(Volume volume) { boolean isVplex = false; VirtualPool vpool = dbClient.queryObject(VirtualPool.class, volume.getVirtualPool()); isVplex = VirtualPool.vPoolSpecifiesHighAvailability(vpool); return isVplex; }