@@ -818,7 +818,7 @@ public void testSelectInstanceConversionTemporaryLocationInvalidStorage() {
818818
819819 long poolId = 1L ;
820820 when (primaryDataStoreDao .findById (poolId )).thenReturn (null );
821- unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , poolId );
821+ unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , null , poolId );
822822 }
823823
824824 @ Test (expected = CloudRuntimeException .class )
@@ -829,17 +829,32 @@ public void testSelectInstanceConversionTemporaryLocationPoolInvalidScope() {
829829 Mockito .when (pool .getScope ()).thenReturn (ScopeType .CLUSTER );
830830 Mockito .when (pool .getClusterId ()).thenReturn (100L );
831831 when (primaryDataStoreDao .findById (poolId )).thenReturn (pool );
832- unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , poolId );
832+ unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , null , poolId );
833833 }
834834
835+
836+ @ Test (expected = CloudRuntimeException .class )
837+ public void testSelectInstanceConversionTemporaryLocationPoolConvertHostDifferentCluster () {
838+ ClusterVO cluster = getClusterForTests ();
839+ long poolId = 1L ;
840+ StoragePoolVO pool = mock (StoragePoolVO .class );
841+ Mockito .when (pool .getScope ()).thenReturn (ScopeType .CLUSTER );
842+ Mockito .when (pool .getClusterId ()).thenReturn (1L );
843+ HostVO host = mock (HostVO .class );
844+ when (primaryDataStoreDao .findById (poolId )).thenReturn (pool );
845+ when (host .getClusterId ()).thenReturn (2L );
846+ unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , host , poolId );
847+ }
848+
849+
835850 @ Test (expected = CloudRuntimeException .class )
836851 public void testSelectInstanceConversionTemporaryLocationLocalStoragePoolInvalid () {
837852 ClusterVO cluster = getClusterForTests ();
838853 long poolId = 1L ;
839854 StoragePoolVO pool = mock (StoragePoolVO .class );
840855 Mockito .when (pool .getScope ()).thenReturn (ScopeType .HOST );
841856 when (primaryDataStoreDao .findById (poolId )).thenReturn (pool );
842- unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , poolId );
857+ unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , null , poolId );
843858 }
844859
845860 @ Test (expected = CloudRuntimeException .class )
@@ -851,13 +866,13 @@ public void testSelectInstanceConversionTemporaryLocationStoragePoolInvalidType(
851866 Mockito .when (pool .getClusterId ()).thenReturn (1L );
852867 when (primaryDataStoreDao .findById (poolId )).thenReturn (pool );
853868 Mockito .when (pool .getPoolType ()).thenReturn (Storage .StoragePoolType .RBD );
854- unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , poolId );
869+ unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , null , poolId );
855870 }
856871
857872 @ Test (expected = CloudRuntimeException .class )
858873 public void testSelectInstanceConversionTemporaryLocationNoPoolAvailable () {
859874 ClusterVO cluster = getClusterForTests ();
860875 Mockito .when (imageStoreDao .findOneByZoneAndProtocol (anyLong (), anyString ())).thenReturn (null );
861- unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , null );
876+ unmanagedVMsManager .selectInstanceConversionTemporaryLocation (cluster , null , null );
862877 }
863878}
0 commit comments