use of com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport 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);
}
use of com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport in project coprhd-controller by CoprHD.
the class BlockStorageUtils method createClusterExport.
public static URI createClusterExport(URI projectId, URI virtualArrayId, List<URI> volumeIds, Integer hlu, Cluster cluster, Map<URI, Integer> volumeHlus, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, URI portGroup) {
String exportName = cluster.getLabel();
Task<ExportGroupRestRep> task = execute(new CreateExport(exportName, virtualArrayId, projectId, volumeIds, hlu, cluster.getLabel(), null, cluster.getId(), volumeHlus, minPaths, maxPaths, pathsPerInitiator, portGroup));
URI exportId = task.getResourceId();
addRollback(new DeactivateBlockExport(exportId));
addAffectedResource(exportId);
return exportId;
}
use of com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport in project coprhd-controller by CoprHD.
the class BlockStorageUtils method createHostExport.
public static URI createHostExport(URI projectId, URI virtualArrayId, List<URI> volumeIds, Integer hlu, Host host, Map<URI, Integer> volumeHlus, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, URI portGroup) {
String exportName = host.getHostName();
Task<ExportGroupRestRep> task = execute(new CreateExport(exportName, virtualArrayId, projectId, volumeIds, hlu, host.getHostName(), host.getId(), null, volumeHlus, minPaths, maxPaths, pathsPerInitiator, portGroup));
URI exportId = task.getResourceId();
addRollback(new DeactivateBlockExport(exportId));
addAffectedResource(exportId);
return exportId;
}
use of com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport in project coprhd-controller by CoprHD.
the class BlockStorageUtils method addHostToExport.
public static void addHostToExport(URI exportId, URI host, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, URI portGroup) {
Task<ExportGroupRestRep> task = execute(new AddHostToExport(exportId, host, minPaths, maxPaths, pathsPerInitiator, portGroup));
addRollback(new DeactivateBlockExport(exportId));
addAffectedResource(task);
}
use of com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport in project coprhd-controller by CoprHD.
the class BlockStorageUtils method addClusterToExport.
public static void addClusterToExport(URI exportId, URI cluster, Integer minPaths, Integer maxPaths, Integer pathsPerInitiator, URI portGroup) {
Task<ExportGroupRestRep> task = execute(new AddClusterToExport(exportId, cluster, minPaths, maxPaths, pathsPerInitiator, portGroup));
addRollback(new DeactivateBlockExport(exportId));
addAffectedResource(task);
}
Aggregations