use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class BlockSnapshots method snapshotExports.
public static void snapshotExports(String snapshotId) {
ViPRCoreClient client = BourneUtil.getViprClient();
Map<URI, ExportGroupRestRep> exportGroups = Maps.newHashMap();
Map<URI, List<ITLRestRep>> exportGroupItlMap = Maps.newHashMap();
List<ITLRestRep> itls = client.blockSnapshots().listExports(uri(snapshotId));
for (ITLRestRep itl : itls) {
NamedRelatedResourceRep export = itl.getExport();
if (export != null && export.getId() != null) {
List<ITLRestRep> exportGroupItls = exportGroupItlMap.get(export.getId());
if (exportGroupItls == null) {
exportGroupItls = Lists.newArrayList();
exportGroupItlMap.put(export.getId(), exportGroupItls);
}
exportGroupItls.add(itl);
if (exportGroups.keySet().contains(export.getId()) == false) {
ExportGroupRestRep exportGroup = client.blockExports().get(export.getId());
exportGroups.put(exportGroup.getId(), exportGroup);
}
}
}
render(itls, exportGroups, exportGroupItlMap);
}
use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class BlockVolumes method volumeExports.
public static void volumeExports(String volumeId) {
ViPRCoreClient client = BourneUtil.getViprClient();
Map<URI, ExportGroupRestRep> exportGroups = Maps.newHashMap();
Map<URI, List<ITLRestRep>> exportGroupItlMap = Maps.newHashMap();
List<ITLRestRep> itls = Lists.newArrayList();
VolumeRestRep volume = client.blockVolumes().get(uri(volumeId));
if (volume != null && volume.getInactive() == false) {
itls = client.blockVolumes().getExports(uri(volumeId));
for (ITLRestRep itl : itls) {
NamedRelatedResourceRep export = itl.getExport();
if (export != null && export.getId() != null) {
List<ITLRestRep> exportGroupItls = exportGroupItlMap.get(export.getId());
if (exportGroupItls == null) {
exportGroupItls = Lists.newArrayList();
exportGroupItlMap.put(export.getId(), exportGroupItls);
}
exportGroupItls.add(itl);
if (exportGroups.keySet().contains(export.getId()) == false) {
ExportGroupRestRep exportGroup = client.blockExports().get(export.getId());
exportGroups.put(exportGroup.getId(), exportGroup);
}
}
}
}
// Remove 'internal' marked export groups, we don't want to show these in the exports list
Set<URI> internalExportGroups = Sets.newHashSet();
for (ExportGroupRestRep exportGroup : exportGroups.values()) {
if (Boolean.TRUE.equals(exportGroup.getInternal())) {
internalExportGroups.add(exportGroup.getId());
}
}
// Remove internal export groups
exportGroups.keySet().removeAll(internalExportGroups);
// Remove initiators from interal export groups
exportGroupItlMap.keySet().removeAll(internalExportGroups);
render(itls, exportGroups, exportGroupItlMap);
}
use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class ExportService method populateIscsiConnectionInfo.
/*
* Populate the connection info of the ISCSI volume after completing the
* export of volume to the host in ViPR
*/
private VolumeAttachResponse populateIscsiConnectionInfo(Volume vol) throws InterruptedException {
ITLRestRepList listOfItls = ExportUtils.getBlockObjectInitiatorTargets(vol.getId(), _dbClient, isIdEmbeddedInURL(vol.getId()));
VolumeAttachResponse objCinderInit = new VolumeAttachResponse();
objCinderInit.connection_info = objCinderInit.new ConnectionInfo();
objCinderInit.connection_info.data = objCinderInit.new Data();
objCinderInit.connection_info.driver_volume_type = "iscsi";
objCinderInit.connection_info.data.access_mode = "rw";
objCinderInit.connection_info.data.target_discovered = false;
for (ITLRestRep itl : listOfItls.getExportList()) {
// TODO: user setter methods to set the values of object below.
objCinderInit.connection_info.data.target_iqn = itl.getStoragePort().getPort();
objCinderInit.connection_info.data.target_portal = itl.getStoragePort().getIpAddress() + ":" + itl.getStoragePort().getTcpPort();
objCinderInit.connection_info.data.volume_id = getCinderHelper().trimId(vol.getId().toString());
objCinderInit.connection_info.data.target_lun = itl.getHlu();
_log.info(String.format("itl.getStoragePort().getPort() is %s: itl.getStoragePort().getIpAddress():%s,itl.getHlu() :%s, objCinderInit.toString():%s", itl.getStoragePort().getPort(), itl.getStoragePort().getIpAddress() + ":" + itl.getStoragePort().getTcpPort(), itl.getHlu(), objCinderInit.toString()));
return objCinderInit;
}
return objCinderInit;
}
use of com.emc.storageos.model.block.export.ITLRestRep in project coprhd-controller by CoprHD.
the class ExportService method populateFcConnectionInfo.
/*
* Populate the connection info of the FC volume after completing the
* export of volume to the host in ViPR
*/
private VolumeAttachResponse populateFcConnectionInfo(String chosenProtocol, Volume vol, VolumeActionRequest action, String openstackTenantId) throws InterruptedException {
// After the exportt ask is complete, sometimes there is a delay in the info being reflected in ITL's. So, we are adding a
// small delay here.
Thread.sleep(100000);
ITLRestRepList listOfItls = ExportUtils.getBlockObjectInitiatorTargets(vol.getId(), _dbClient, isIdEmbeddedInURL(vol.getId()));
VolumeAttachResponse objCinderInit = new VolumeAttachResponse();
objCinderInit.connection_info = objCinderInit.new ConnectionInfo();
objCinderInit.connection_info.data = objCinderInit.new Data();
objCinderInit.connection_info.data.target_wwn = new ArrayList<String>();
objCinderInit.connection_info.data.initiator_target_map = new HashMap<String, List<String>>();
objCinderInit.connection_info.driver_volume_type = "fibre_channel";
objCinderInit.connection_info.data.access_mode = "rw";
objCinderInit.connection_info.data.target_discovered = true;
for (ITLRestRep itl : listOfItls.getExportList()) {
// TODO: user setter methods to set the values of object below.
_log.info("itl.getStoragePort().getPort() is {}", itl.getStoragePort().getPort());
if (itl.getStoragePort().getPort() == null)
continue;
objCinderInit.connection_info.data.target_wwn.add(itl.getStoragePort().getPort().toString().replace(":", "").toLowerCase());
objCinderInit.connection_info.data.volume_id = getCinderHelper().trimId(vol.getId().toString());
objCinderInit.connection_info.data.target_lun = itl.getHlu();
_log.info(String.format("itl.getStoragePort().getPort() is %s: itl.getStoragePort().getIpAddress():%s,itl.getHlu() :%s, objCinderInit.toString():%s", itl.getStoragePort().getPort(), itl.getStoragePort().getIpAddress() + ":" + itl.getStoragePort().getTcpPort(), itl.getHlu(), objCinderInit.connection_info.data.toString()));
}
List<Initiator> lstInitiators = getListOfInitiators(action.attach.connector, openstackTenantId, chosenProtocol, vol);
for (Initiator iter : lstInitiators) {
_log.info("iter.getInitiatorPort() {}", iter.getInitiatorPort());
_log.info("objCinderInit.connection_info.data.target_wwn {}", objCinderInit.connection_info.data.target_wwn);
objCinderInit.connection_info.data.initiator_target_map.put(iter.getInitiatorPort().replace(":", "").toLowerCase(), objCinderInit.connection_info.data.target_wwn);
}
return objCinderInit;
}
Aggregations