use of com.emc.storageos.vasa.data.internal.Volume.AssociatedPool in project coprhd-controller by CoprHD.
the class SOSAlarmManager method getThinlyProvisionedStatus.
public String getThinlyProvisionedStatus(SyncManager manager, Volume volume) throws StorageFault {
final String methodName = "getThinlyProvisioningStatus(): ";
log.debug(methodName + "Called with input:" + volume);
if (volume != null && volume.isThinlyProvisioned()) {
if (volume.getAllocatedCapacityInGB() >= volume.getRequestedCapacityInGB()) {
return AlarmStatusEnum.Green.getValue();
}
try {
if (volume.getHaVolumeList() != null && volume.getHaVolumeList().getHaVolumeList() != null) {
// This is a VPlex volume
return getThinlyProvisionStatusOfHAVolumes(manager, volume.getHaVolumeList().getHaVolumeList());
} else {
// This is a normal volume
AssociatedPool associatedPool = manager.fetchAssociatedPoolOfVolume(volume.getId());
StoragePool storagePool = manager.fetchStoragePoolByHref(associatedPool.getStoragepool().getLink().getHref());
return this.getThinlyProvisionStatusOfStoragePool(storagePool);
}
} catch (SOSFailure e) {
log.error(methodName + "SOSFailure failure occured", e);
throw FaultUtil.StorageFault(e);
}
}
return AlarmStatusEnum.Green.getValue();
}
use of com.emc.storageos.vasa.data.internal.Volume.AssociatedPool in project coprhd-controller by CoprHD.
the class SOSManager method queryDRSMigrationCapabilityForPerformance.
public synchronized boolean queryDRSMigrationCapabilityForPerformance(String srcUniqueId, String dstUniqueId, String entityType) throws InvalidArgument, NotFound, InvalidSession, StorageFault {
final String methodName = "queryDRSMigrationCapabilityForPerformance(): ";
log.debug(methodName + "Entry with input(s) srcUniqueId[" + srcUniqueId + "] dstUniqueId[" + dstUniqueId + "] entityType[" + entityType + "]");
try {
if (Util.isEmpty(entityType)) {
throw FaultUtil.InvalidArgument("Given entity type is invalid: [" + entityType + "]");
}
List<String> validEntityTypeList = new ArrayList<String>();
validEntityTypeList.add(EntityTypeEnum.StorageFileSystem.getValue());
validEntityTypeList.add(EntityTypeEnum.StorageLun.getValue());
if (validEntityTypeList.contains(entityType) == false) {
throw FaultUtil.InvalidArgument("Given entity type is invalid: [" + entityType + "]");
}
if (Util.isEmpty(srcUniqueId) || Util.isEmpty(dstUniqueId)) {
throw FaultUtil.InvalidArgument("Given identifiers are invalid");
}
Boolean supportsFile = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-file-profile"));
if (EntityTypeEnum.StorageFileSystem.getValue().equals(entityType)) {
if (!supportsFile) {
throw FaultUtil.InvalidArgument("Given entity type is invalid: [" + entityType + "]. It does not match with the supported array profile");
}
if (!srcUniqueId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX) || !dstUniqueId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given identifiers are invalid");
}
}
Boolean supportsBlock = new Boolean(_config.getConfigValue("config/service/storageTopology/storageArray/support-block-profile"));
if (EntityTypeEnum.StorageLun.getValue().equals(entityType)) {
if (!supportsBlock) {
throw FaultUtil.InvalidArgument("Given entity type is invalid: [" + entityType + "]. It does not match with the supported array profile");
}
if (!srcUniqueId.startsWith(VOLUME_IDENTIFIER_PREFIX) || !dstUniqueId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
throw FaultUtil.InvalidArgument("Given identifiers are invalid");
}
}
List<String> inputIdList = new ArrayList<String>();
inputIdList.add(srcUniqueId);
inputIdList.add(dstUniqueId);
if (EntityTypeEnum.StorageFileSystem.getValue().equals(entityType)) {
this.setFileSystemIds();
if (srcUniqueId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX) && dstUniqueId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
return false;
} else {
if (!_reportedFileSystemIdList.contains(srcUniqueId)) {
log.error(methodName + "Source Id does not exist for the entity type[" + entityType + "]");
throw FaultUtil.NotFound("Source Id does not exist for the entity type[" + entityType + "]");
}
if (!_reportedFileSystemIdList.contains(dstUniqueId)) {
log.error(methodName + "Destination Id does not exist for the entity type[" + entityType + "]");
throw FaultUtil.NotFound("Destination Id does not exist for the entity type[" + entityType + "]");
}
}
List<FileShare> fileShareList = _syncManager.getFileSystemDetailList(inputIdList);
FileShare fileShare1 = fileShareList.get(0);
FileShare fileShare2 = fileShareList.get(1);
if (fileShare1.getPool() != null && fileShare2.getPool() != null && fileShare1.getPool().getId() != null && fileShare2.getPool().getId() != null) {
if (fileShare1.getPool().getId().equals(fileShare2.getPool().getId())) {
return false;
} else {
return true;
}
}
}
if (EntityTypeEnum.StorageLun.getValue().equals(entityType)) {
this.setVolumeIds();
if (srcUniqueId.startsWith(FILESYSTEM_IDENTIFIER_PREFIX) && dstUniqueId.startsWith(VOLUME_IDENTIFIER_PREFIX)) {
return false;
} else {
if (!_reportedVolumeIdList.contains(srcUniqueId)) {
log.error(methodName + "Source Id does not exist for the entity type[" + entityType + "]");
throw FaultUtil.NotFound("Source Id does not exist for the entity type[" + entityType + "]");
}
if (!_reportedVolumeIdList.contains(dstUniqueId)) {
log.error(methodName + "Destination Id does not exist for the entity type[" + entityType + "]");
throw FaultUtil.NotFound("Destination Id does not exist for the entity type[" + entityType + "]");
}
}
// Check if src and dest are VPLEX volumes
List<Volume> volumeDetailList = _syncManager.getVolumeDetailList(inputIdList);
for (Volume volume : volumeDetailList) {
if (volume != null) {
HighAvailabilityVolumes haVolumes = volume.getHaVolumeList();
if (haVolumes != null && haVolumes.getHaVolumeList() != null) {
return false;
}
}
}
// Regular volumes
AssociatedPool associatedPoolForVolume1 = _syncManager.fetchAssociatedPoolOfVolume(srcUniqueId);
AssociatedPool associatedPoolForVolume2 = _syncManager.fetchAssociatedPoolOfVolume(dstUniqueId);
if (associatedPoolForVolume1 != null && associatedPoolForVolume2 != null) {
if (associatedPoolForVolume1.getStoragepool().getId().equals(associatedPoolForVolume2.getStoragepool().getId())) {
return false;
} else {
return true;
}
}
}
} catch (SOSFailure e) {
log.error("StorageOSFailure occured", e);
throw FaultUtil.StorageFault("StorageOSFailure occured", e);
} catch (InvalidArgument e) {
log.error(methodName + "InvalidArgument occured ", e);
throw e;
} catch (NotFound e) {
log.error(methodName + "NotFound occured ", e);
throw e;
}
return false;
}
use of com.emc.storageos.vasa.data.internal.Volume.AssociatedPool in project coprhd-controller by CoprHD.
the class SyncManager method fetchAssociatedPoolOfVolume.
public synchronized AssociatedPool fetchAssociatedPoolOfVolume(String volumeID) throws SOSFailure {
final String methodName = "fetchAssociatedPoolForVolume(): ";
log.trace(methodName + "Entry with volumeID[" + volumeID + "]");
final String ASSOCIATED_POOL_OF_VOLUME_URI = "/block/volumes/%s/storage-pool";
AssociatedPool associatedPool = null;
try {
associatedPool = _client.queryObject(String.format(ASSOCIATED_POOL_OF_VOLUME_URI, volumeID), Volume.AssociatedPool.class);
associatedPool = associatedPool.getStoragepool() == null ? null : associatedPool;
} catch (NoSuchAlgorithmException e) {
log.error(methodName + "NoSuchAlgorithmException occured", e);
throw new SOSFailure(e);
} catch (UniformInterfaceException e) {
log.error(methodName + "UniformInterfaceException occured", e);
throw new SOSFailure(e);
}
log.trace(methodName + "Exit returning associated storage pool[" + associatedPool + "]");
return associatedPool;
}
use of com.emc.storageos.vasa.data.internal.Volume.AssociatedPool in project coprhd-controller by CoprHD.
the class SOSAlarmManager method getThinlyProvisionStatusOfHAVolumes.
private String getThinlyProvisionStatusOfHAVolumes(SyncManager manager, List<HighAvailabilityVolume> haVolList) throws StorageFault {
final String methodName = "getThinlyProvisionStatusOfHAVolumes(): ";
log.debug(methodName + "Entry with input: haVolList" + haVolList);
String alarmStatus = null;
StoragePool storagePool = null;
Set<String> alarmSet = new HashSet<String>();
for (HighAvailabilityVolume haVol : haVolList) {
try {
AssociatedPool associatedPool = manager.fetchAssociatedPoolOfVolume(haVol.getId());
if (log.isTraceEnabled()) {
log.trace(methodName + haVol.getId() + " is associated with " + associatedPool);
}
storagePool = manager.fetchStoragePoolByHref(associatedPool.getStoragepool().getLink().getHref());
alarmStatus = this.getThinlyProvisionStatusOfStoragePool(storagePool);
alarmSet.add(alarmStatus);
} catch (SOSFailure e) {
log.error(methodName + "SOSFailure failure occured", e);
throw FaultUtil.StorageFault(e);
}
}
if (alarmSet.contains(AlarmStatusEnum.Red.getValue())) {
log.debug(methodName + "Exit returning [RED]");
return AlarmStatusEnum.Red.getValue();
}
if (alarmSet.contains(AlarmStatusEnum.Yellow.getValue())) {
log.debug(methodName + "Exit returning [YELLOW]");
return AlarmStatusEnum.Yellow.getValue();
}
log.debug(methodName + "Exit returning [GREEN]");
return AlarmStatusEnum.Green.getValue();
}
Aggregations