From ba249c0e669bbdbbf26a047d0b2f1a24b9671b8d Mon Sep 17 00:00:00 2001 From: Edison Su Date: Tue, 19 Mar 2013 14:45:17 -0700 Subject: [PATCH] CLOUDSTACK-1608: enable attach a volume created on zone wide storage to a vm created on cluster or host wide storage --- server/src/com/cloud/storage/VolumeManagerImpl.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java index eb33bc4de26..a23ea3294f1 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) {