use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class MdsNetworkSystemDevice method removeZones.
@Override
public BiosCommandResult removeZones(NetworkSystem network, List<Zone> zones, String fabricId, String fabricWwn, boolean activateZones) throws NetworkDeviceControllerException {
BiosCommandResult result = null;
MDSDialog dialog = null;
Map<String, String> removedZoneNames = new HashMap<String, String>();
try {
dialog = setUpDialog(network);
List<IvrZone> removingIvrZones = new ArrayList<IvrZone>();
List<Zone> removingZones = new ArrayList<Zone>();
for (Zone zone : zones) {
IvrZone routedZone = getRoutedZone(dialog, zone, network);
// as normal zone
if (routedZone != null) {
removingIvrZones.add(routedZone);
} else {
removingZones.add(zone);
}
}
// Throw artificial exception here to simulate FOD for MDS same as creating alias
InvokeTestFailure.internalOnlyInvokeTestFailure(InvokeTestFailure.ARTIFICIAL_FAILURE_057);
if (!removingZones.isEmpty()) {
Integer vsanId = checkVsanFabric(dialog, fabricId, fabricWwn);
removedZoneNames.putAll(removeZonesStrategy(dialog, removingZones, vsanId, activateZones));
}
if (!removingIvrZones.isEmpty()) {
removedZoneNames.putAll(removeIvrZonesStrategy(dialog, removingIvrZones));
}
_log.info("Remove VSAN zone results: " + toMessage(removedZoneNames));
result = getBiosCommandResult(removedZoneNames);
} catch (Exception ex) {
_log.error("Cannot remove zones: " + (ex.getCause() != null ? ex.getCause().getMessage() : ex.getLocalizedMessage()));
throw ex;
} finally {
disconnect(dialog);
}
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class MdsNetworkSystemDevice method activateZones.
@Override
public BiosCommandResult activateZones(NetworkSystem network, String fabricId, String fabricWwn) throws NetworkDeviceControllerException {
BiosCommandResult result = null;
MDSDialog dialog = null;
try {
dialog = setUpDialog(network);
Integer vsanId = checkVsanFabric(dialog, fabricId, fabricWwn);
String activatedZonesetName = activateZonesStrategy(dialog, vsanId);
String msg = "";
if (activatedZonesetName == null) {
msg = "Vsan: " + fabricId + ": No zoneset was activated";
} else {
msg = "Vsan: " + fabricId + ": Successfully activated zoneset: " + activatedZonesetName;
}
_log.info(msg);
result = BiosCommandResult.createSuccessfulResult();
} catch (NetworkDeviceControllerException ex) {
_log.error("Cannot activate zoneset: " + (ex.getCause() != null ? ex.getCause().getMessage() : ex.getLocalizedMessage()));
throw ex;
} finally {
disconnect(dialog);
}
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class MdsNetworkSystemDevice method doConnect.
@Override
public BiosCommandResult doConnect(NetworkSystem network) {
BiosCommandResult result = null;
MDSDialog dialog = null;
try {
dialog = setUpDialog(network);
String[] versInfo = dialog.showVersion();
result = BiosCommandResult.createSuccessfulResult();
if (versInfo[0].startsWith("MDS") == false && versInfo[0].startsWith("Nexus") == false) {
ServiceError svcError = NetworkDeviceControllerException.errors.doConnectFailedNotMds(network.getLabel());
result = BiosCommandResult.createErrorResult(svcError);
}
} catch (Exception ex) {
ServiceError svcError = NetworkDeviceControllerException.errors.doConnectFailed(network.getLabel());
result = BiosCommandResult.createErrorResult(svcError);
} finally {
disconnect(dialog);
}
_log.info("Connetwork to NetworkSystem " + (result.isCommandSuccess() ? "successful " : "failed ") + result.getMessage());
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class MdsNetworkSystemDevice method addAliases.
@Override
public BiosCommandResult addAliases(NetworkSystem network, List<ZoneWwnAlias> addingAliases, String fabricId, String fabricWwn) throws NetworkDeviceControllerException {
BiosCommandResult result = null;
MDSDialog dialog = null;
Map<String, String> addedAliasesName = new HashMap<String, String>();
try {
dialog = setUpDialog(network);
if (!addingAliases.isEmpty()) {
addedAliasesName.putAll(addAliasesStrategy(dialog, addingAliases));
}
String msg = "Successfully added aliases: " + addedAliasesName.toString();
if (!hasResult(addedAliasesName, SUCCESS)) {
msg = "Network System: " + network.getLabel() + ": No aliases were added";
}
_log.info(msg);
result = getBiosCommandResult(addedAliasesName);
} catch (Exception ex) {
_log.error("Cannot add aliases: " + (ex.getCause() != null ? ex.getCause().getMessage() : ex.getLocalizedMessage()));
throw ex;
} finally {
disconnect(dialog);
}
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class MdsNetworkSystemDevice method updateAliases.
@Override
public BiosCommandResult updateAliases(NetworkSystem network, List<ZoneWwnAliasUpdate> updatingAliases, String fabricId, String fabricWwn) throws NetworkDeviceControllerException {
BiosCommandResult result = null;
MDSDialog dialog = null;
Map<String, String> updatedAliasesName = new HashMap<String, String>();
try {
dialog = setUpDialog(network);
if (!updatingAliases.isEmpty()) {
updatedAliasesName.putAll(updateAliasesStrategy(dialog, updatingAliases));
}
String msg = "Successfully updated aliases: " + updatedAliasesName.toString();
if (!hasResult(updatedAliasesName, SUCCESS)) {
msg = "Network System: " + network.getLabel() + ": No aliases were updated";
}
_log.info(msg);
result = getBiosCommandResult(updatedAliasesName);
} catch (Exception ex) {
_log.error("Cannot updated aliases: " + (ex.getCause() != null ? ex.getCause().getMessage() : ex.getLocalizedMessage()));
throw ex;
} finally {
disconnect(dialog);
}
return result;
}
Aggregations