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