Search in sources :

Example 26 with VplexMirror

use of com.emc.storageos.db.client.model.VplexMirror in project coprhd-controller by CoprHD.

the class VplexDBCkr method addDescriptorsForVplexMirrors.

public void addDescriptorsForVplexMirrors(List<VolumeDescriptor> descriptors, Volume vplexVolume) {
    if (vplexVolume.getMirrors() != null && vplexVolume.getMirrors().isEmpty() == false) {
        for (String mirrorId : vplexVolume.getMirrors()) {
            VplexMirror mirror = dbClient.queryObject(VplexMirror.class, URI.create(mirrorId));
            if (mirror != null && !mirror.getInactive()) {
                if (null != mirror.getAssociatedVolumes()) {
                    for (String assocVolumeId : mirror.getAssociatedVolumes()) {
                        Volume volume = dbClient.queryObject(Volume.class, URI.create(assocVolumeId));
                        if (volume != null && !volume.getInactive()) {
                            VolumeDescriptor volDesc = new VolumeDescriptor(VolumeDescriptor.Type.BLOCK_DATA, volume.getStorageController(), URI.create(assocVolumeId), null, null);
                            descriptors.add(volDesc);
                        }
                    }
                }
            }
        }
    }
}
Also used : VolumeDescriptor(com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor) Volume(com.emc.storageos.db.client.model.Volume) VplexMirror(com.emc.storageos.db.client.model.VplexMirror)

Example 27 with VplexMirror

use of com.emc.storageos.db.client.model.VplexMirror in project coprhd-controller by CoprHD.

the class VPlexBlockServiceApiImpl method stopNativeContinuousCopies.

/**
 * {@inheritDoc}
 */
@Override
public TaskList stopNativeContinuousCopies(StorageSystem vplexStorageSystem, Volume sourceVolume, List<URI> mirrors, String taskId) throws ControllerException {
    TaskList taskList = new TaskList();
    List<VplexMirror> vplexMirrors = null;
    if (mirrors != null) {
        vplexMirrors = new ArrayList<VplexMirror>();
        for (URI mirrorURI : mirrors) {
            VplexMirror vplexMirror = _dbClient.queryObject(VplexMirror.class, mirrorURI);
            if (vplexMirror.getDeviceLabel() == null) {
                s_logger.error("This Vplex Mirror {} was not created successfully.", vplexMirror.getId());
                throw APIException.badRequests.invalidVplexMirror(vplexMirror.getLabel(), vplexMirror.getId().toString());
            }
            vplexMirrors.add(vplexMirror);
        }
    }
    // If mirrors is null then this will return all mirrors for the source volume.
    // This will be mostly case through python script that will just make a call
    // to stop mirrors without specifying mirror ID.
    // Note : There will be only one mirror for the vplex volume though
    List<URI> copiesToStop = getVplexCopiesToStop(vplexMirrors, sourceVolume);
    // Removes inactive mirrors
    removeIf(copiesToStop, isVplexMirrorInactivePredicate());
    String mirrorTargetCommaDelimList = Joiner.on(',').join(copiesToStop);
    Operation op = _dbClient.createTaskOpStatus(Volume.class, sourceVolume.getId(), taskId, ResourceOperationTypeEnum.DETACH_VPLEX_LOCAL_MIRROR, mirrorTargetCommaDelimList);
    List<VplexMirror> copies = _dbClient.queryObject(VplexMirror.class, copiesToStop);
    // Stopped copies will be promoted to vplex volumes.
    // Creates volume objects for the mirrors that will be promoted
    List<URI> promotees = preparePromotedVolumes(copies, taskList, taskId);
    // Add task to the task list
    taskList.getTaskList().add(toTask(sourceVolume, copies, taskId, op));
    try {
        VPlexController controller = getController();
        controller.detachContinuousCopies(vplexStorageSystem.getId(), sourceVolume.getId(), copiesToStop, promotees, taskId);
    } catch (InternalException e) {
        String errorMsg = format("Failed to stop continuous copies for volume %s: %s", sourceVolume.getId(), e.getMessage());
        for (TaskResourceRep taskResourceRep : taskList.getTaskList()) {
            taskResourceRep.setState(Operation.Status.error.name());
            taskResourceRep.setMessage(errorMsg);
            _dbClient.error(Volume.class, taskResourceRep.getResource().getId(), taskId, e);
        }
        throw e;
    }
    return taskList;
}
Also used : VPlexController(com.emc.storageos.vplexcontroller.VPlexController) Volume(com.emc.storageos.db.client.model.Volume) TaskList(com.emc.storageos.model.TaskList) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) Operation(com.emc.storageos.db.client.model.Operation) VplexMirror(com.emc.storageos.db.client.model.VplexMirror) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_VPLEX_MIRROR_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException)

