You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by pr...@apache.org on 2012/07/23 23:53:32 UTC

[1/2] git commit: CS-15279

Updated Branches:
  refs/heads/master 9e5fb17e3 -> 88f7872b8


CS-15279

Issue happens when ROOT volume gets created and there is subsequent failure in starting the VM. During retry if allocator assigns a different storage pool the scenario was not handled. Now in case of local storage the volume get recreated on the newly assigned pool and old one gets cleaned up. In case of shared storage the existing volume is migrated to new storage 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/88f7872b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/88f7872b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/88f7872b

Branch: refs/heads/master
Commit: 88f7872b81c824d2a547d6ca03b95261188c2857
Parents: c60e4b4
Author: Koushik Das <ko...@citrix.com>
Authored: Mon Jul 23 14:46:56 2012 -0700
Committer: prachi <pr...@cloud.com>
Committed: Mon Jul 23 14:49:04 2012 -0700

----------------------------------------------------------------------
 .../src/com/cloud/storage/StorageManagerImpl.java  |   21 ++++++++++++--
 1 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/88f7872b/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 27d8cb7..d94bada 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -3210,10 +3210,25 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
                     } else {
                         if (assignedPool.getId() != vol.getPoolId()) {
                             if (s_logger.isDebugEnabled()) {
-                                s_logger.debug("Volume " + vol + " is not recreatable! Cannot recreate on storagepool: " + assignedPool);
+                                s_logger.debug("Mismatch in storage pool " + assignedPool + " assigned by deploymentPlanner and the one associated with volume " + vol);
+                            }
+                            if (vm.getServiceOffering().getUseLocalStorage())
+                            {
+                                if (s_logger.isDebugEnabled()) {
+                                    s_logger.debug("Local volume " + vol + " will be recreated on storage pool " + assignedPool + " assigned by deploymentPlanner");
+                                }
+                                recreateVols.add(vol);
+                            } else {
+                                if (s_logger.isDebugEnabled()) {
+                                    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));
+                                } catch (ConcurrentOperationException e) {
+                                    throw new StorageUnavailableException("Volume migration failed for " + vol, Volume.class, vol.getId());
+                                }
                             }
-                            throw new StorageUnavailableException("Volume is not recreatable, Unable to create " + vol, Volume.class, vol.getId());
-                            // copy volume usecase - not yet developed.
                         } else {
                             StoragePoolVO pool = _storagePoolDao.findById(vol.getPoolId());
                             vm.addDisk(new VolumeTO(vol, pool));