use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.
the class SRDFAddPairToGroupCompleter method complete.
@Override
public void complete(final DbClient dbClient, final Operation.Status status, final ServiceCoded coded) throws DeviceControllerException {
log.info("Completing with status: {}", status);
setDbClient(dbClient);
try {
switch(status) {
case ready:
for (Volume source : getVolumes()) {
if (null != vpoolChangeURI) {
source.setVirtualPool(vpoolChangeURI);
dbClient.persistObject(source);
log.info("Updating virtual Pool {} to sourceVlume {}", vpoolChangeURI, source.getNativeGuid());
}
}
default:
log.info("Unable to handle status: {}", status);
}
} catch (Exception e) {
log.info("Failed to update status for task {}", getOpId(), e);
} finally {
super.complete(dbClient, status, coded);
}
}
use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.
the class SRDFChangeCopyModeTaskCompleter method complete.
@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
try {
setDbClient(dbClient);
switch(status) {
case ready:
RemoteDirectorGroup rdfGrp = null;
for (Volume target : tgtVolumes) {
target.setSrdfCopyMode(newCopyMode);
dbClient.persistObject(target);
log.info(String.format("SRDF Device source %s and target %s copy mode got changed into %s", target.getSrdfParent().toString(), target.getId().toString(), newCopyMode));
if (rdfGrp == null) {
rdfGrp = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
}
}
if (rdfGrp != null) {
rdfGrp.setSupportedCopyMode(newCopyMode);
dbClient.persistObject(rdfGrp);
log.info("RDF Group {} copy mode got changed into : {}", rdfGrp.getId(), newCopyMode);
}
break;
default:
log.info("Unable to handle SRDF Link Change Copy Mode Operational status: {}", status);
}
} catch (Exception e) {
log.error("Failed change copy mode. SRDFMirror {}, for task " + getOpId(), getId(), e);
} finally {
super.complete(dbClient, status, coded);
}
}
use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.
the class SRDFMirrorCreateCompleter method complete.
@Override
public void complete(final DbClient dbClient, final Operation.Status status, final ServiceCoded coded) throws DeviceControllerException {
log.info("Completing with status: {}", status);
setDbClient(dbClient);
try {
switch(status) {
case ready:
if (null != vpoolChangeURI) {
// updating source volumes with changed vPool
URI previousVPool = null;
for (Volume volume : getVolumes()) {
if (volume.isSRDFSource()) {
previousVPool = volume.getVirtualPool();
volume.setVirtualPool(vpoolChangeURI);
dbClient.updateObject(volume);
}
}
SRDFOperationContext.insertContextOperation(this, CHANGE_VPOOL_ON_SOURCE, previousVPool, vpoolChangeURI);
}
// Pin the target System with the source CG, which helps to identify this system is
// a target R2 for CG.
Volume target = getTargetVolume();
if (null != sourceCGUri) {
URI targetSystemUri = target.getStorageController();
StorageSystem targetSystem = dbClient.queryObject(StorageSystem.class, targetSystemUri);
if (targetSystem.getTargetCgs() == null) {
targetSystem.setTargetCgs(new StringSet());
}
targetSystem.getTargetCgs().add(sourceCGUri.toString());
dbClient.updateObject(targetSystem);
}
String copyMode = target.getSrdfCopyMode();
RemoteDirectorGroup group = dbClient.queryObject(RemoteDirectorGroup.class, target.getSrdfGroup());
log.info("Setting copyMode {} to RAGroup {}", copyMode, group.getId());
group.setSupportedCopyMode(copyMode);
group.setSourceReplicationGroupName(sourceRepGroup);
group.setTargetReplicationGroupName(targetRepGroup);
if (null == group.getVolumes()) {
group.setVolumes(new StringSet());
}
group.getVolumes().addAll(getVolumeIds());
dbClient.updateObject(group);
break;
default:
log.info("Unable to handle status: {}", status);
}
recordSRDFOperation(dbClient, OperationTypeEnum.CREATE_SRDF_LINK, status, getSourceVolume().getId().toString(), getTargetVolume().getId().toString());
} catch (Exception e) {
log.info("Failed to update status for task {}", getOpId(), e);
} finally {
super.complete(dbClient, status, coded);
}
}
use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.
the class StoragePortGroupCreateCompleter method complete.
@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
try {
StoragePortGroup portGroup = dbClient.queryObject(StoragePortGroup.class, getId());
if (status == Status.ready && portGroup != null) {
URI systemURI = portGroup.getStorageDevice();
StorageSystem storage = dbClient.queryObject(StorageSystem.class, systemURI);
portGroup.setNativeGuid(String.format("%s+%s", storage.getNativeGuid(), portGroup.getLabel()));
portGroup.setInactive(false);
dbClient.updateObject(portGroup);
dbClient.ready(StoragePortGroup.class, getId(), getOpId());
} else if (status == Status.error) {
log.error("The status is error, remove the storage port group");
portGroup.setInactive(true);
dbClient.error(StoragePortGroup.class, getId(), getOpId(), coded);
dbClient.removeObject(portGroup);
}
} catch (Exception e) {
log.error("Failed updating status", e);
} finally {
updateWorkflowStatus(status, coded);
}
}
use of com.emc.storageos.exceptions.DeviceControllerException in project coprhd-controller by CoprHD.
the class StoragePortGroupDeleteCompleter method complete.
@Override
protected void complete(DbClient dbClient, Status status, ServiceCoded coded) throws DeviceControllerException {
try {
StoragePortGroup portGroup = dbClient.queryObject(StoragePortGroup.class, getId());
if (status == Status.ready && portGroup != null) {
dbClient.ready(StoragePortGroup.class, getId(), getOpId());
dbClient.removeObject(portGroup);
} else if (status == Status.error) {
log.error("The status is error.");
dbClient.error(StoragePortGroup.class, getId(), getOpId(), coded);
}
} catch (Exception e) {
log.error("Failed updating status", e);
} finally {
updateWorkflowStatus(status, coded);
}
}
Aggregations