Example 28 with VplexMirror

use of com.emc.storageos.db.client.model.VplexMirror in project coprhd-controller by CoprHD.

the class VPlexBlockServiceApiImpl method startNativeContinuousCopies.

/**
 * {@inheritDoc}
 */
@Override
public TaskList startNativeContinuousCopies(StorageSystem vplexStorageSystem, Volume vplexVolume, VirtualPool sourceVirtualPool, VirtualPoolCapabilityValuesWrapper capabilities, NativeContinuousCopyCreate param, String taskId) throws ControllerException {
    // using the target volume of a block snapshot.
    if (VPlexUtil.isVolumeBuiltOnBlockSnapshot(_dbClient, vplexVolume)) {
        throw APIException.badRequests.mirrorNotAllowedVolumeIsExposedSnapshot(vplexVolume.getId().toString());
    }
    validateNotAConsistencyGroupVolume(vplexVolume, sourceVirtualPool);
    TaskList taskList = new TaskList();
    // Currently, For Vplex Local Volume this will create a single mirror and add it
    // to the vplex volume. For Vplex Distributed Volume this will create single mirror
    // on source and/or HA side and add it to the vplex volume. Two steps: first place
    // the mirror and then prepare the mirror.
    URI vplexStorageSystemURI = vplexVolume.getStorageController();
    // For VPLEX Local volume there will be only one associated volume entry in this set.
    StringSet associatedVolumeIds = vplexVolume.getAssociatedVolumes();
    if (associatedVolumeIds == null) {
        throw InternalServerErrorException.internalServerErrors.noAssociatedVolumesForVPLEXVolume(vplexVolume.forDisplay());
    }
    VirtualPool sourceMirrorVPool = null;
    // Set source mirror vpool
    if (!isNullOrEmpty(sourceVirtualPool.getMirrorVirtualPool()) && !NullColumnValueGetter.isNullURI(URI.create(sourceVirtualPool.getMirrorVirtualPool()))) {
        sourceMirrorVPool = _dbClient.queryObject(VirtualPool.class, URI.create(sourceVirtualPool.getMirrorVirtualPool()));
    }
    // Check if volume is distributed and if HA Mirror Vpool is also set
    VirtualPool haMirrorVPool = VPlexUtil.getHAMirrorVpool(sourceVirtualPool, associatedVolumeIds, _dbClient);
    // Map of backend volume and the mirror pool to target backend volume for the mirror
    Map<Volume, VirtualPool> backendVolumeToMirrorVpoolMap = new HashMap<Volume, VirtualPool>();
    if (associatedVolumeIds.size() > 1) {
        // If associatedVolumeIds size is greater than 1 then its a VPLEX Distributed Volume
        updateBackendVolumeToMirrorVpoolMap(vplexVolume, associatedVolumeIds, sourceVirtualPool, sourceMirrorVPool, haMirrorVPool, backendVolumeToMirrorVpoolMap);
    } else {
        // If we are here that means we need to create mirror for the VPLEX local volume
        for (String associatedVolumeId : associatedVolumeIds) {
            Volume associatedVolume = _dbClient.queryObject(Volume.class, URI.create(associatedVolumeId));
            if (associatedVolume != null) {
                backendVolumeToMirrorVpoolMap.put(associatedVolume, sourceMirrorVPool);
            }
        }
    }
    // Project is not passed in continuous copies call.
    // Implicit assumption to use same project as the source volume.
    Project project = _permissionsHelper.getObjectById(vplexVolume.getProject(), Project.class);
    Map<Volume, List<Recommendation>> backendvolumeToMirrorRecommendationMap = new HashMap<Volume, List<Recommendation>>();
    Map<Volume, VirtualArray> backendvolumeToMirrorVarrayMap = new HashMap<Volume, VirtualArray>();
    for (Volume backendVolume : backendVolumeToMirrorVpoolMap.keySet()) {
        URI backendVolumeVarrayURI = backendVolume.getVirtualArray();
        // Get the VPLEX cluster value from the varray
        String cluster = ConnectivityUtil.getVplexClusterForVarray(backendVolumeVarrayURI, vplexStorageSystemURI, _dbClient);
        if (cluster.equals(ConnectivityUtil.CLUSTER_UNKNOWN)) {
            throw InternalServerErrorException.internalServerErrors.noVplexClusterInfoForVarray(backendVolumeVarrayURI.toString(), vplexStorageSystemURI.toString());
        }
        VirtualPool backendVolumeVpool = _dbClient.queryObject(VirtualPool.class, backendVolume.getVirtualPool());
        VirtualPool mirrorVpool = backendVolumeToMirrorVpoolMap.get(backendVolume);
        // Get recommendations for the mirror placement
        List<Recommendation> volumeRecommendations = null;
        VirtualArray varray = null;
        if (mirrorVpool != null) {
            // If mirror vpool is provided try to get recommendations using the provided mirror vpool
            // Check if any of the varray for mirror vpool is same as that of the source volume varray.
            // If yes then get recommendations using that varray.
            StringSet mirrorVPoolVarrays = mirrorVpool.getVirtualArrays();
            boolean foundMatch = false;
            for (String mirrorVPoolVarrayId : mirrorVPoolVarrays) {
                if (mirrorVPoolVarrayId.equals(backendVolumeVarrayURI.toString())) {
                    varray = _dbClient.queryObject(VirtualArray.class, backendVolumeVarrayURI);
                    volumeRecommendations = _scheduler.getRecommendationsForMirrors(varray, project, backendVolumeVpool, mirrorVpool, capabilities, vplexStorageSystemURI, backendVolume.getStorageController(), cluster);
                    foundMatch = true;
                    break;
                }
            }
            if (!foundMatch) {
                s_logger.info("Mirror Vpool varray is different than the source vpool varray");
                // with the source volume VPLEX system.
                for (String mirrorVPoolVarrayId : mirrorVPoolVarrays) {
                    if (VPlexUtil.checkIfVarrayContainsSpecifiedVplexSystem(mirrorVPoolVarrayId, cluster, vplexStorageSystemURI, _dbClient)) {
                        varray = _dbClient.queryObject(VirtualArray.class, URI.create(mirrorVPoolVarrayId));
                        volumeRecommendations = _scheduler.getRecommendationsForMirrors(varray, project, backendVolumeVpool, mirrorVpool, capabilities, vplexStorageSystemURI, backendVolume.getStorageController(), cluster);
                        if (!volumeRecommendations.isEmpty()) {
                            foundMatch = true;
                            break;
                        } else {
                            s_logger.info("Tried to get recommemdations using varray {} {}. ", varray.getId(), varray.getLabel());
                        }
                    }
                }
            }
        } else {
            if (sourceVirtualPool.getHighAvailability().equals(VirtualPool.HighAvailabilityType.vplex_local.name())) {
                s_logger.info("Mirror vpool is not specified, use the source volume virtual pool and virtual array");
                // In case of Vplex local if mirror pool is not provided then we can use source vpool as mirror vpool.
                sourceMirrorVPool = backendVolumeVpool;
                mirrorVpool = backendVolumeVpool;
                backendVolumeToMirrorVpoolMap.put(backendVolume, sourceMirrorVPool);
                // Separate Mirror vpool is not provided so use the source volume vpool and varray for
                // getting recommendations.Here sourceVirtualPool and mirrorVPool will be same.
                varray = _dbClient.queryObject(VirtualArray.class, backendVolumeVarrayURI);
                volumeRecommendations = _scheduler.getRecommendationsForMirrors(varray, project, backendVolumeVpool, mirrorVpool, capabilities, vplexStorageSystemURI, backendVolume.getStorageController(), cluster);
            }
        }
        if (mirrorVpool == null) {
            throw APIException.badRequests.noMirrorVpoolForVplexVolume(vplexVolume.getLabel());
        }
        if (varray == null) {
            throw APIException.badRequests.noVarrayForMirrorVpoolWithExpectedVplex(mirrorVpool.getLabel(), vplexStorageSystem.getLabel(), cluster);
        }
        if (volumeRecommendations == null || volumeRecommendations.isEmpty()) {
            if (volumeRecommendations.isEmpty()) {
                StorageSystem storageSystem = _dbClient.queryObject(StorageSystem.class, backendVolume.getStorageController());
                throw APIException.badRequests.noMatchingStoragePoolsForContinuousCopiesVpoolForVplex(varray.getLabel(), sourceMirrorVPool.getLabel(), storageSystem.getLabel());
            }
        }
        // Add mirror recommendations for the backend volume to the map
        backendvolumeToMirrorRecommendationMap.put(backendVolume, volumeRecommendations);
        backendvolumeToMirrorVarrayMap.put(backendVolume, varray);
    }
    // Prepare mirror.
    int varrayCount = 0;
    int volumeCounter = 1;
    // volumeCount will be always 1 for now
    int volumeCount = capabilities.getResourceCount();
    String volumeLabel = param.getName();
    List<URI> allVolumes = new ArrayList<URI>();
    List<URI> allMirrors = new ArrayList<URI>();
    List<VolumeDescriptor> descriptors = new ArrayList<VolumeDescriptor>();
    // Currently only one local mirror is supported for the VPLEX local virtual volume
    List<VplexMirror> preparedMirrors = new ArrayList<VplexMirror>();
    for (Volume backendVolume : backendvolumeToMirrorRecommendationMap.keySet()) {
        List<Recommendation> volumeRecommendations = backendvolumeToMirrorRecommendationMap.get(backendVolume);
        VirtualArray varray = backendvolumeToMirrorVarrayMap.get(backendVolume);
        VirtualPool mirrorVpool = backendVolumeToMirrorVpoolMap.get(backendVolume);
        long thinVolumePreAllocationSize = 0;
        if (null != mirrorVpool.getThinVolumePreAllocationPercentage()) {
            thinVolumePreAllocationSize = VirtualPoolUtil.getThinVolumePreAllocationSize(mirrorVpool.getThinVolumePreAllocationPercentage(), vplexVolume.getCapacity());
        }
        for (Recommendation volumeRecommendation : volumeRecommendations) {
            VPlexRecommendation vplexRecommendation = (VPlexRecommendation) volumeRecommendation;
            StringBuilder mirrorLabelBuilder = new StringBuilder(volumeLabel);
            if (backendVolume.getVirtualArray().equals(vplexVolume.getVirtualArray())) {
                varrayCount = 0;
            } else {
                varrayCount = 1;
            }
            mirrorLabelBuilder.append('-').append(varrayCount);
            if (volumeCount > 1) {
                mirrorLabelBuilder.append('-').append(volumeCounter++);
            }
            // Create mirror object
            VplexMirror createdMirror = initializeMirror(vplexVolume, mirrorVpool, varray, mirrorLabelBuilder.toString(), thinVolumePreAllocationSize, _dbClient);
            preparedMirrors.add(createdMirror);
            Operation op = _dbClient.createTaskOpStatus(VplexMirror.class, createdMirror.getId(), taskId, ResourceOperationTypeEnum.ATTACH_VPLEX_LOCAL_MIRROR);
            s_logger.info("Prepared mirror {}", createdMirror.getId());
            allMirrors.add(createdMirror.getId());
            // Add descriptor for the mirror.
            VolumeDescriptor descriptor = new VolumeDescriptor(VolumeDescriptor.Type.VPLEX_LOCAL_MIRROR, vplexStorageSystemURI, createdMirror.getId(), null, capabilities);
            descriptors.add(descriptor);
            // Create backend volume object and add it to the VplexMirror created above.
            Volume volume = prepareVolume(createdMirror, backendVolume, mirrorVpool, varray, vplexRecommendation.getSourceStorageSystem(), vplexRecommendation.getSourceStoragePool(), mirrorLabelBuilder.toString(), thinVolumePreAllocationSize, capabilities, _dbClient);
            op = new Operation();
            op.setResourceType(ResourceOperationTypeEnum.CREATE_BLOCK_VOLUME);
            _dbClient.createTaskOpStatus(Volume.class, volume.getId(), taskId, op);
            URI volumeId = volume.getId();
            allVolumes.add(volumeId);
            s_logger.info("Prepared volume {}", volumeId);
            // Add descriptor for the backend volume
            descriptor = new VolumeDescriptor(VolumeDescriptor.Type.BLOCK_DATA, vplexRecommendation.getSourceStorageSystem(), volumeId, vplexRecommendation.getSourceStoragePool(), capabilities);
            descriptors.add(descriptor);
        }
    }
    Collection<URI> mirrorTargetIds = Collections2.transform(preparedMirrors, FCTN_VPLEX_MIRROR_TO_URI);
    String mirrorTargetCommaDelimList = Joiner.on(',').join(mirrorTargetIds);
    Operation op = _dbClient.createTaskOpStatus(Volume.class, vplexVolume.getId(), taskId, ResourceOperationTypeEnum.ATTACH_VPLEX_LOCAL_MIRROR, mirrorTargetCommaDelimList);
    taskList.getTaskList().add(toTask(vplexVolume, preparedMirrors, taskId, op));
    try {
        VPlexController controller = getController();
        controller.attachContinuousCopies(vplexStorageSystem.getId(), descriptors, vplexVolume.getId(), taskId);
    } catch (InternalException e) {
        if (s_logger.isErrorEnabled()) {
            s_logger.error("Controller error", e);
        }
        String errMsg = String.format("Controller error: %s", e.getMessage());
        for (URI volumeURI : allVolumes) {
            _dbClient.error(Volume.class, volumeURI, taskId, e);
        }
        for (URI mirrorURI : allMirrors) {
            _dbClient.error(VplexMirror.class, mirrorURI, taskId, e);
        }
        for (TaskResourceRep volumeTask : taskList.getTaskList()) {
            volumeTask.setState(Operation.Status.error.name());
            volumeTask.setMessage(errMsg);
        }
        throw e;
    }
    return taskList;
}
Also used : VirtualArray(com.emc.storageos.db.client.model.VirtualArray) VPlexController(com.emc.storageos.vplexcontroller.VPlexController) HashMap(java.util.HashMap) TaskList(com.emc.storageos.model.TaskList) ArrayList(java.util.ArrayList) Operation(com.emc.storageos.db.client.model.Operation) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_VPLEX_MIRROR_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI) StringSet(com.emc.storageos.db.client.model.StringSet) ApplicationAddVolumeList(com.emc.storageos.volumecontroller.ApplicationAddVolumeList) ArrayList(java.util.ArrayList) TaskList(com.emc.storageos.model.TaskList) VolumeGroupVolumeList(com.emc.storageos.model.application.VolumeGroupUpdateParam.VolumeGroupVolumeList) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) StorageSystemConnectivityList(com.emc.storageos.model.systems.StorageSystemConnectivityList) List(java.util.List) VplexMirror(com.emc.storageos.db.client.model.VplexMirror) StorageSystem(com.emc.storageos.db.client.model.StorageSystem) VolumeDescriptor(com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) TaskResourceRep(com.emc.storageos.model.TaskResourceRep) VirtualPool(com.emc.storageos.db.client.model.VirtualPool) SRDFCopyRecommendation(com.emc.storageos.volumecontroller.SRDFCopyRecommendation) VolumeRecommendation(com.emc.storageos.api.service.impl.placement.VolumeRecommendation) VPlexRecommendation(com.emc.storageos.volumecontroller.VPlexRecommendation) Recommendation(com.emc.storageos.volumecontroller.Recommendation) SRDFRecommendation(com.emc.storageos.volumecontroller.SRDFRecommendation) PrefixConstraint(com.emc.storageos.db.client.constraint.PrefixConstraint) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentPrefixConstraint(com.emc.storageos.db.client.constraint.ContainmentPrefixConstraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) InternalException(com.emc.storageos.svcs.errorhandling.resources.InternalException) Project(com.emc.storageos.db.client.model.Project) Volume(com.emc.storageos.db.client.model.Volume)

