Search in sources :

Example 1 with ExportCreateParam

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

the class ClusterAutoExportTest method createExport.

public URI createExport(URI volumeId, ClusterRestRep cluster, VirtualArrayRestRep virtualArray, ProjectRestRep project) {
    ExportCreateParam input = new ExportCreateParam();
    input.setName(cluster.getName());
    input.setType("Cluster");
    input.addCluster(cluster.getId());
    input.setVarray(virtualArray.getId());
    input.addVolume(volumeId);
    input.setProject(project.getId());
    ExportGroupRestRep export = client.blockExports().create(input).get();
    System.out.println("Created Export Group: " + export.getId());
    return export.getId();
}
Also used : ExportCreateParam(com.emc.storageos.model.block.export.ExportCreateParam) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep)

Example 2 with ExportCreateParam

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

the class ViPRClientApp method createExport.

public URI createExport(URI volumeId, HostRestRep host, VirtualArrayRestRep virtualArray, ProjectRestRep project) {
    ExportCreateParam input = new ExportCreateParam();
    input.setName("SDSClientApp_Export");
    input.setType("Host");
    input.addHost(host.getId());
    input.setVarray(virtualArray.getId());
    input.addVolume(volumeId);
    input.setProject(project.getId());
    ExportGroupRestRep export = client.blockExports().create(input).get();
    System.out.println("Created Export Group: " + export.getId());
    return export.getId();
}
Also used : ExportCreateParam(com.emc.storageos.model.block.export.ExportCreateParam) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep)

Example 3 with ExportCreateParam

use of com.emc.storageos.model.block.export.ExportCreateParam 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)

Example 4 with ExportCreateParam

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

the class CreateExportNoWait method executeTask.

@Override
public Task<ExportGroupRestRep> executeTask() 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) {
            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");
    }
    if (!NullColumnValueGetter.isNullURI(portGroup)) {
        ExportPathParameters exportPathParameters = new ExportPathParameters();
        exportPathParameters.setPortGroup(portGroup);
        export.setExportPathParameters(exportPathParameters);
    }
    Task<ExportGroupRestRep> task = getClient().blockExports().create(export);
    addOrderIdTag(task.getTaskResource().getId());
    return task;
}
Also used : ExportCreateParam(com.emc.storageos.model.block.export.ExportCreateParam) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) VolumeParam(com.emc.storageos.model.block.export.VolumeParam) URI(java.net.URI) ExportPathParameters(com.emc.storageos.model.block.export.ExportPathParameters)

Aggregations

ExportCreateParam (com.emc.storageos.model.block.export.ExportCreateParam)4 ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)3 ExportPathParameters (com.emc.storageos.model.block.export.ExportPathParameters)2 VolumeParam (com.emc.storageos.model.block.export.VolumeParam)2 URI (java.net.URI)2