use of com.cloud.storage.dao.SnapshotDetailsVO in project cloudstack by apache.
the class SolidFirePrimaryDataStoreDriver method revertSnapshot.
@Override
public void revertSnapshot(SnapshotInfo snapshot, SnapshotInfo snapshot2, AsyncCompletionCallback<CommandResult> callback) {
VolumeInfo volumeInfo = snapshot.getBaseVolume();
VolumeVO volumeVO = volumeDao.findById(volumeInfo.getId());
if (volumeVO == null || volumeVO.getRemoved() != null) {
String errMsg = "The volume that the snapshot belongs to no longer exists.";
CommandResult commandResult = new CommandResult();
commandResult.setResult(errMsg);
callback.complete(commandResult);
return;
}
SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(volumeVO.getPoolId(), storagePoolDetailsDao);
long sfVolumeId = Long.parseLong(volumeInfo.getFolder());
SnapshotDetailsVO snapshotDetails = snapshotDetailsDao.findDetail(snapshot.getId(), SolidFireUtil.SNAPSHOT_ID);
long sfSnapshotId = Long.parseLong(snapshotDetails.getValue());
SolidFireUtil.rollBackVolumeToSnapshot(sfConnection, sfVolumeId, sfSnapshotId);
SolidFireUtil.SolidFireVolume sfVolume = SolidFireUtil.getVolume(sfConnection, sfVolumeId);
updateVolumeDetails(volumeVO.getId(), sfVolume.getTotalSize(), sfVolume.getScsiNaaDeviceId());
CommandResult commandResult = new CommandResult();
callback.complete(commandResult);
}
use of com.cloud.storage.dao.SnapshotDetailsVO in project cloudstack by apache.
the class SolidFirePrimaryDataStoreDriver method updateSnapshotDetails.
private void updateSnapshotDetails(long csSnapshotId, long csVolumeId, long sfVolumeId, long sfNewSnapshotId, long storagePoolId, long sfNewVolumeSize) {
SnapshotDetailsVO snapshotDetail = new SnapshotDetailsVO(csSnapshotId, SolidFireUtil.ORIG_CS_VOLUME_ID, String.valueOf(csVolumeId), false);
snapshotDetailsDao.persist(snapshotDetail);
snapshotDetail = new SnapshotDetailsVO(csSnapshotId, SolidFireUtil.VOLUME_ID, String.valueOf(sfVolumeId), false);
snapshotDetailsDao.persist(snapshotDetail);
snapshotDetail = new SnapshotDetailsVO(csSnapshotId, SolidFireUtil.SNAPSHOT_ID, String.valueOf(sfNewSnapshotId), false);
snapshotDetailsDao.persist(snapshotDetail);
snapshotDetail = new SnapshotDetailsVO(csSnapshotId, SolidFireUtil.STORAGE_POOL_ID, String.valueOf(storagePoolId), false);
snapshotDetailsDao.persist(snapshotDetail);
snapshotDetail = new SnapshotDetailsVO(csSnapshotId, SolidFireUtil.VOLUME_SIZE, String.valueOf(sfNewVolumeSize), false);
snapshotDetailsDao.persist(snapshotDetail);
}
use of com.cloud.storage.dao.SnapshotDetailsVO in project cloudstack by apache.
the class SolidFireIntegrationTestUtil method getSnapshotDetails.
public List<ApiVolumeSnapshotDetailsResponse> getSnapshotDetails(String snapshotUuid) {
SnapshotVO snapshot = snapshotDao.findByUuid(snapshotUuid);
if (snapshot == null) {
throw new CloudRuntimeException("Unable to find Volume for ID: " + snapshotUuid);
}
List<SnapshotDetailsVO> snapshotDetails = snapshotDetailsDao.listDetails(snapshot.getId());
List<ApiVolumeSnapshotDetailsResponse> responses = new ArrayList<>();
if (snapshotDetails != null) {
for (SnapshotDetailsVO snapshotDetail : snapshotDetails) {
ApiVolumeSnapshotDetailsResponse response = new ApiVolumeSnapshotDetailsResponse(snapshotDetail.getResourceId(), snapshotDetail.getName(), snapshotDetail.getValue());
responses.add(response);
}
}
return responses;
}
Aggregations