Example 29 with VplexMirror

use of com.emc.storageos.db.client.model.VplexMirror in project coprhd-controller by CoprHD.

the class VPlexBlockServiceApiImpl method cleanupForViPROnlyMirrorDelete.

/**
 * {@inheritDoc}
 */
@Override
protected void cleanupForViPROnlyMirrorDelete(List<URI> mirrorURIs) {
    // We need to mark the associated volume inactive.
    List<Volume> associatedVolumes = new ArrayList<Volume>();
    for (URI mirrorURI : mirrorURIs) {
        VplexMirror mirror = _dbClient.queryObject(VplexMirror.class, mirrorURI);
        if (mirror.getAssociatedVolumes() != null) {
            for (String assocVolumeId : mirror.getAssociatedVolumes()) {
                URI assocVolumeURI = URI.create(assocVolumeId);
                // Get the associated volume and add it to the list of associated
                // volumes to be marked inactive.
                Volume assocVolume = _dbClient.queryObject(Volume.class, assocVolumeURI);
                associatedVolumes.add(assocVolume);
                // Remove the associated volume form any export groups/masks.
                ExportUtils.cleanBlockObjectFromExports(assocVolumeURI, true, _dbClient);
            }
        }
    }
    // Now mark all the associated volumes for deletion.
    _dbClient.markForDeletion(associatedVolumes);
}
Also used : Volume(com.emc.storageos.db.client.model.Volume) ArrayList(java.util.ArrayList) FCTN_STRING_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_STRING_TO_URI) NamedURI(com.emc.storageos.db.client.model.NamedURI) URI(java.net.URI) FCTN_VPLEX_MIRROR_TO_URI(com.emc.storageos.db.client.util.CommonTransformerFunctions.FCTN_VPLEX_MIRROR_TO_URI) VplexMirror(com.emc.storageos.db.client.model.VplexMirror)

