use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class VmaxPortGroupProcessor method createPortGroup.
/**
* Create a port group instance in ViPR DB
*
* @param pgName
* - port group name
* @param storage
* - storage system
* @param viprCreated
* - if the port group is implicitly created by ViPR
* @return created storage port group
*/
private StoragePortGroup createPortGroup(String pgName, StorageSystem storage, boolean viprCreated) {
String guid = String.format("%s+%s", storage.getNativeGuid(), pgName);
StoragePortGroup portGroup = new StoragePortGroup();
portGroup.setId(URIUtil.createId(StoragePortGroup.class));
portGroup.setLabel(pgName);
portGroup.setNativeGuid(guid);
portGroup.setStorageDevice(storage.getId());
portGroup.setInactive(false);
if (viprCreated) {
portGroup.setRegistrationStatus(RegistrationStatus.UNREGISTERED.name());
} else {
portGroup.setRegistrationStatus(RegistrationStatus.REGISTERED.name());
}
portGroup.setMutable(viprCreated);
dbClient.createObject(portGroup);
return portGroup;
}
use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class SmisStorageDevice method doCreateStoragePortGroup.
@Override
public void doCreateStoragePortGroup(StorageSystem storage, URI portGroupURI, TaskCompleter completer) throws Exception {
try {
StoragePortGroup portGroup = _dbClient.queryObject(StoragePortGroup.class, portGroupURI);
_log.info("Creating port group");
_helper.createTargetPortGroup(storage, portGroup.getLabel(), StringSetUtil.stringSetToUriList(portGroup.getStoragePorts()));
completer.ready(_dbClient);
} catch (Exception e) {
_log.error("Failed creating storage port group:", e);
completer.error(_dbClient, DeviceControllerException.errors.jobFailed(e));
}
}
use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class VmaxExportOperations method removePaths.
@Override
public void removePaths(StorageSystem storage, URI exportMaskURI, Map<URI, List<URI>> adjustedPaths, Map<URI, List<URI>> removePaths, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("{} removePaths START...", storage.getSerialNumber());
// port group
try {
// Check if the port group is mutable. If not, don't remove ports.
ExportMask mask = _dbClient.queryObject(ExportMask.class, exportMaskURI);
URI pgURI = mask.getPortGroup();
if (!NullColumnValueGetter.isNullURI(pgURI)) {
StoragePortGroup portGroup = _dbClient.queryObject(StoragePortGroup.class, pgURI);
if (!portGroup.getMutable()) {
_log.info(String.format("The port group %s is immutable, done", portGroup.getNativeGuid()));
taskCompleter.ready(_dbClient);
return;
}
}
List<URI> removingPorts = getRemovedStoragePortsForRemovePaths(adjustedPaths, removePaths);
if (removingPorts != null && !removingPorts.isEmpty()) {
Set<URI> portsRemoved = removeStoragePorts(storage, exportMaskURI, removingPorts);
if (portsRemoved != null && !portsRemoved.isEmpty()) {
ExportMaskRemovePathsCompleter completer = (ExportMaskRemovePathsCompleter) taskCompleter;
List<URI> removedPorts = new ArrayList<URI>(portsRemoved);
completer.setRemovedStoragePorts(removedPorts);
}
}
taskCompleter.ready(_dbClient);
} catch (Exception e) {
_log.error(String.format("removePaths failed - maskName: %s", exportMaskURI.toString()), e);
ServiceError serviceError = DeviceControllerException.errors.jobFailed(e);
taskCompleter.error(_dbClient, serviceError);
}
}
use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class VmaxExportOperations method removeInitiators.
@Override
public void removeInitiators(StorageSystem storage, URI exportMaskURI, List<URI> volumeURIList, List<Initiator> initiatorList, List<URI> targetURIList, TaskCompleter taskCompleter) throws DeviceControllerException {
_log.info("{} removeInitiators START...", storage == null ? null : storage.getSerialNumber());
String clusterName = getClusterNameFromInitiators(initiatorList);
if (clusterName == null) {
final String logMsg = "All initiators should belong to the same cluster or not have a cluster name at all";
_log.error(String.format("removeInitiator failed - maskName: %s", exportMaskURI.toString()), logMsg);
String opName = ResourceOperationTypeEnum.DELETE_EXPORT_INITIATOR.getName();
ServiceError serviceError = DeviceControllerException.errors.jobFailedOp(opName);
taskCompleter.error(_dbClient, serviceError);
return;
} else {
CloseableIterator<CIMInstance> cigInstances = null;
try {
_log.info("removeInitiators: Export mask id: {}", exportMaskURI);
if (volumeURIList != null) {
_log.info("removeInitiators: volumes : {}", Joiner.on(',').join(volumeURIList));
}
_log.info("removeInitiators: initiators : {}", Joiner.on(',').join(initiatorList));
if (targetURIList != null) {
_log.info("removeInitiators: targets : {}", Joiner.on(',').join(targetURIList));
}
boolean isRollback = WorkflowService.getInstance().isStepInRollbackState(taskCompleter.getOpId());
ExportMask exportMask = _dbClient.queryObject(ExportMask.class, exportMaskURI);
ExportMaskValidationContext ctx = new ExportMaskValidationContext();
ctx.setStorage(storage);
ctx.setExportMask(exportMask);
ctx.setBlockObjects(volumeURIList, _dbClient);
ctx.setInitiators(initiatorList);
// Allow exceptions to be thrown when not rolling back.
ctx.setAllowExceptions(!isRollback);
validator.removeInitiators(ctx).validate();
if (isRollback) {
// Get the context from the task completer as this is a rollback.
ExportOperationContext context = (ExportOperationContext) WorkflowService.getInstance().loadStepData(taskCompleter.getOpId());
exportMaskRollback(storage, context, taskCompleter);
} else {
CIMArgument[] inArgs;
CIMArgument[] outArgs;
_log.info("Removing initiators ...");
// Create a mapping of the InitiatorPort String to Initiator.
Map<String, Initiator> nameToInitiator = new HashMap<String, Initiator>();
for (Initiator initiator : initiatorList) {
String normalizedName = Initiator.normalizePort(initiator.getInitiatorPort());
nameToInitiator.put(normalizedName, initiator);
}
// We're going to get a mapping of which InitiatorGroups the initiators belong.
// With this mapping we can remove initiators from their associated IGs sequentially
ListMultimap<CIMObjectPath, String> igToInitiators = ArrayListMultimap.create();
mapInitiatorsToInitiatorGroups(igToInitiators, storage, initiatorList);
for (CIMObjectPath igPath : igToInitiators.keySet()) {
List<String> initiatorPorts = igToInitiators.get(igPath);
List<Initiator> initiatorsForIG = new ArrayList<Initiator>();
// Using the mapping, create a list of Initiator objects
for (String port : initiatorPorts) {
Initiator initiator = nameToInitiator.get(port);
if (initiator != null) {
initiatorsForIG.add(initiator);
}
}
boolean removingAllPortsInIG = initiatorPorts.size() == initiatorsForIG.size();
if (removingAllPortsInIG) {
// We are apparently trying to remove all the initiators in an Initiator Group.
// This is a special condition. It is not a case of removing the initiators
// from an individual group, we will instead treat this as a removal of the
// IG from the cascade-IG (thereby preventing access to the host pointed to
// by this IG).
_log.info(String.format("Request to remove all the initiators from IG %s, so we will remove the IG from the cascaded-IG", igPath.toString()));
ExportMask mask = _dbClient.queryObject(ExportMask.class, exportMaskURI);
CIMObjectPath cigInMVPath = null;
CIMInstance mvInstance = _helper.getSymmLunMaskingView(storage, mask);
cigInstances = _helper.getAssociatorInstances(storage, mvInstance.getObjectPath(), null, SmisConstants.SE_INITIATOR_MASKING_GROUP, null, null, SmisConstants.PS_ELEMENT_NAME);
if (cigInstances.hasNext()) {
cigInMVPath = cigInstances.next().getObjectPath();
}
// Find the cascaded initiator group that this belongs to and remove the IG from it.
// Note: we should not be in here if the IG was associated directly to the MV. If the
// IG were related to the MV, then the masking orchestrator should have generated
// a workflow to delete the MV.
cigInstances = _helper.getAssociatorInstances(storage, igPath, null, SmisConstants.SE_INITIATOR_MASKING_GROUP, null, null, SmisConstants.PS_ELEMENT_NAME);
while (cigInstances.hasNext()) {
CIMObjectPath cigPath = cigInstances.next().getObjectPath();
if (!cigPath.equals(cigInMVPath)) {
// to remove the initiators from.
continue;
}
_log.info(String.format("Removing IG %s from CIG %s", igPath.toString(), cigPath.toString()));
inArgs = _helper.getRemoveIGFromCIG(igPath, cigPath);
outArgs = new CIMArgument[5];
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerConfigSvcPath(storage), "RemoveMembers", inArgs, outArgs, null);
// Determine if the IG contains all initiators that were added by user/ViPR, and if
// the IG is no longer referenced by masking views or parent IGs. If so, it can be
// removed.
boolean removeIG = true;
for (Initiator initiator : initiatorsForIG) {
if (!mask.hasUserInitiator(initiator.getId())) {
removeIG = false;
}
}
if (removeIG) {
List<CIMObjectPath> igList = new ArrayList<>();
igList.add(igPath);
this.checkIGsAndDeleteIfUnassociated(storage, igList);
}
}
} else {
inArgs = _helper.getRemoveInitiatorsFromMaskingGroupInputArguments(storage, igPath, initiatorsForIG);
outArgs = new CIMArgument[5];
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerConfigSvcPath(storage), "RemoveMembers", inArgs, outArgs, null);
}
}
if (targetURIList != null && !targetURIList.isEmpty()) {
_log.info("Removing targets...");
URI pgURI = exportMask.getPortGroup();
if (!NullColumnValueGetter.isNullURI(pgURI)) {
StoragePortGroup portGroup = _dbClient.queryObject(StoragePortGroup.class, pgURI);
if (!portGroup.getMutable()) {
_log.info(String.format("The port group %s is immutable, done", portGroup.getNativeGuid()));
taskCompleter.ready(_dbClient);
return;
}
}
CIMInstance portGroupInstance = _helper.getPortGroupInstance(storage, exportMask.getMaskName());
if (null == portGroupInstance) {
String errMsg = String.format("removeInitiators failed - maskName %s : Port group not found ", exportMask.getMaskName());
ServiceError serviceError = DeviceControllerException.errors.jobFailedMsg(errMsg, null);
taskCompleter.error(_dbClient, serviceError);
return;
}
String pgGroupName = (String) portGroupInstance.getPropertyValue(SmisConstants.CP_ELEMENT_NAME);
// Get the current ports off of the storage group; only add the ones that aren't there already.
WBEMClient client = _helper.getConnection(storage).getCimClient();
List<String> storagePorts = _helper.getStoragePortsFromLunMaskingInstance(client, portGroupInstance);
Set<URI> storagePortURIs = new HashSet<>();
storagePortURIs.addAll(transform(ExportUtils.storagePortNamesToURIs(_dbClient, storagePorts), CommonTransformerFunctions.FCTN_STRING_TO_URI));
Set<URI> portsToRemove = intersection(newHashSet(targetURIList), storagePortURIs);
boolean removingLast = portsToRemove.size() == storagePortURIs.size();
if (!portsToRemove.isEmpty() && !removingLast) {
inArgs = _helper.getRemoveTargetPortsFromMaskingGroupInputArguments(storage, pgGroupName, Lists.newArrayList(portsToRemove));
outArgs = new CIMArgument[5];
_helper.invokeMethodSynchronously(storage, _cimPath.getControllerConfigSvcPath(storage), "RemoveMembers", inArgs, outArgs, null);
} else if (!removingLast) {
_log.info(String.format("Target ports already removed fom port group %s, likely by a previous operation.", pgGroupName));
} else {
// In this case, some programming, orchestration, or
// user-fiddling-with-things-outside-of-ViPR situation led us
// to this scenario.
// It's best to just print the ports and port group and leave it alone.
_log.error(String.format("Removing target ports would cause an empty port group %s, which is not allowed on VMAX. Manual port removal may be required.", pgGroupName));
// This can lead to an inaccuracy in the ExportMask object, but may be recitified next time
// it's refreshed.
}
}
}
_log.info(String.format("removeInitiators succeeded - maskName: %s", exportMaskURI.toString()));
taskCompleter.ready(_dbClient);
} catch (Exception e) {
_log.error(String.format("removeInitiators failed - maskName: %s", exportMaskURI.toString()), e);
String opName = ResourceOperationTypeEnum.DELETE_EXPORT_INITIATOR.getName();
ServiceError serviceError = DeviceControllerException.errors.jobFailedOpMsg(opName, e.getMessage());
taskCompleter.error(_dbClient, serviceError);
} finally {
if (cigInstances != null) {
cigInstances.close();
}
}
}
_log.info("{} removeInitiators END...", storage == null ? null : storage.getSerialNumber());
}
use of com.emc.storageos.db.client.model.StoragePortGroup in project coprhd-controller by CoprHD.
the class VmaxExportOperations method refreshExportMask.
@Override
public ExportMask refreshExportMask(StorageSystem storage, ExportMask mask) throws DeviceControllerException {
long startTime = System.currentTimeMillis();
try {
CIMInstance instance = _helper.getSymmLunMaskingView(storage, mask);
if (instance != null) {
StringBuilder builder = new StringBuilder();
WBEMClient client = _helper.getConnection(storage).getCimClient();
String name = CIMPropertyFactory.getPropertyValue(instance, SmisConstants.CP_ELEMENT_NAME);
// Get volumes and initiators for the masking instance
Map<String, Integer> discoveredVolumes = _helper.getVolumesFromLunMaskingInstance(client, instance);
List<String> discoveredPorts = _helper.getInitiatorsFromLunMaskingInstance(client, instance);
Set existingInitiators = (mask.getExistingInitiators() != null) ? mask.getExistingInitiators() : Collections.emptySet();
Set existingVolumes = (mask.getExistingVolumes() != null) ? mask.getExistingVolumes().keySet() : Collections.emptySet();
builder.append(String.format("%nXM existing objects: %s I{%s} V:{%s}%n", name, Joiner.on(',').join(existingInitiators), Joiner.on(',').join(existingVolumes)));
builder.append(String.format("XM discovered: %s I:{%s} V:{%s}%n", name, Joiner.on(',').join(discoveredPorts), Joiner.on(',').join(discoveredVolumes.keySet())));
List<String> initiatorsToAddToExisting = new ArrayList<String>();
List<Initiator> initiatorsToAddToUserAddedAndInitiatorList = new ArrayList<Initiator>();
/**
* For the newly discovered initiators, if they are ViPR discovered ports and belong to same resource
* add them to user added and initiators list, otherwise add to existing list.
*/
for (String port : discoveredPorts) {
String normalizedPort = Initiator.normalizePort(port);
if (!mask.hasExistingInitiator(normalizedPort) && !mask.hasUserInitiator(normalizedPort)) {
Initiator existingInitiator = ExportUtils.getInitiator(Initiator.toPortNetworkId(port), _dbClient);
// Don't add additional initiator to initiators list if it belongs to different host/cluster
if (existingInitiator != null && !ExportMaskUtils.checkIfDifferentResource(mask, existingInitiator)) {
_log.info("Initiator {}->{} belonging to same compute, adding to userAdded and initiator list.", normalizedPort, existingInitiator.getId());
initiatorsToAddToUserAddedAndInitiatorList.add(existingInitiator);
} else {
initiatorsToAddToExisting.add(normalizedPort);
}
}
}
/**
* Get the existing initiators from the mask and remove the non-discovered ports because
* they are not discovered and are stale.
*
* If the mask has existing initiators but if they are discovered and belongs to same compute resource, then the
* initiators has to get added to user Added and initiators list, and removed from existing list.
*/
List<String> initiatorsToRemoveFromExistingList = new ArrayList<String>();
if (mask.getExistingInitiators() != null && !mask.getExistingInitiators().isEmpty()) {
for (String existingInitiatorStr : mask.getExistingInitiators()) {
if (!discoveredPorts.contains(existingInitiatorStr)) {
initiatorsToRemoveFromExistingList.add(existingInitiatorStr);
} else {
Initiator existingInitiator = ExportUtils.getInitiator(Initiator.toPortNetworkId(existingInitiatorStr), _dbClient);
if (existingInitiator != null && !ExportMaskUtils.checkIfDifferentResource(mask, existingInitiator)) {
_log.info("Initiator {}->{} belonging to same compute, removing from existing," + " and adding to userAdded and initiator list", existingInitiatorStr, existingInitiator.getId());
initiatorsToAddToUserAddedAndInitiatorList.add(existingInitiator);
initiatorsToRemoveFromExistingList.add(existingInitiatorStr);
}
}
}
}
/**
* Get all the initiators from the mask and remove all the ViPR discovered ports.
* The remaining list has to be removed from user Added and initiator list, because they are not available in ViPR
* but has to be moved to existing list.
*/
List<URI> initiatorsToRemoveFromUserAddedAndInitiatorList = new ArrayList<URI>();
if (mask.getInitiators() != null && !mask.getInitiators().isEmpty()) {
initiatorsToRemoveFromUserAddedAndInitiatorList.addAll(transform(mask.getInitiators(), CommonTransformerFunctions.FCTN_STRING_TO_URI));
for (String port : discoveredPorts) {
String normalizedPort = Initiator.normalizePort(port);
Initiator initiatorDiscoveredInViPR = ExportUtils.getInitiator(Initiator.toPortNetworkId(port), _dbClient);
if (initiatorDiscoveredInViPR != null) {
initiatorsToRemoveFromUserAddedAndInitiatorList.remove(initiatorDiscoveredInViPR.getId());
} else if (!mask.hasExistingInitiator(normalizedPort)) {
_log.info("Initiator {} not found in database, removing from user Added and initiator list," + " and adding to existing list.", port);
initiatorsToAddToExisting.add(normalizedPort);
}
}
}
boolean removeInitiators = !initiatorsToRemoveFromExistingList.isEmpty() || !initiatorsToRemoveFromUserAddedAndInitiatorList.isEmpty();
boolean addInitiators = !initiatorsToAddToUserAddedAndInitiatorList.isEmpty() || !initiatorsToAddToExisting.isEmpty();
// Check the volumes and update the lists as necessary
Map<String, Integer> volumesToAdd = ExportMaskUtils.diffAndFindNewVolumes(mask, discoveredVolumes);
boolean addVolumes = !volumesToAdd.isEmpty();
boolean removeVolumes = false;
List<String> volumesToRemove = new ArrayList<String>();
// if the volume is in export mask's user added volumes and also in the existing volumes, remove from existing volumes
for (String wwn : discoveredVolumes.keySet()) {
if (mask.hasExistingVolume(wwn)) {
URIQueryResultList volumeList = new URIQueryResultList();
_dbClient.queryByConstraint(AlternateIdConstraint.Factory.getVolumeWwnConstraint(wwn), volumeList);
if (volumeList.iterator().hasNext()) {
URI volumeURI = volumeList.iterator().next();
if (mask.hasUserCreatedVolume(volumeURI)) {
builder.append(String.format("\texisting volumes contain wwn %s, but it is also in the " + "export mask's user added volumes, so removing from existing volumes", wwn));
volumesToRemove.add(wwn);
}
}
}
}
if (mask.getExistingVolumes() != null && !mask.getExistingVolumes().isEmpty()) {
volumesToRemove.addAll(mask.getExistingVolumes().keySet());
volumesToRemove.removeAll(discoveredVolumes.keySet());
removeVolumes = !volumesToRemove.isEmpty();
}
// Update user added volume's HLU information in ExportMask and ExportGroup
ExportMaskUtils.updateHLUsInExportMask(mask, discoveredVolumes, _dbClient);
// Grab the storage ports that have been allocated for this
// existing mask and update them.
List<String> storagePorts = _helper.getStoragePortsFromLunMaskingInstance(client, instance);
List<String> storagePortURIs = ExportUtils.storagePortNamesToURIs(_dbClient, storagePorts);
// Check the storagePorts and update the lists as necessary
boolean addStoragePorts = false;
List<String> storagePortsToAdd = new ArrayList<>();
if (mask.getStoragePorts() == null) {
mask.setStoragePorts(new ArrayList<String>());
}
for (String portID : storagePortURIs) {
if (!mask.getStoragePorts().contains(portID)) {
storagePortsToAdd.add(portID);
addStoragePorts = true;
}
}
boolean removeStoragePorts = false;
List<String> storagePortsToRemove = new ArrayList<String>();
if (mask.getStoragePorts() != null && !mask.getStoragePorts().isEmpty()) {
storagePortsToRemove.addAll(mask.getStoragePorts());
storagePortsToRemove.removeAll(storagePortURIs);
removeStoragePorts = !storagePortsToRemove.isEmpty();
}
builder.append(String.format("XM refresh: %s existing initiators; add:{%s} remove:{%s}%n", name, Joiner.on(',').join(initiatorsToAddToExisting), Joiner.on(',').join(initiatorsToRemoveFromExistingList)));
builder.append(String.format("XM refresh: %s user added and initiator list; add:{%s} remove:{%s}%n", name, Joiner.on(',').join(initiatorsToAddToUserAddedAndInitiatorList), Joiner.on(',').join(initiatorsToRemoveFromUserAddedAndInitiatorList)));
builder.append(String.format("XM refresh: %s volumes; add:{%s} remove:{%s}%n", name, Joiner.on(',').join(volumesToAdd.keySet()), Joiner.on(',').join(volumesToRemove)));
builder.append(String.format("XM refresh: %s ports; add:{%s} remove:{%s}%n", name, Joiner.on(',').join(storagePortsToAdd), Joiner.on(',').join(storagePortsToRemove)));
// Any changes indicated, then update the mask and persist it
if (addInitiators || removeInitiators || addVolumes || removeVolumes || addStoragePorts || removeStoragePorts) {
mask.removeFromExistingInitiators(initiatorsToRemoveFromExistingList);
if (!initiatorsToRemoveFromUserAddedAndInitiatorList.isEmpty()) {
mask.removeInitiatorURIs(initiatorsToRemoveFromUserAddedAndInitiatorList);
mask.removeFromUserAddedInitiatorsByURI(initiatorsToRemoveFromUserAddedAndInitiatorList);
}
// https://coprhd.atlassian.net/browse/COP-17224 - For those cases where InitiatorGroups are shared
// by
// MaskingViews, if CoprHD processes one ExportMask by updating it with new initiators, then it
// could
// affect another ExportMasks. Consider that this refreshExportMask is against that other
// ExportMask.
// We shouldn't read the initiators that we find as 'existing' (that is created outside of CoprHD),
// instead we should consider them userAdded for this ExportMask, as well.
List<Initiator> userAddedInitiators = ExportMaskUtils.findIfInitiatorsAreUserAddedInAnotherMask(mask, initiatorsToAddToUserAddedAndInitiatorList, _dbClient);
mask.addToUserCreatedInitiators(userAddedInitiators);
builder.append(String.format("XM refresh: %s user added initiators; add:{%s} remove:{%s}%n", name, Joiner.on(',').join(userAddedInitiators), Joiner.on(',').join(initiatorsToRemoveFromUserAddedAndInitiatorList)));
mask.addInitiators(initiatorsToAddToUserAddedAndInitiatorList);
mask.addToUserCreatedInitiators(initiatorsToAddToUserAddedAndInitiatorList);
mask.addToExistingInitiatorsIfAbsent(initiatorsToAddToExisting);
mask.removeFromExistingInitiators(initiatorsToRemoveFromExistingList);
mask.removeFromExistingVolumes(volumesToRemove);
mask.addToExistingVolumesIfAbsent(volumesToAdd);
mask.getStoragePorts().addAll(storagePortsToAdd);
mask.getStoragePorts().removeAll(storagePortsToRemove);
URI pgURI = mask.getPortGroup();
if (!NullColumnValueGetter.isNullURI(pgURI) && (!storagePortsToAdd.isEmpty() || !storagePortsToRemove.isEmpty())) {
StoragePortGroup portGroup = _dbClient.queryObject(StoragePortGroup.class, pgURI);
portGroup.getStoragePorts().addAll(storagePortsToAdd);
portGroup.getStoragePorts().removeAll(storagePortsToRemove);
_dbClient.updateObject(portGroup);
}
ExportMaskUtils.sanitizeExportMaskContainers(_dbClient, mask);
builder.append("XM refresh: There are changes to mask, " + "updating it...\n");
_dbClient.updateObject(mask);
} else {
builder.append("XM refresh: There are no changes to the mask\n");
}
_networkDeviceController.refreshZoningMap(mask, transform(initiatorsToRemoveFromUserAddedAndInitiatorList, CommonTransformerFunctions.FCTN_URI_TO_STRING), Collections.EMPTY_LIST, (addInitiators || removeInitiators), true);
_log.info(builder.toString());
}
} catch (Exception e) {
boolean throwException = true;
if (e instanceof WBEMException) {
WBEMException we = (WBEMException) e;
// Only throw exception if code is not CIM_ERROR_NOT_FOUND
throwException = (we.getID() != WBEMException.CIM_ERR_NOT_FOUND);
}
if (throwException) {
String msg = "Error when attempting to query LUN masking information: " + e.getMessage();
_log.error(MessageFormat.format("Encountered an SMIS error when attempting to refresh existing exports: {0}", msg), e);
throw SmisException.exceptions.refreshExistingMaskFailure(msg, e);
}
} finally {
long totalTime = System.currentTimeMillis() - startTime;
_log.info(String.format("refreshExportMask took %f seconds", (double) totalTime / (double) 1000));
}
return mask;
}
Aggregations