use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeBlockCreateCGSnapshotJob in project coprhd-controller by CoprHD.
the class VNXeSnapshotOperation method createGroupSnapshots.
@Override
public void createGroupSnapshots(StorageSystem storage, List<URI> snapshotList, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
URI snapshot = snapshotList.get(0);
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
Volume volume = _dbClient.queryObject(Volume.class, snapshotObj.getParent());
TenantOrg tenant = _dbClient.queryObject(TenantOrg.class, volume.getTenant().getURI());
String tenantName = tenant.getLabel();
String snapLabelToUse = _nameGenerator.generate(tenantName, snapshotObj.getLabel(), snapshot.toString(), '-', SmisConstants.MAX_SNAPSHOT_NAME_LENGTH);
String groupName = getConsistencyGroupName(snapshotObj);
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob job = apiClient.createLunGroupSnap(groupName, snapLabelToUse);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new VNXeBlockCreateCGSnapshotJob(job.getId(), storage.getId(), !createInactive, taskCompleter)));
}
} catch (VNXeException e) {
_log.error("Create volume snapshot got the exception", e);
taskCompleter.error(_dbClient, e);
} catch (Exception ex) {
_log.error("Create volume snapshot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateCGSnapshot", ex.getMessage());
taskCompleter.error(_dbClient, error);
}
}
Aggregations