Search in sources :

Example 6 with ExportPathParameters

use of com.emc.storageos.model.block.export.ExportPathParameters in project coprhd-controller by CoprHD.

the class AddClusterToExport method doExecute.

@Override
protected Task<ExportGroupRestRep> doExecute() throws Exception {
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.setClusters(new ClustersUpdateParam());
    exportUpdateParam.getClusters().getAdd().add(clusterId);
    // Only add the export path parameters to the call if we have to
    boolean addExportPathParameters = false;
    ExportPathParameters exportPathParameters = new ExportPathParameters();
    if (minPaths != null && maxPaths != null && pathsPerInitiator != null) {
        exportPathParameters.setMinPaths(minPaths);
        exportPathParameters.setMaxPaths(maxPaths);
        exportPathParameters.setPathsPerInitiator(pathsPerInitiator);
        addExportPathParameters = true;
    }
    if (portGroup != null) {
        exportPathParameters.setPortGroup(portGroup);
        addExportPathParameters = true;
    }
    if (addExportPathParameters) {
        exportUpdateParam.setExportPathParameters(exportPathParameters);
    }
    return getClient().blockExports().update(exportId, exportUpdateParam);
}
Also used : ClustersUpdateParam(com.emc.storageos.model.block.export.ClustersUpdateParam) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) ExportPathParameters(com.emc.storageos.model.block.export.ExportPathParameters)

Example 7 with ExportPathParameters

use of com.emc.storageos.model.block.export.ExportPathParameters in project coprhd-controller by CoprHD.

the class AddHostAndVolumeToExportNoWait method doExecute.

@Override
protected Task<ExportGroupRestRep> doExecute() throws Exception {
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    List<VolumeParam> volumes = new ArrayList<VolumeParam>();
    if (!NullColumnValueGetter.isNullURI(volumeId)) {
        VolumeParam volume = new VolumeParam(volumeId);
        volume.setLun(-1);
        if (hlu != null && !hlu.equals(ExportVMwareBlockVolumeHelper.USE_EXISTING_HLU)) {
            volume.setLun(hlu);
        }
        volumes.add(volume);
        exportUpdateParam.setVolumes(new VolumeUpdateParam(volumes, new ArrayList<URI>()));
    }
    if (!NullColumnValueGetter.isNullURI(hostId)) {
        exportUpdateParam.setHosts(new HostsUpdateParam());
        exportUpdateParam.getHosts().getAdd().add(hostId);
    }
    if (!NullColumnValueGetter.isNullURI(portGroup)) {
        ExportPathParameters exportPathParameters = new ExportPathParameters();
        exportPathParameters.setPortGroup(portGroup);
        exportUpdateParam.setExportPathParameters(exportPathParameters);
    }
    return getClient().blockExports().update(exportId, exportUpdateParam);
}
Also used : VolumeUpdateParam(com.emc.storageos.model.block.export.VolumeUpdateParam) ArrayList(java.util.ArrayList) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) VolumeParam(com.emc.storageos.model.block.export.VolumeParam) ExportPathParameters(com.emc.storageos.model.block.export.ExportPathParameters) HostsUpdateParam(com.emc.storageos.model.block.export.HostsUpdateParam)

Example 8 with ExportPathParameters

use of com.emc.storageos.model.block.export.ExportPathParameters in project coprhd-controller by CoprHD.

the class AddVolumesToExport method doExecute.

@Override
protected Task<ExportGroupRestRep> doExecute() throws Exception {
    ExportUpdateParam export = new ExportUpdateParam();
    List<VolumeParam> volumes = new ArrayList<VolumeParam>();
    Integer currentHlu = hlu;
    for (URI volumeId : volumeIds) {
        VolumeParam volume = new VolumeParam(volumeId);
        if (currentHlu != null) {
            if (currentHlu.equals(ExportVMwareBlockVolumeHelper.USE_EXISTING_HLU) && volumeHlus != null) {
                Integer volumeHlu = volumeHlus.get(volume.getId());
                if (volumeHlu == null) {
                    volume.setLun(-1);
                } else {
                    volume.setLun(volumeHlu);
                }
            } else {
                volume.setLun(currentHlu);
            }
        }
        if ((currentHlu != null) && (currentHlu > -1)) {
            currentHlu++;
        }
        volumes.add(volume);
    }
    export.setVolumes(new VolumeUpdateParam(volumes, new ArrayList<URI>()));
    // Only add the export path parameters to the call if we have to
    boolean addExportPathParameters = false;
    ExportPathParameters exportPathParameters = new ExportPathParameters();
    if (minPaths != null && maxPaths != null && pathsPerInitiator != null) {
        exportPathParameters.setMinPaths(minPaths);
        exportPathParameters.setMaxPaths(maxPaths);
        exportPathParameters.setPathsPerInitiator(pathsPerInitiator);
        addExportPathParameters = true;
    }
    if (portGroup != null) {
        exportPathParameters.setPortGroup(portGroup);
        addExportPathParameters = true;
    }
    if (addExportPathParameters) {
        export.setExportPathParameters(exportPathParameters);
    }
    return getClient().blockExports().update(exportId, export);
}
Also used : VolumeUpdateParam(com.emc.storageos.model.block.export.VolumeUpdateParam) ArrayList(java.util.ArrayList) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) VolumeParam(com.emc.storageos.model.block.export.VolumeParam) URI(java.net.URI) ExportPathParameters(com.emc.storageos.model.block.export.ExportPathParameters)

