You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/08/12 19:25:13 UTC

[2/3] git commit: CS-15621: Using migrateVolumes method which does not perform input validation. Some input validation in the migrateVolume method prevented migration of volume in READY state. Also using volume disk offering to check if it is a local or

CS-15621: Using migrateVolumes method which does not perform input validation. Some input validation in the migrateVolume method prevented migration of volume in READY state. Also using volume disk offering to check if it is a local or shared one.

Verified on XS 6.0.2

Test scenario
- Created 2 shared primary storage pools
- Created data volume using shared disk offering
- Attached it to a running VM (created in one storage pool)
- Detached it (now it is in READY state)
- Created a new VM in stopped state (using deployVirtualMachine API with startVm=false)
- Attached the data volume to this new VM
- Started new VM (migrated volume scenario got hit when the planner assigned the other shared pool)


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/ff773a81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/ff773a81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/ff773a81

Branch: refs/heads/vpc
Commit: ff773a812227f7e851e79cc11b49d66ad278101a
Parents: 9adf91f
Author: Koushik Das <Ko...@citrix.com>
Authored: Sun Aug 12 17:05:28 2012 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Sun Aug 12 17:05:28 2012 +0530

----------------------------------------------------------------------
 .../src/com/cloud/storage/StorageManagerImpl.java  |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ff773a81/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index c17379f..b9e775d 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -3241,7 +3241,8 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
                             if (s_logger.isDebugEnabled()) {
                                 s_logger.debug("Mismatch in storage pool " + assignedPool + " assigned by deploymentPlanner and the one associated with volume " + vol);
                             }
-                            if (vm.getServiceOffering().getUseLocalStorage())
+                            DiskOfferingVO diskOffering = _diskOfferingDao.findById(vol.getDiskOfferingId());
+                            if (diskOffering.getUseLocalStorage())
                             {
                                 if (s_logger.isDebugEnabled()) {
                                     s_logger.debug("Local volume " + vol + " will be recreated on storage pool " + assignedPool + " assigned by deploymentPlanner");
@@ -3252,10 +3253,12 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
                                     s_logger.debug("Shared volume " + vol + " will be migrated on storage pool " + assignedPool + " assigned by deploymentPlanner");
                                 }
                                 try {
-                                    Volume migratedVol = migrateVolume(vol.getId(), assignedPool.getId());
-                                    vm.addDisk(new VolumeTO(migratedVol, assignedPool));
+                                    List<Volume> volumesToMigrate = new ArrayList<Volume>();
+                                    volumesToMigrate.add(vol);
+                                    migrateVolumes(volumesToMigrate, assignedPool);
+                                    vm.addDisk(new VolumeTO(vol, assignedPool));
                                 } catch (ConcurrentOperationException e) {
-                                    throw new StorageUnavailableException("Volume migration failed for " + vol, Volume.class, vol.getId());
+                                    throw new CloudRuntimeException("Migration of volume " + vol + " to storage pool " + assignedPool + " failed", e);
                                 }
                             }
                         } else {