Example 30 with VplexMirror

use of com.emc.storageos.db.client.model.VplexMirror in project coprhd-controller by CoprHD.

the class VPlexBlockServiceApiImpl method initializeMirror.

/**
 * Adds a VplexMirror structure for a Volume. It also calls addMirrorToVolume to
 * link the mirror into the volume's mirror set.
 *
 * @param vplexVolume The volume for which mirror needs to be created
 * @param vPool The virtual pool for the mirror
 * @param varray The virtual array for the mirror
 * @param mirrorLabel The label for the new vplex mirror
 * @param thinPreAllocationSize preallocation size for thin provisioning or 0.
 * @param dbClient
 */
private static VplexMirror initializeMirror(Volume vplexVolume, VirtualPool vPool, VirtualArray varray, String mirrorLabel, long thinPreAllocationSize, DbClient dbClient) {
    // Check if there is already vplex mirror with the same name
    List<VplexMirror> mirrorList = CustomQueryUtility.queryActiveResourcesByConstraint(dbClient, VplexMirror.class, ContainmentPrefixConstraint.Factory.getFullMatchConstraint(VplexMirror.class, "project", vplexVolume.getProject().getURI(), mirrorLabel));
    if (!mirrorList.isEmpty()) {
        throw APIException.badRequests.duplicateLabel(mirrorLabel);
    }
    VplexMirror createdMirror = new VplexMirror();
    createdMirror.setSource(new NamedURI(vplexVolume.getId(), vplexVolume.getLabel()));
    createdMirror.setId(URIUtil.createId(VplexMirror.class));
    createdMirror.setLabel(mirrorLabel);
    createdMirror.setStorageController(vplexVolume.getStorageController());
    createdMirror.setVirtualArray(varray.getId());
    createdMirror.setCapacity(vplexVolume.getCapacity());
    createdMirror.setProject(new NamedURI(vplexVolume.getProject().getURI(), createdMirror.getLabel()));
    createdMirror.setTenant(new NamedURI(vplexVolume.getTenant().getURI(), createdMirror.getLabel()));
    createdMirror.setVirtualPool(vPool.getId());
    createdMirror.setThinPreAllocationSize(thinPreAllocationSize);
    createdMirror.setThinlyProvisioned(VirtualPool.ProvisioningType.Thin.toString().equalsIgnoreCase(vPool.getSupportedProvisioningType()));
    dbClient.createObject(createdMirror);
    addVplexMirrorToVolume(vplexVolume, createdMirror, dbClient);
    return createdMirror;
}
Also used : NamedURI(com.emc.storageos.db.client.model.NamedURI) VplexMirror(com.emc.storageos.db.client.model.VplexMirror)

