2525import com .cloud .storage .ScopeType ;
2626import com .cloud .storage .Storage ;
2727import com .cloud .storage .VMTemplateStoragePoolVO ;
28- import com .cloud .storage .VMTemplateStorageResourceAssoc ;
2928import com .cloud .storage .VolumeVO ;
3029import com .cloud .storage .VolumeDetailVO ;
3130import com .cloud .storage .dao .VMTemplatePoolDao ;
@@ -681,7 +680,6 @@ void testGetBytesRequiredForTemplate_AlreadyCached_ReturnsZero() {
681680 when (templateInfo .getId ()).thenReturn (50L );
682681 when (storagePoolDetailsDao .listDetailsKeyPairs (1L )).thenReturn (storagePoolDetails );
683682 when (vmTemplatePoolDao .findByPoolTemplate (1L , 50L , null )).thenReturn (templatePoolRef );
684- when (templatePoolRef .getDownloadState ()).thenReturn (VMTemplateStorageResourceAssoc .Status .DOWNLOADED );
685683 when (templatePoolRef .getState ()).thenReturn (ObjectInDataStoreStateMachine .State .Ready );
686684 when (templatePoolRef .getLocalDownloadPath ()).thenReturn ("template-lun-uuid" );
687685
@@ -700,25 +698,24 @@ void testGetBytesRequiredForTemplate_NotCached_ReturnsVirtualSize() {
700698 }
701699
702700 @ Test
703- void testGetBytesRequiredForTemplate_SpoolRefNotDownloaded_ReturnsVirtualSize () {
701+ void testGetBytesRequiredForTemplate_SpoolRefNotReady_ReturnsVirtualSize () {
704702 when (storagePool .getId ()).thenReturn (1L );
705703 when (templateInfo .getId ()).thenReturn (50L );
706704 when (templateInfo .getSize ()).thenReturn (5368709120L );
707705 when (storagePoolDetailsDao .listDetailsKeyPairs (1L )).thenReturn (storagePoolDetails );
708706 when (vmTemplatePoolDao .findByPoolTemplate (1L , 50L , null )).thenReturn (templatePoolRef );
709- when (templatePoolRef .getDownloadState ()).thenReturn (VMTemplateStorageResourceAssoc . Status . NOT_DOWNLOADED );
707+ when (templatePoolRef .getState ()).thenReturn (ObjectInDataStoreStateMachine . State . Allocated );
710708
711709 assertEquals (5368709120L , driver .getBytesRequiredForTemplate (templateInfo , storagePool ));
712710 }
713711
714712 @ Test
715- void testGetBytesRequiredForTemplate_DownloadedWithoutBackendIdentity_ReturnsVirtualSize () {
713+ void testGetBytesRequiredForTemplate_ReadyWithoutBackendIdentity_ReturnsVirtualSize () {
716714 when (storagePool .getId ()).thenReturn (1L );
717715 when (templateInfo .getId ()).thenReturn (50L );
718716 when (templateInfo .getSize ()).thenReturn (5368709120L );
719717 when (storagePoolDetailsDao .listDetailsKeyPairs (1L )).thenReturn (storagePoolDetails );
720718 when (vmTemplatePoolDao .findByPoolTemplate (1L , 50L , null )).thenReturn (templatePoolRef );
721- when (templatePoolRef .getDownloadState ()).thenReturn (VMTemplateStorageResourceAssoc .Status .DOWNLOADED );
722719 when (templatePoolRef .getState ()).thenReturn (ObjectInDataStoreStateMachine .State .Ready );
723720 when (templatePoolRef .getLocalDownloadPath ()).thenReturn (null );
724721
@@ -732,7 +729,6 @@ void testGetBytesRequiredForTemplate_NfsCached_ReturnsZero() {
732729 when (templateInfo .getId ()).thenReturn (50L );
733730 when (storagePoolDetailsDao .listDetailsKeyPairs (1L )).thenReturn (storagePoolDetails );
734731 when (vmTemplatePoolDao .findByPoolTemplate (1L , 50L , null )).thenReturn (templatePoolRef );
735- when (templatePoolRef .getDownloadState ()).thenReturn (VMTemplateStorageResourceAssoc .Status .DOWNLOADED );
736732 when (templatePoolRef .getState ()).thenReturn (ObjectInDataStoreStateMachine .State .Ready );
737733 when (templatePoolRef .getInstallPath ()).thenReturn ("/mnt/pool/template-uuid" );
738734
0 commit comments