use of com.emc.storageos.storagedriver.model.VolumeMirror.SynchronizationState in project coprhd-controller by CoprHD.
the class DellSCDiscovery method getVolumeMirrors.
/**
* Gets all mirrors of a volume.
*
* @param storageVolume The volume.
* @return The mirrors.
*/
public List<VolumeMirror> getVolumeMirrors(StorageVolume storageVolume) {
LOG.info("Getting mirrors for volume {}", storageVolume.getNativeId());
List<VolumeMirror> result = new ArrayList<>();
try {
StorageCenterAPI api = connectionManager.getConnection(storageVolume.getStorageSystemId());
ScVolume scVolume = api.getVolume(storageVolume.getNativeId());
if (scVolume != null && scVolume.cmmSource) {
ScCopyMirrorMigrate[] cmms = api.getVolumeCopyMirrorMigrate(scVolume.instanceId);
for (ScCopyMirrorMigrate cmm : cmms) {
if ("Mirror".equals(cmm.type)) {
ScVolume targetVol = api.getVolume(cmm.destinationVolume.instanceId);
VolumeMirror mirror = new VolumeMirror();
mirror.setAccessStatus(AccessStatus.READ_WRITE);
mirror.setDeviceLabel(targetVol.name);
mirror.setDisplayName(targetVol.name);
mirror.setNativeId(targetVol.instanceId);
mirror.setParentId(cmm.sourceVolume.instanceId);
mirror.setStorageSystemId(storageVolume.getStorageSystemId());
SynchronizationState syncState = SynchronizationState.SYNCHRONIZED;
if (cmm.percentComplete != 100) {
syncState = SynchronizationState.COPYINPROGRESS;
}
mirror.setSyncState(syncState);
mirror.setWwn(targetVol.deviceId);
result.add(mirror);
}
}
}
} catch (DellSCDriverException e) {
String msg = String.format("Error getting mirrors for volume %s", storageVolume.getNativeId(), e);
LOG.warn(msg);
}
return result;
}
Aggregations