rg9975 commented on code in PR #7889:
URL: https://github.com/apache/cloudstack/pull/7889#discussion_r1374810666
##########
engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java:
##########
@@ -1701,13 +1797,32 @@ private void createVolumeFromSnapshot(SnapshotInfo
snapshotInfo) {
* invocation of createVolumeFromSnapshot(SnapshotInfo).
*/
private void deleteVolumeFromSnapshot(SnapshotInfo snapshotInfo) {
- SnapshotDetailsVO snapshotDetails =
handleSnapshotDetails(snapshotInfo.getId(), "delete");
+ VolumeVO volumeVO = null;
+ // cleanup any temporary volume previously created for copy from a
snapshot
+ if
("true".equalsIgnoreCase(snapshotInfo.getDataStore().getDriver().getCapabilities().get("CAN_CREATE_TEMP_VOLUME_FROM_SNAPSHOT")))
{
+ SnapshotDetailsVO tempUuid = null;
+ tempUuid = _snapshotDetailsDao.findDetail(snapshotInfo.getId(),
"TemporaryVolumeCopyUUID");
+ if (tempUuid == null || tempUuid.getValue() == null) {
+ return;
+ }
- try {
-
snapshotInfo.getDataStore().getDriver().createAsync(snapshotInfo.getDataStore(),
snapshotInfo, null);
+ volumeVO = _volumeDao.findByUuid(tempUuid.getValue());
+ if (volumeVO != null) {
+ _volumeDao.remove(volumeVO.getId());
+ }
+ _snapshotDetailsDao.remove(tempUuid.getId());
+ _snapshotDetailsDao.removeDetail(snapshotInfo.getId(),
"TemporaryVolumeCopyUUID");
}
- finally {
- _snapshotDetailsDao.remove(snapshotDetails.getId());
+ // fallback to original behavior of sending magic command to a create
function to delete :)
Review Comment:
Updated in upcoming commit.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]