CLOUDSTACK-8101: volume sync not working as expected - MS restart during upload volume leaves volume in hung state.
(cherry picked from commit e559b15b6a166e2eb5f9b044338295fe8c9d219d) Signed-off-by: Rohit Yadav <[email protected]> Conflicts: engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ff70ef79 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ff70ef79 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ff70ef79 Branch: refs/heads/4.5 Commit: ff70ef797caac3cdaa71bb82c360c6b8f2ab83b9 Parents: 1aeaf4d Author: Min Chen <[email protected]> Authored: Fri Dec 19 16:48:45 2014 -0800 Committer: Rohit Yadav <[email protected]> Committed: Tue Jan 20 11:43:36 2015 +0530 ---------------------------------------------------------------------- .../org/apache/cloudstack/storage/volume/VolumeServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ff70ef79/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java index 88f098c..1dd2a86 100644 --- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java @@ -1383,7 +1383,8 @@ public class VolumeServiceImpl implements VolumeService { return; } - List<VolumeDataStoreVO> dbVolumes = _volumeStoreDao.listUploadedVolumesByStoreId(storeId); + // find all the db volumes including those with NULL url column to avoid accidentally deleting volumes on image store later. + List<VolumeDataStoreVO> dbVolumes = _volumeStoreDao.listByStoreId(storeId); List<VolumeDataStoreVO> toBeDownloaded = new ArrayList<VolumeDataStoreVO>(dbVolumes); for (VolumeDataStoreVO volumeStore : dbVolumes) { VolumeVO volume = volDao.findById(volumeStore.getVolumeId());
