Search in sources :

Example 6 with ExportGroupRestRep

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

the class BlockExportGroups method removeSnapshot.

@FlashException(referrer = { "exportGroup" })
public static void removeSnapshot(String exportGroupId, String snapshotId) {
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportUpdateParam exportUpdateParam = new ExportUpdateParam();
    exportUpdateParam.removeVolume(uri(snapshotId));
    Task<ExportGroupRestRep> task = client.blockExports().update(uri(exportGroupId), exportUpdateParam);
    flash.put("info", MessagesUtils.get("resources.exportgroup.snapshot.removed", task.getOpId()));
    exportGroup(exportGroupId);
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ExportUpdateParam(com.emc.storageos.model.block.export.ExportUpdateParam) FlashException(controllers.util.FlashException)

Example 7 with ExportGroupRestRep

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

the class BlockExportGroups method getEligibleInitiators.

/**
 * Return list of initiators that can be added to this export group
 *
 * @param exportGroupId id of the export group
 * @return list of initiators
 */
public static List<InitiatorRestRep> getEligibleInitiators(URI exportGroupId) {
    if (exportGroupId == null) {
        return Lists.newArrayList();
    }
    ExportGroupRestRep exportGroup = getViprClient().blockExports().get(exportGroupId);
    final List<URI> initiatorsInExport = ResourceUtils.ids(exportGroup.getInitiators());
    List<URI> allInitiatorIds = getViprClient().initiators().listBulkIds();
    final List<URI> validHosts = getValidHostsForInitiatorExport(exportGroup);
    return getViprClient().initiators().getByIds(allInitiatorIds, new DefaultResourceFilter<InitiatorRestRep>() {

        @Override
        public boolean accept(InitiatorRestRep item) {
            return !initiatorsInExport.contains(item.getId()) && (validHosts.isEmpty() || (item.getHost() != null && !NullColumnValueGetter.isNullURI(item.getHost().getId()) && validHosts.contains(item.getHost().getId())));
        }
    });
}
Also used : ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) URI(java.net.URI) InitiatorRestRep(com.emc.storageos.model.host.InitiatorRestRep)

Example 8 with ExportGroupRestRep

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

the class ResourceUtils method getExportMap.

private static Map<ITLRestRep, ExportGroupRestRep> getExportMap(Collection<ITLRestRep> itls) {
    Map<URI, ExportGroupRestRep> blockExports = getBlockExports(itls);
    Map<ITLRestRep, ExportGroupRestRep> exports = Maps.newLinkedHashMap();
    for (ITLRestRep itl : itls) {
        URI exportId = id(itl.getExport());
        if (exportId != null) {
            exports.put(itl, blockExports.get(exportId));
        }
    }
    return exports;
}
Also used : ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) ITLRestRep(com.emc.storageos.model.block.export.ITLRestRep) URI(java.net.URI)

Example 9 with ExportGroupRestRep

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

the class BlockExportGroupVolumesDataTable method fetch.

public static List<Volume> fetch(URI exportGroupID) {
    if (exportGroupID == null) {
        return Collections.emptyList();
    }
    ViPRCoreClient client = BourneUtil.getViprClient();
    ExportGroupRestRep exportGroup = client.blockExports().get(exportGroupID);
    List<Volume> volumes = Lists.newArrayList();
    for (ExportBlockParam exportBlockParam : exportGroup.getVolumes()) {
        if (ResourceType.isType(VOLUME, exportBlockParam.getId())) {
            volumes.add(new Volume(client.blockVolumes().get(exportBlockParam.getId()), exportBlockParam));
        }
    }
    return volumes;
}
Also used : ExportBlockParam(com.emc.storageos.model.block.export.ExportBlockParam) ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep)

Example 10 with ExportGroupRestRep

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

the class BlockExportGroupsDataTable method fetch.

public static List<ExportGroup> fetch(URI projectId) {
    if (projectId == null) {
        return Collections.EMPTY_LIST;
    }
    ViPRCoreClient client = getViprClient();
    List<ExportGroupRestRep> exportGroups = client.blockExports().findByProject(projectId);
    Map<URI, String> virtualArrays = ResourceUtils.mapNames(client.varrays().list());
    List<ExportGroup> results = Lists.newArrayList();
    for (ExportGroupRestRep exportGroup : exportGroups) {
        results.add(new ExportGroup(exportGroup, virtualArrays));
    }
    return results;
}
Also used : ViPRCoreClient(com.emc.vipr.client.ViPRCoreClient) ExportGroupRestRep(com.emc.storageos.model.block.export.ExportGroupRestRep) URI(java.net.URI)

Aggregations

ExportGroupRestRep (com.emc.storageos.model.block.export.ExportGroupRestRep)59 URI (java.net.URI)36 ViPRCoreClient (com.emc.vipr.client.ViPRCoreClient)24 Asset (com.emc.sa.asset.annotation.Asset)10 AssetDependencies (com.emc.sa.asset.annotation.AssetDependencies)10 FlashException (controllers.util.FlashException)9 ExportUpdateParam (com.emc.storageos.model.block.export.ExportUpdateParam)8 AssetOption (com.emc.vipr.model.catalog.AssetOption)8 ArrayList (java.util.ArrayList)8 ExportBlockParam (com.emc.storageos.model.block.export.ExportBlockParam)7 DeactivateBlockExport (com.emc.sa.service.vipr.block.tasks.DeactivateBlockExport)5 NamedRelatedResourceRep (com.emc.storageos.model.NamedRelatedResourceRep)5 BlockObjectRestRep (com.emc.storageos.model.block.BlockObjectRestRep)5 ITLRestRep (com.emc.storageos.model.block.export.ITLRestRep)5 HostRestRep (com.emc.storageos.model.host.HostRestRep)5 HashSet (java.util.HashSet)5 BlockSnapshotRestRep (com.emc.storageos.model.block.BlockSnapshotRestRep)4 VolumeRestRep (com.emc.storageos.model.block.VolumeRestRep)4 SimpleValueRep (com.emc.storageos.model.customconfig.SimpleValueRep)4 StoragePortGroupRestRepList (com.emc.storageos.model.portgroup.StoragePortGroupRestRepList)4