use of com.emc.storageos.model.block.export.ExportGroupRestRep 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();
}
use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.
the class BlockExports method findByHostOrCluster.
/**
* Finds the exports associated with a host (or that host's cluster) that are for the given project. If a virtual
* array ID is specified, only exports associated with that virtual array are returned.
*
* @param hostId
* the ID of the host.
* @param projectId
* the ID of the project.
* @param virtualArrayId
* the ID of the virtual array to restrict the exports to, or null for no restriction.
* @return the list of export groups associated with the host or any host in the same cluster.
* @deprecated This method was only used in one test class {@code ViPRClientApp} which doesn't use this method anymore.
*/
@Deprecated
public List<ExportGroupRestRep> findByHostOrCluster(URI hostId, URI projectId, URI virtualArrayId) {
HostRestRep host = parent.hosts().get(hostId);
URI clusterId = (host != null) ? id(host.getCluster()) : null;
ResourceFilter<ExportGroupRestRep> filter;
if (virtualArrayId == null) {
filter = new ExportHostOrClusterFilter(hostId, clusterId);
} else {
filter = new ExportHostOrClusterFilter(hostId, clusterId).and(new ExportVirtualArrayFilter(virtualArrayId));
}
return findByProject(projectId, filter);
}
use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.
the class BlockProvider method getExportPathExports.
@Asset("exportPathExport")
@AssetDependencies({ "project", "host" })
public List<AssetOption> getExportPathExports(AssetOptionsContext ctx, URI projectId, URI hostOrClusterId) {
ViPRCoreClient client = api(ctx);
List<ExportGroupRestRep> exports = findExportGroups(hostOrClusterId, projectId, null, client);
return createExportWithVarrayOptions(client, exports);
}
use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method addVolumesToExport.
public static void addVolumesToExport(Collection<URI> volumeIds, Integer hlu, URI exportId, Map<URI, Integer> volumeHlus, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, URI portGroup) {
Task<ExportGroupRestRep> task = execute(new AddVolumesToExport(exportId, volumeIds, hlu, volumeHlus, minPaths, maxPaths, pathsPerInitiator, portGroup));
addRollback(new RemoveBlockResourcesFromExport(exportId, volumeIds));
addAffectedResource(task);
}
use of com.emc.storageos.model.block.export.ExportGroupRestRep in project coprhd-controller by CoprHD.
the class BlockStorageUtils method removeExportIfEmpty.
public static void removeExportIfEmpty(URI exportId) {
boolean retryNeeded = false;
int retryCount = 0;
do {
retryNeeded = false;
ExportGroupRestRep export = getExport(exportId);
if (ResourceUtils.isActive(export) && export.getVolumes().isEmpty()) {
try {
log.info(String.format("Attampting deletion of ExportGroup %s (%s)", export.getGeneratedName(), export.getId()));
Task<ExportGroupRestRep> response = execute(new DeactivateBlockExport(exportId));
addAffectedResource(response);
} catch (ExecutionException e) {
if (e.getCause() instanceof ServiceErrorException) {
ServiceErrorException svcexp = (ServiceErrorException) e.getCause();
if (retryCount++ < MAX_RETRY_COUNT && ServiceCode.toServiceCode(svcexp.getCode()) == ServiceCode.API_TASK_EXECUTION_IN_PROGRESS) {
log.info(String.format("ExportGroup %s deletion waiting on pending task execution", export.getId()));
retryNeeded = true;
try {
Thread.sleep(RETRY_DELAY_MSEC);
} catch (InterruptedException ex) {
log.debug("Sleep interrupted");
}
} else {
throw e;
}
}
}
}
} while (retryNeeded);
}
Aggregations