From 7f12876be1cc3abc810ced54d1e575f56fd271f8 Mon Sep 17 00:00:00 2001 From: anthony Date: Tue, 22 Mar 2011 11:23:36 -0700 Subject: [PATCH] bug 9087: destroy the source volume, after update the volume entry status 9087: resolved fixed --- .../src/com/cloud/storage/StorageManagerImpl.java | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java index 37f8bb6984a..8cec0c118cb 100755 --- a/server/src/com/cloud/storage/StorageManagerImpl.java +++ b/server/src/com/cloud/storage/StorageManagerImpl.java @@ -1373,15 +1373,24 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag String destPrimaryStorageVolumePath = cvAnswer.getVolumePath(); String destPrimaryStorageVolumeFolder = cvAnswer.getVolumeFolder(); - - expungeVolume(volume); + // Delete the volume on the source storage pool + final DestroyCommand cmd = new DestroyCommand(srcPool, volume, null); volume.setPath(destPrimaryStorageVolumePath); volume.setFolder(destPrimaryStorageVolumeFolder); volume.setPodId(destPool.getPodId()); volume.setPoolId(destPool.getId()); _volsDao.update(volume.getId(), volume); - + + Answer destroyAnswer = null; + try { + destroyAnswer = sendToPool(srcPool, cmd); + } catch (StorageUnavailableException e1) { + throw new CloudRuntimeException("Failed to destroy the volume from the source primary storage pool to secondary storage."); + } + if (destroyAnswer == null || !destroyAnswer.getResult()) { + throw new CloudRuntimeException("Failed to destroy the volume from the source primary storage pool to secondary storage."); + } return _volsDao.findById(volume.getId()); }