This is an automated email from the ASF dual-hosted git repository.
sureshanaparti pushed a commit to branch 4.22
in repository https://gitbox.apache.org/repos/asf/cloudstack.git
The following commit(s) were added to refs/heads/4.22 by this push:
new a8c8c18e56a xenserver/xcpng: do not bypass secondary storage when copy
volumes between pools (#13750)
a8c8c18e56a is described below
commit a8c8c18e56a0ba1ea2f3cbe6d6434d0b908331f5
Author: Wei Zhou <[email protected]>
AuthorDate: Thu Sep 17 11:33:31 2026 +0200
xenserver/xcpng: do not bypass secondary storage when copy volumes between
pools (#13750)
---
.../storage/motion/AncientDataMotionStrategy.java | 8 ++++++++
.../storage/motion/AncientDataMotionStrategyTest.java | 15 +++++++++++++++
2 files changed, 23 insertions(+)
diff --git
a/engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
b/engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index 8145158dfa4..c1bcc8ddb9a 100644
---
a/engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++
b/engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -472,7 +472,15 @@ public class AncientDataMotionStrategy implements
DataMotionStrategy {
return true;
}
+ if (Hypervisor.HypervisorType.XenServer.equals(((VolumeInfo)
srcData).getHypervisorType())) {
+ return false;
+ }
+
if (destData instanceof VolumeInfo) {
+ if (Hypervisor.HypervisorType.XenServer.equals(((VolumeInfo)
destData).getHypervisorType())) {
+ return false;
+ }
+
Scope srcDataStoreScope = srcData.getDataStore().getScope();
Scope destDataStoreScope = destData.getDataStore().getScope();
logger.info("srcDataStoreScope: {}, srcData pool type: {};
destDataStoreScope: {}, destData pool type: {}",
diff --git
a/engine/storage/datamotion/src/test/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategyTest.java
b/engine/storage/datamotion/src/test/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategyTest.java
index e167cc0a965..d7ec53702c8 100755
---
a/engine/storage/datamotion/src/test/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategyTest.java
+++
b/engine/storage/datamotion/src/test/java/org/apache/cloudstack/storage/motion/AncientDataMotionStrategyTest.java
@@ -123,6 +123,7 @@ public class AncientDataMotionStrategyTest {
@Test
public void testCanBypassSecondaryStorageForUnsupportedDataObject() throws
NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
TemplateObject destTemplateInfo = Mockito.spy(new TemplateObject());
@@ -136,12 +137,14 @@ public class AncientDataMotionStrategyTest {
@Test
public void testCanBypassSecondaryStorageForUnsupportedSrcPoolType()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
{
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.PowerFlex).when(srcVolumeInfo).getStoragePoolType();
VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
@@ -157,12 +160,14 @@ public class AncientDataMotionStrategyTest {
@Test
public void testCanBypassSecondaryStorageForUnsupportedDestPoolType()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
{
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.NetworkFilesystem).when(srcVolumeInfo).getStoragePoolType();
VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
@@ -178,12 +183,14 @@ public class AncientDataMotionStrategyTest {
@Test
public void testCanBypassSecondaryStorageWithZoneWideNFSPoolsInSameZone()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
{
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.NetworkFilesystem).when(srcVolumeInfo).getStoragePoolType();
VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
@@ -199,12 +206,14 @@ public class AncientDataMotionStrategyTest {
@Test
public void
testCanBypassSecondaryStorageWithClusterWideNFSPoolsInSameCluster() throws
NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ClusterScope(5L, 2L,
1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.NetworkFilesystem).when(srcVolumeInfo).getStoragePoolType();
VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ClusterScope(5L, 2L,
1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
@@ -220,12 +229,14 @@ public class AncientDataMotionStrategyTest {
@Test
public void
testCanBypassSecondaryStorageWithLocalAndClusterWideNFSPoolsInSameCluster()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
{
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new HostScope(1L, 1L,
1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.Filesystem).when(srcVolumeInfo).getStoragePoolType();
VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ClusterScope(1L, 1L,
1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
@@ -244,12 +255,14 @@ public class AncientDataMotionStrategyTest {
@Test
public void
testCanBypassSecondaryStorageWithLocalAndZoneWideNFSPoolsInSameZone() throws
NoSuchMethodException, InvocationTargetException, IllegalAccessException {
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new HostScope(1L, 1L,
1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.Filesystem).when(srcVolumeInfo).getStoragePoolType();
VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();
@@ -268,12 +281,14 @@ public class AncientDataMotionStrategyTest {
@Test
public void
testCanBypassSecondaryStorageWithClusterWideNFSAndZoneWideNFSPoolsInSameZone()
throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
{
VolumeObject srcVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(srcVolumeInfo).getHypervisorType();
DataStore srcDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ClusterScope(5L, 2L,
1L)).when(srcDataStore).getScope();
Mockito.doReturn(srcDataStore).when(srcVolumeInfo).getDataStore();
Mockito.doReturn(Storage.StoragePoolType.NetworkFilesystem).when(srcVolumeInfo).getStoragePoolType();
VolumeObject destVolumeInfo = Mockito.spy(new VolumeObject());
+
Mockito.doReturn(HypervisorType.KVM).when(destVolumeInfo).getHypervisorType();
DataStore destDataStore = Mockito.mock(DataStore.class);
Mockito.doReturn(new ZoneScope(1L)).when(destDataStore).getScope();
Mockito.doReturn(destDataStore).when(destVolumeInfo).getDataStore();