Updated Branches:
  refs/heads/master c60ef7932 -> ba249c0e6

CLOUDSTACK-1608: enable attach a volume created on zone wide storage to a vm 
created on cluster or host wide storage


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

Branch: refs/heads/master
Commit: ba249c0e669bbdbbf26a047d0b2f1a24b9671b8d
Parents: c60ef79
Author: Edison Su <sudi...@gmail.com>
Authored: Tue Mar 19 14:45:17 2013 -0700
Committer: Edison Su <sudi...@gmail.com>
Committed: Tue Mar 19 14:45:17 2013 -0700

----------------------------------------------------------------------
 .../src/com/cloud/storage/VolumeManagerImpl.java   |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/ba249c0e/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java 
b/server/src/com/cloud/storage/VolumeManagerImpl.java
index eb33bc4..a23ea32 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -1453,11 +1453,15 @@ public class VolumeManagerImpl extends ManagerBase 
implements VolumeManager {
             throw new CloudRuntimeException("Can't get scope of data store: " 
+ storeForDataVol.getId());
         }
         
+        if (storeForDataStoreScope.getScopeType() == ScopeType.ZONE) {
+            return false;
+        }
+        
         if (storeForRootStoreScope.getScopeType() != 
storeForDataStoreScope.getScopeType()) {
             throw new CloudRuntimeException("Can't move volume between scope: 
" + storeForDataStoreScope.getScopeType() + " and " + 
storeForRootStoreScope.getScopeType());
         }
        
-        return storeForRootStoreScope.isSameScope(storeForRootStoreScope);
+        return !storeForRootStoreScope.isSameScope(storeForDataStoreScope);
     }
     
     private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volume, 
Long deviceId) {

Reply via email to