use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeBlockSnapshotCreateJob in project coprhd-controller by CoprHD.
the class VNXeSnapshotOperation method createSingleVolumeSnapshot.
@Override
public void createSingleVolumeSnapshot(StorageSystem storage, URI snapshot, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
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);
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob job = apiClient.createLunSnap(volume.getNativeId(), snapLabelToUse);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new VNXeBlockSnapshotCreateJob(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("CreateVolumeSnapshot", ex.getMessage());
taskCompleter.error(_dbClient, error);
}
}
use of com.emc.storageos.volumecontroller.impl.vnxe.job.VNXeBlockSnapshotCreateJob in project coprhd-controller by CoprHD.
the class VNXUnitySnapshotOperations method createSingleVolumeSnapshot.
@Override
public void createSingleVolumeSnapshot(StorageSystem storage, URI snapshot, Boolean createInactive, Boolean readOnly, TaskCompleter taskCompleter) throws DeviceControllerException {
try {
BlockSnapshot snapshotObj = _dbClient.queryObject(BlockSnapshot.class, snapshot);
if (readOnly) {
snapshotObj.setIsReadOnly(readOnly);
_dbClient.updateObject(snapshotObj);
}
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);
VNXeApiClient apiClient = getVnxeClient(storage);
VNXeCommandJob job = apiClient.createSnap(volume.getNativeId(), snapLabelToUse, readOnly);
if (job != null) {
ControllerServiceImpl.enqueueJob(new QueueJob(new VNXeBlockSnapshotCreateJob(job.getId(), storage.getId(), !createInactive, taskCompleter)));
}
} catch (Exception ex) {
log.error("Create volume snapshot got the exception", ex);
ServiceError error = DeviceControllerErrors.vnxe.jobFailed("CreateVolumeSnapshot", ex.getMessage());
taskCompleter.error(_dbClient, error);
}
}
Aggregations