use of com.emc.storageos.model.vpool.VirtualPoolChangeOperationEnum in project coprhd-controller by CoprHD.
the class SRDFBlockServiceApiImpl method getVirtualPoolChangeAllowedOperations.
/**
* {@inheritDoc}
*/
@Override
protected List<VirtualPoolChangeOperationEnum> getVirtualPoolChangeAllowedOperations(Volume volume, VirtualPool volumeVirtualPool, VirtualPool newVirtualPool, StringBuffer notSuppReasonBuff) {
List<VirtualPoolChangeOperationEnum> allowedOperations = new ArrayList<VirtualPoolChangeOperationEnum>();
if (VirtualPool.vPoolSpecifiesSRDF(newVirtualPool) && VirtualPoolChangeAnalyzer.isSupportedSRDFVolumeVirtualPoolChange(volume, volumeVirtualPool, newVirtualPool, _dbClient, notSuppReasonBuff)) {
allowedOperations.add(VirtualPoolChangeOperationEnum.SRDF_PROTECED);
}
// check if import into VPLEX is allowed.
StringBuffer vplexImportChangeReasonBuff = new StringBuffer();
if (VirtualPoolChangeAnalyzer.isVPlexImport(volume, volumeVirtualPool, newVirtualPool, vplexImportChangeReasonBuff)) {
// Analyze the remote copy protection settings of each to see if they are compatible
Map<URI, VpoolRemoteCopyProtectionSettings> volumeRemoteCopySettings = VirtualPool.getRemoteProtectionSettings(volumeVirtualPool, _dbClient);
Map<URI, VpoolRemoteCopyProtectionSettings> newRemoteCopySettings = VirtualPool.getRemoteProtectionSettings(newVirtualPool, _dbClient);
if (!volumeRemoteCopySettings.isEmpty() || !newRemoteCopySettings.isEmpty() && volumeRemoteCopySettings.size() == newRemoteCopySettings.size()) {
boolean compatible = true;
StringBuffer targetReasonBuff = new StringBuffer();
// For each existing remote copy protection settings
for (Map.Entry<URI, VpoolRemoteCopyProtectionSettings> entry : volumeRemoteCopySettings.entrySet()) {
// Fetch the equivalent one in new vpool, and check to see if it matches
VpoolRemoteCopyProtectionSettings newSettings = newRemoteCopySettings.get(entry.getKey());
if (newSettings == null || !entry.getValue().getVirtualArray().equals(newSettings.getVirtualArray())) {
compatible = false;
break;
}
if (entry.getValue().getVirtualPool().equals(newSettings.getVirtualPool())) {
// same virtual pool is compatible
continue;
}
// Check to see if virtual pools are such that target can be upgraded to vplex local
VirtualPool volumeCopyVpool = _dbClient.queryObject(VirtualPool.class, entry.getValue().getVirtualPool());
VirtualPool newCopyVpool = _dbClient.queryObject(VirtualPool.class, newSettings.getVirtualPool());
if (newCopyVpool.getHighAvailability() != null && newCopyVpool.getHighAvailability().equals(VirtualPool.HighAvailabilityType.vplex_local.name())) {
StringSet targetVolumes = volume.getSrdfTargets();
for (String targetVolumeId : targetVolumes) {
Volume targetVolume = _dbClient.queryObject(Volume.class, URI.create(targetVolumeId));
if (targetVolume.getVirtualArray().equals(entry.getKey())) {
// The new target Vpool can be import-able from the old if high availability is set
if (!VirtualPoolChangeAnalyzer.isVPlexImport(targetVolume, volumeCopyVpool, newCopyVpool, targetReasonBuff)) {
compatible = false;
break;
}
}
}
}
}
if (compatible) {
allowedOperations.add(VirtualPoolChangeOperationEnum.NON_VPLEX_TO_VPLEX);
} else {
notSuppReasonBuff.append("Incompatible VpoolRemoteCopyProtectionSettings: " + targetReasonBuff);
}
}
}
return allowedOperations;
}
use of com.emc.storageos.model.vpool.VirtualPoolChangeOperationEnum in project coprhd-controller by CoprHD.
the class AbstractBlockServiceApiImpl method getVirtualPoolChangeListForVolume.
/**
* Gets all potential vpools to to which the vpool for the passed volume can be
* changed.
*
* @param volume
* A reference to the volume.
*
* @return A VirtualPoolChangeList specifying each vpool to which the volume's
* vpool could potentially be changed and whether or not the change would
* be allowed for that vpool.
*/
protected VirtualPoolChangeList getVirtualPoolChangeListForVolume(Volume volume) {
// Get all potential vpools for this volume based on system
// connectivity of the volume's storage system. For each
// vpool determine if a vpool change to that vpool would be
// allowed for the volume.
VirtualPoolChangeList vpoolChangeList = new VirtualPoolChangeList();
VirtualPool currentVpool = _dbClient.queryObject(VirtualPool.class, volume.getVirtualPool());
Collection<VirtualPool> allVpools = getVPoolsForVolumeBasedOnSystemConnectivity(volume);
Iterator<VirtualPool> vpoolIter = allVpools.iterator();
StringBuffer logMsg = new StringBuffer();
logMsg.append("Analyzing vpools for change vpool operations:\n");
while (vpoolIter.hasNext()) {
StringBuffer notAllowedReason = new StringBuffer();
VirtualPool targetVpool = vpoolIter.next();
List<VirtualPoolChangeOperationEnum> allowedOperations = getVirtualPoolChangeAllowedOperationsForVolume(volume, currentVpool, targetVpool, notAllowedReason);
logMsg.append("\tVpool [" + targetVpool.getLabel() + "]");
logMsg.append((notAllowedReason.length() > 0) ? " not allowed: " + notAllowedReason.toString() : " allowed but only for: ");
logMsg.append((allowedOperations != null && !allowedOperations.isEmpty()) ? Joiner.on("\t").join(allowedOperations) : "");
logMsg.append("\n");
vpoolChangeList.getVirtualPools().add(toVirtualPoolChangeRep(targetVpool, allowedOperations, notAllowedReason.toString()));
}
s_logger.info(logMsg.toString());
return vpoolChangeList;
}
Aggregations