use of com.emc.storageos.hds.api.HDSApiExportManager in project coprhd-controller by CoprHD.
the class HDSExportMaskVolumesValidator method validate.
@Override
public boolean validate() throws Exception {
log.info("Initiating volumes validation of HDS ExportMask: {}", id);
try {
ExportMask exportMask = getExportMask();
StorageSystem system = getStorage();
if (exportMask != null && !CollectionUtils.isEmpty(exportMask.getDeviceDataMap())) {
Set<String> hsdList = exportMask.getDeviceDataMap().keySet();
HDSApiClient client = getClientFactory().getClient(HDSUtils.getHDSServerManagementServerInfo(system), system.getSmisUserName(), system.getSmisPassword());
HDSApiExportManager exportManager = client.getHDSApiExportManager();
String maskName = null;
String systemObjectID = HDSUtils.getSystemObjectID(system);
Set<String> volumesInExportMask = new HashSet<>();
Set<String> initiatorsInExportMask = new HashSet<>();
if (!CollectionUtils.isEmpty(exportMask.getUserAddedVolumes())) {
volumesInExportMask.addAll(exportMask.getUserAddedVolumes().keySet());
}
if (!CollectionUtils.isEmpty(exportMask.getUserAddedInitiators())) {
initiatorsInExportMask.addAll(exportMask.getUserAddedInitiators().keySet());
}
log.info("Volumes {} in Export Mask {}", volumesInExportMask, exportMask.forDisplay());
log.info("Initiators {} in Export Mask {}", initiatorsInExportMask, exportMask.forDisplay());
for (String hsdObjectIdFromDb : hsdList) {
Set<String> discoveredInitiators = new HashSet<>();
HostStorageDomain hsd = exportManager.getHostStorageDomain(systemObjectID, hsdObjectIdFromDb);
if (null == hsd) {
continue;
}
maskName = (null == hsd.getName()) ? hsd.getNickname() : hsd.getName();
// Get initiators from storage system
discoveredInitiators.addAll(HDSUtils.getInitiatorsFromHSD(hsd));
log.info("Initiators {} discovered from array for the HSD {}", discoveredInitiators, maskName);
Set<String> additionalInitiatorsOnArray = Sets.difference(discoveredInitiators, initiatorsInExportMask);
if (!CollectionUtils.isEmpty(additionalInitiatorsOnArray)) {
getValidatorLogger().logDiff(String.format("%s - %s", id, maskName), "initiators", ValidatorLogger.NO_MATCHING_ENTRY, Joiner.on("\t").join(additionalInitiatorsOnArray));
}
}
checkForErrors();
}
} catch (Exception ex) {
log.error("Unexpected exception validating ExportMask volumes: " + ex.getMessage(), ex);
if (getValidatorConfig().isValidationEnabled()) {
throw DeviceControllerException.exceptions.unexpectedCondition("Unexpected exception validating ExportMask volumes: " + ex.getMessage());
}
}
return true;
}
use of com.emc.storageos.hds.api.HDSApiExportManager in project coprhd-controller by CoprHD.
the class HDSProtectionOperations method removeDummyLunPath.
/**
* Removes Dummy Lun Path from Secondary Volume
*
* @param storageSystem
* @param blockObjectURI
* @throws Exception
*/
public void removeDummyLunPath(StorageSystem storageSystem, URI blockObjectURI) throws Exception {
log.info("Started dummy lun path removal from secondary volume");
HDSApiClient apiClient = HDSUtils.getHDSApiClient(hdsApiFactory, storageSystem);
HDSApiExportManager apiExportManager = apiClient.getHDSApiExportManager();
String systemObjectId = HDSUtils.getSystemObjectID(storageSystem);
// Volume volume=dbClient.queryObject(Volume.class, volumeURI);
BlockObject blockObj = BlockObject.fetch(dbClient, blockObjectURI);
String dummyLunPathId = getDummyHSDPathId(storageSystem, blockObj);
if (dummyLunPathId != null) {
apiExportManager.deleteLunPathsFromSystem(systemObjectId, Arrays.asList(dummyLunPathId), storageSystem.getModel());
log.info("Deleted Dummy Lun path from secondary volume");
} else {
log.info("Dummy lun path has been removed already");
}
}
use of com.emc.storageos.hds.api.HDSApiExportManager in project coprhd-controller by CoprHD.
the class HDSProtectionOperations method getDummyHSDPathId.
/**
* Get Dummy Lun Path's path objectID
*
* @param storageSystem
* @param volume
* @return
* @throws Exception
*/
private String getDummyHSDPathId(StorageSystem storageSystem, BlockObject blockObj) throws Exception {
String dummyLunPathId = null;
HDSApiClient apiClient = HDSUtils.getHDSApiClient(hdsApiFactory, storageSystem);
HDSApiExportManager apiExportManager = apiClient.getHDSApiExportManager();
String systemObjectId = HDSUtils.getSystemObjectID(storageSystem);
List<HostStorageDomain> hsdList = apiExportManager.getHostStorageDomains(systemObjectId);
if (hsdList != null) {
for (HostStorageDomain hsd : hsdList) {
if (hsd != null && HDSConstants.DUMMY_HSD.equalsIgnoreCase(hsd.getNickname())) {
if (hsd.getPathList() != null) {
for (Path path : hsd.getPathList()) {
if (path.getDevNum().equalsIgnoreCase(blockObj.getNativeId())) {
dummyLunPathId = path.getObjectID();
log.info("Found secondary volume's dummy lun path id :{}", dummyLunPathId);
return dummyLunPathId;
}
}
}
}
}
}
log.info("Dummy lun path has been removed already for this secondary volume");
return dummyLunPathId;
}
Aggregations