Search in sources :

Example 6 with VirtualPoolChangeOperationEnum

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;
}
Also used : VpoolRemoteCopyProtectionSettings(com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings) VirtualPoolChangeOperationEnum(com.emc.storageos.model.vpool.VirtualPoolChangeOperationEnum) ArrayList(java.util.ArrayList) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) Volume(com.emc.storageos.db.client.model.Volume) StringSet(com.emc.storageos.db.client.model.StringSet) Map(java.util.Map) OpStatusMap(com.emc.storageos.db.client.model.OpStatusMap) HashMap(java.util.HashMap)

Example 7 with VirtualPoolChangeOperationEnum

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;
}
Also used : VirtualPoolChangeList(com.emc.storageos.model.vpool.VirtualPoolChangeList) VirtualPoolChangeOperationEnum(com.emc.storageos.model.vpool.VirtualPoolChangeOperationEnum) VirtualPool(com.emc.storageos.db.client.model.VirtualPool)

Aggregations

VirtualPoolChangeOperationEnum (com.emc.storageos.model.vpool.VirtualPoolChangeOperationEnum)7 ArrayList (java.util.ArrayList)5 VirtualPool (com.emc.storageos.db.client.model.VirtualPool)4 URI (java.net.URI)4 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 StringSet (com.emc.storageos.db.client.model.StringSet)3 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)2 Volume (com.emc.storageos.db.client.model.Volume)2 VpoolRemoteCopyProtectionSettings (com.emc.storageos.db.client.model.VpoolRemoteCopyProtectionSettings)2 TaskList (com.emc.storageos.model.TaskList)2 VirtualPoolChangeList (com.emc.storageos.model.vpool.VirtualPoolChangeList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 BulkList (com.emc.storageos.api.service.impl.response.BulkList)1 SearchedResRepList (com.emc.storageos.api.service.impl.response.SearchedResRepList)1 VolumeDescriptor (com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 BlockObject (com.emc.storageos.db.client.model.BlockObject)1 BlockSnapshotSession (com.emc.storageos.db.client.model.BlockSnapshotSession)1 DataObject (com.emc.storageos.db.client.model.DataObject)1