From 6eacec782e21cccfe6660529d4871f0e1399a7f0 Mon Sep 17 00:00:00 2001 From: abhishek Date: Mon, 20 Dec 2010 14:50:50 -0800 Subject: [PATCH] bug 7528: the vm expunge action wasn't destroying the volumes during vm destroy. Added logic to do that. Also, made sure the volumes are removed during vm expunge status 7528: resolved fixed --- server/src/com/cloud/storage/StorageManager.java | 4 +++- server/src/com/cloud/storage/StorageManagerImpl.java | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/storage/StorageManager.java b/server/src/com/cloud/storage/StorageManager.java index abff9b97278..1a18fe7c377 100755 --- a/server/src/com/cloud/storage/StorageManager.java +++ b/server/src/com/cloud/storage/StorageManager.java @@ -278,5 +278,7 @@ public interface StorageManager extends Manager { void prepare(VirtualMachineProfile vm, DeployDestination dest) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException; - void release(VirtualMachineProfile vm); + //void release(VirtualMachineProfile vm); + + void release(VirtualMachineProfile profile); } diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index e4af3c4f8ea..d009491b53c 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -2881,8 +2881,13 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag } @Override - public void release(VirtualMachineProfile profile) { - // Right now we don't do anything. + public void release(VirtualMachineProfile profile) { + //Clean up volumes based on the profile's instance id + List volumesForProfile = _volsDao.findByInstance(profile.getId()); + + for(VolumeVO vol : volumesForProfile){ + destroyVolume(vol); + } } }