|
34 | 34 | import org.apache.commons.lang.StringUtils; |
35 | 35 | import org.apache.log4j.Logger; |
36 | 36 | import org.springframework.stereotype.Component; |
37 | | - |
38 | 37 | import org.apache.cloudstack.api.BaseCmd; |
39 | 38 | import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd; |
40 | 39 | import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd; |
|
49 | 48 | import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; |
50 | 49 | import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; |
51 | 50 | import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; |
| 51 | +import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; |
52 | 52 | import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; |
53 | 53 | import org.apache.cloudstack.engine.subsystem.api.storage.Scope; |
54 | 54 | import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; |
@@ -1589,6 +1589,18 @@ private boolean needMoveVolume(VolumeVO rootVolumeOfVm, VolumeInfo volume) { |
1589 | 1589 | } |
1590 | 1590 |
|
1591 | 1591 | if (storeForRootStoreScope.getScopeType() != storeForDataStoreScope.getScopeType()) { |
| 1592 | + if (storeForDataStoreScope.getScopeType() == ScopeType.CLUSTER && storeForRootStoreScope.getScopeType() == ScopeType.HOST) { |
| 1593 | + HostScope hs = (HostScope)storeForRootStoreScope; |
| 1594 | + if (storeForDataStoreScope.getScopeId().equals(hs.getClusterId())) { |
| 1595 | + return false; |
| 1596 | + } |
| 1597 | + } |
| 1598 | + if (storeForRootStoreScope.getScopeType() == ScopeType.CLUSTER && storeForDataStoreScope.getScopeType() == ScopeType.HOST) { |
| 1599 | + HostScope hs = (HostScope)storeForDataStoreScope; |
| 1600 | + if (storeForRootStoreScope.getScopeId().equals(hs.getClusterId())) { |
| 1601 | + return false; |
| 1602 | + } |
| 1603 | + } |
1592 | 1604 | throw new CloudRuntimeException("Can't move volume between scope: " + storeForDataStoreScope.getScopeType() + " and " + storeForRootStoreScope.getScopeType()); |
1593 | 1605 | } |
1594 | 1606 |
|
|
0 commit comments