use of com.emc.storageos.db.client.model.DiscoveredDataObject.Type in project coprhd-controller by CoprHD.
the class BlockServiceUtils method checkCGVolumeCanBeAddedOrRemoved.
/**
* For VMAX, creating/deleting volume in/from CG with existing group relationship is supported for SMI-S provider version 8.0.3 or
* higher
*
* Fox XtremIO creating/deleting volume in/from CG with existing CG is supported.
*
* For VNX, creating/deleting volume in/from CG with existing group relationship is supported if volume is not part of an array
* replication group
*
* For Application support, allow volumes to be added/removed to/from CG for VPLEX when the backend volume is VMAX/VNX/XtremIO
*
* @param cg BlockConsistencyGroup
* @param volume Volume part of the CG
* @dbClient DbClient
* @return true if the operation is supported.
*/
public static boolean checkCGVolumeCanBeAddedOrRemoved(BlockConsistencyGroup cg, Volume volume, DbClient dbClient) {
StorageSystem storage = dbClient.queryObject(StorageSystem.class, volume.getStorageController());
if (storage != null) {
if (storage.deviceIsType(Type.vmax)) {
if (storage.getUsingSmis80()) {
return true;
}
} else if (storage.deviceIsType(Type.vnxblock)) {
BlockConsistencyGroup consistencyGroup = cg;
if (consistencyGroup == null) {
consistencyGroup = dbClient.queryObject(BlockConsistencyGroup.class, volume.getConsistencyGroup());
}
if (consistencyGroup != null && !consistencyGroup.getInactive()) {
return !consistencyGroup.getArrayConsistency();
}
} else if (storage.deviceIsType(Type.xtremio)) {
return true;
} else if (storage.deviceIsType(Type.unity) && volume.checkForRp()) {
return true;
}
if (storage.deviceIsType(Type.vplex)) {
Set<Type> applicationSupported = Sets.newHashSet(Type.vmax, Type.vnxblock, Type.xtremio, Type.unity);
Set<Type> backendSystemTypes = new HashSet<>();
if (volume.getAssociatedVolumes() != null && !volume.getAssociatedVolumes().isEmpty()) {
for (String associatedVolumeId : volume.getAssociatedVolumes()) {
Volume associatedVolume = dbClient.queryObject(Volume.class, URI.create(associatedVolumeId));
if (associatedVolume != null) {
StorageSystem backendSystem = dbClient.queryObject(StorageSystem.class, associatedVolume.getStorageController());
if (backendSystem != null && !Strings.isNullOrEmpty(backendSystem.getSystemType())) {
backendSystemTypes.add(Type.valueOf(backendSystem.getSystemType()));
}
}
}
}
// when the backend volume is VMAX/VNX/XtremIO
if (volume.getApplication(dbClient) != null) {
// Returns true, if any backendSystemTypes are in the supported set for applications
return !Collections.disjoint(applicationSupported, backendSystemTypes);
} else if (!Volume.checkForRP(dbClient, volume.getId())) {
// Returns true, for VPLEX&VMAX scenarios
return backendSystemTypes.contains(Type.vmax);
}
}
}
return false;
}
Aggregations