Aggregations

VplexMirror (com.emc.storageos.db.client.model.VplexMirror)36 Volume (com.emc.storageos.db.client.model.Volume)31 NamedURI (com.emc.storageos.db.client.model.NamedURI)15 DeviceControllerException (com.emc.storageos.exceptions.DeviceControllerException)15 InternalException (com.emc.storageos.svcs.errorhandling.resources.InternalException)15 URI (java.net.URI)15 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)12 InternalServerErrorException (com.emc.storageos.svcs.errorhandling.resources.InternalServerErrorException)12 ControllerException (com.emc.storageos.volumecontroller.ControllerException)12 URISyntaxException (java.net.URISyntaxException)12 ArrayList (java.util.ArrayList)12 StringSet (com.emc.storageos.db.client.model.StringSet)11 VPlexApiException (com.emc.storageos.vplex.api.VPlexApiException)11 WorkflowException (com.emc.storageos.workflow.WorkflowException)11 IOException (java.io.IOException)11 VPlexApiClient (com.emc.storageos.vplex.api.VPlexApiClient)10 StorageSystem (com.emc.storageos.db.client.model.StorageSystem)8 VolumeDescriptor (com.emc.storageos.blockorchestrationcontroller.VolumeDescriptor)7 HashMap (java.util.HashMap)6 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)5