Example 9 with ExportPathParameters

use of com.emc.storageos.model.block.export.ExportPathParameters in project coprhd-controller by CoprHD.

the class AdjustExportPaths method doExecute.

@Override
protected Task<ExportGroupRestRep> doExecute() throws Exception {
    ExportPathsAdjustmentParam param = new ExportPathsAdjustmentParam();
    ExportPathParameters exportPathParameters = new ExportPathParameters();
    exportPathParameters.setMinPaths(minPaths);
    exportPathParameters.setMaxPaths(maxPaths);
    exportPathParameters.setPathsPerInitiator(pathsPerInitiator);
    param.setExportPathParameters(exportPathParameters);
    param.setVirtualArray(virtualArray);
    param.setStorageSystem(storageSystemId);
    param.setAdjustedPaths(addedPaths);
    param.setRemovedPaths(removedPaths);
    param.setWaitBeforeRemovePaths(suspendWait);
    return getClient().blockExports().pathAdjustment(exportId, param);
}
Also used : ExportPathsAdjustmentParam(com.emc.storageos.model.block.export.ExportPathsAdjustmentParam) ExportPathParameters(com.emc.storageos.model.block.export.ExportPathParameters)

Example 10 with ExportPathParameters

use of com.emc.storageos.model.block.export.ExportPathParameters in project coprhd-controller by CoprHD.

the class CreateExport method doExecute.

@Override
protected Task<ExportGroupRestRep> doExecute() throws Exception {
    ExportCreateParam export = new ExportCreateParam();
    export.setName(name);
    export.setVarray(varrayId);
    export.setProject(projectId);
    Integer currentHlu = hlu;
    for (URI volumeId : volumeIds) {
        VolumeParam volume = new VolumeParam(volumeId);
        if (currentHlu != null) {
            if (currentHlu.equals(ExportVMwareBlockVolumeHelper.USE_EXISTING_HLU) && volumeHlus != null) {
                Integer volumeHlu = volumeHlus.get(volume.getId());
                if (volumeHlu == null) {
                    volume.setLun(-1);
                } else {
                    volume.setLun(volumeHlu);
                }
            } else {
                volume.setLun(currentHlu);
            }
        }
        if ((currentHlu != null) && (currentHlu > -1)) {
            currentHlu++;
        }
        export.getVolumes().add(volume);
    }
    if (clusterId != null) {
        export.addCluster(clusterId);
        export.setType("Cluster");
    } else {
        export.addHost(hostId);
        export.setType("Host");
    }
    // Only add the export path parameters to the call if we have to
    boolean addExportPathParameters = false;
    ExportPathParameters exportPathParameters = new ExportPathParameters();
    if (minPaths != null && maxPaths != null && pathsPerInitiator != null) {
        exportPathParameters.setMinPaths(minPaths);
        exportPathParameters.setMaxPaths(maxPaths);
        exportPathParameters.setPathsPerInitiator(pathsPerInitiator);
        addExportPathParameters = true;
    }
    if (portGroup != null) {
        exportPathParameters.setPortGroup(portGroup);
        addExportPathParameters = true;
    }
    if (addExportPathParameters) {
        export.setExportPathParameters(exportPathParameters);
    }
    return getClient().blockExports().create(export);
}
Also used : ExportCreateParam(com.emc.storageos.model.block.export.ExportCreateParam) VolumeParam(com.emc.storageos.model.block.export.VolumeParam) URI(java.net.URI) ExportPathParameters(com.emc.storageos.model.block.export.ExportPathParameters)

Aggregations

ExportPathParameters (com.emc.storageos.model.block.export.ExportPathParameters)12 VolumeParam (com.emc.storageos.model.block.export.VolumeParam)6 URI (java.net.URI)6 ArrayList (java.util.ArrayList)5 ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)4 NamedURI (com.emc.storageos.db.client.model.NamedURI)3 ExportGroup (com.emc.storageos.db.client.model.ExportGroup)2 Operation (com.emc.storageos.db.client.model.Operation)2 Project (com.emc.storageos.db.client.model.Project)2 TaskResourceRep (com.emc.storageos.model.TaskResourceRep)2 ExportCreateParam (com.emc.storageos.model.block.export.ExportCreateParam)2 ExportPathsAdjustmentPreviewParam (com.emc.storageos.model.block.export.ExportPathsAdjustmentPreviewParam)2 HostsUpdateParam (com.emc.storageos.model.block.export.HostsUpdateParam)2 VolumeUpdateParam (com.emc.storageos.model.block.export.VolumeUpdateParam)2 HashMap (java.util.HashMap)2 Consumes (javax.ws.rs.Consumes)2 Produces (javax.ws.rs.Produces)2 BulkList (com.emc.storageos.api.service.impl.response.BulkList)1 SearchedResRepList (com.emc.storageos.api.service.impl.response.SearchedResRepList)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1