use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class NetworkDeviceController method updateSanZones.
@Override
public void updateSanZones(URI uri, String fabricId, String fabricWwn, List<ZoneUpdate> zones, boolean activateZones, String taskId) throws ControllerException {
NetworkSystem device = getNetworkSystemObject(uri);
// Lock to prevent concurrent operations on the same VSAN / FABRIC.
InterProcessLock fabricLock = NetworkFabricLocker.lockFabric(fabricId, _coordinator);
try {
// Get the file device reference for the type of file device managed
// by the controller.
NetworkSystemDevice networkDevice = getDevice(device.getSystemType());
if (networkDevice == null) {
throw NetworkDeviceControllerException.exceptions.updateSanZonesFailedNull(device.getSystemType());
}
BiosCommandResult result = networkDevice.updateZones(device, zones, fabricId, fabricWwn, activateZones);
setStatus(NetworkSystem.class, device.getId(), taskId, result.isCommandSuccess(), result.getServiceCoded());
_auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, OperationTypeEnum.UPDATE_SAN_ZONE, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL());
} catch (Exception ex) {
ServiceError serviceError = NetworkDeviceControllerException.errors.updateSanZonesFailedExc(device.getSystemType(), ex);
_dbClient.error(NetworkSystem.class, device.getId(), taskId, serviceError);
} finally {
NetworkFabricLocker.unlockFabric(fabricId, fabricLock);
}
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class NetworkDeviceController method addSanZones.
@Override
public void addSanZones(URI uri, String fabricId, String fabricWwn, List<Zone> zones, boolean activateZones, String taskId) throws ControllerException {
NetworkSystem device = getNetworkSystemObject(uri);
// Lock to prevent concurrent operations on the same VSAN / FABRIC.
InterProcessLock fabricLock = NetworkFabricLocker.lockFabric(fabricId, _coordinator);
try {
// Get the file device reference for the type of file device managed
// by the controller.
NetworkSystemDevice networkDevice = getDevice(device.getSystemType());
if (networkDevice == null) {
throw NetworkDeviceControllerException.exceptions.addSanZonesFailedNull(device.getSystemType());
}
BiosCommandResult result = networkDevice.addZones(device, zones, fabricId, fabricWwn, activateZones);
setStatus(NetworkSystem.class, device.getId(), taskId, result.isCommandSuccess(), result.getServiceCoded());
_auditMgr.recordAuditLog(null, null, EVENT_SERVICE_TYPE, OperationTypeEnum.ADD_SAN_ZONE, System.currentTimeMillis(), AuditLogManager.AUDITLOG_SUCCESS, AuditLogManager.AUDITOP_END, device.getId().toString(), device.getLabel(), device.getPortNumber(), device.getUsername(), device.getSmisProviderIP(), device.getSmisPortNumber(), device.getSmisUserName(), device.getSmisUseSSL());
} catch (Exception ex) {
ServiceError serviceError = NetworkDeviceControllerException.errors.addSanZonesFailedExc(device.getSystemType(), ex);
_dbClient.error(NetworkSystem.class, device.getId(), taskId, serviceError);
} finally {
NetworkFabricLocker.unlockFabric(fabricId, fabricLock);
}
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class NetworkSystemDeviceImpl method getBiosCommandResult.
protected BiosCommandResult getBiosCommandResult(Map<String, String> results) {
BiosCommandResult result = null;
if (hasResult(results, ERROR)) {
ServiceError serviceError = NetworkDeviceControllerException.errors.batchOperationFailed(toMessage(results));
result = BiosCommandResult.createErrorResult(serviceError);
} else {
result = BiosCommandResult.createSuccessfulResult();
}
result.setObjectList(Collections.singletonList((Object) results));
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class BrocadeNetworkSystemDevice method activateZones.
@Override
public BiosCommandResult activateZones(NetworkSystem networkSystem, String fabricId, String fabricWwn) throws NetworkDeviceControllerException {
BiosCommandResult result = null;
NetworkDeviceControllerException exception = null;
try {
WBEMClient client = getNetworkDeviceClient(networkSystem);
CIMInstance zonesetIns = _smisHelper.getActiveZonesetInstance(client, fabricId, fabricWwn);
if (zonesetIns != null) {
CIMObjectPath shadowZonesetPath = _smisHelper.getShadowZonesetPath(client, fabricId, fabricWwn, zonesetIns);
CIMInstance zoneServiceIns = _smisHelper.getZoneServiceInstance(client, fabricId, fabricWwn);
boolean activate = !_smisHelper.isEmptyZoneset(client, shadowZonesetPath);
if (_smisHelper.activateZoneSet(client, zoneServiceIns, zonesetIns.getObjectPath(), activate)) {
_log.info("The active zoneset for fabric " + fabricId + " was " + (activate ? "re-activated" : "deactivated"));
} else {
_log.error("Failed to re-activate zoneset");
exception = NetworkDeviceControllerException.exceptions.zonesetActivationFailed(fabricId, new Throwable());
}
} else {
exception = NetworkDeviceControllerException.exceptions.noActiveZonesetForFabric(fabricId);
}
result = BiosCommandResult.createSuccessfulResult();
} catch (Exception ex) {
_log.error("Cannot re-activate zoneset: " + ex.getLocalizedMessage());
exception = NetworkDeviceControllerException.exceptions.zonesetActivationFailed(fabricId, ex);
}
if (exception != null) {
throw exception;
}
return result;
}
use of com.emc.storageos.volumecontroller.impl.BiosCommandResult in project coprhd-controller by CoprHD.
the class BrocadeNetworkSystemDevice method removeZones.
public BiosCommandResult removeZones(NetworkSystem networkSystem, List<Zone> zones, String fabricId, String fabricWwn, boolean activateZones) throws NetworkDeviceControllerException {
BiosCommandResult result = null;
Map<String, String> removedZoneResults = new HashMap<String, String>();
try {
validateFabric(networkSystem, fabricWwn, fabricId);
Map<NetworkLite, List<Zone>> zonesPerFabric = getAllZonesForZones(zones, true, fabricId, fabricWwn);
for (NetworkLite network : zonesPerFabric.keySet()) {
WBEMClient client = getNetworkDeviceClient(networkSystem);
removedZoneResults.putAll(removeZonesStrategy(client, zonesPerFabric.get(network), network.getNativeId(), NetworkUtil.getNetworkWwn(network), activateZones));
}
result = getBiosCommandResult(removedZoneResults);
_log.info("Remove zone results {}", toMessage(removedZoneResults));
} catch (NetworkDeviceControllerException ex) {
_log.error("Cannot remove zones: " + ex.getLocalizedMessage());
throw ex;
}
return result;
}
Aggregations