|
75 | 75 | import com.cloud.exception.ResourceAllocationException; |
76 | 76 | import com.cloud.hypervisor.Hypervisor.HypervisorType; |
77 | 77 | import com.cloud.storage.DataStoreRole; |
78 | | -import com.cloud.storage.ScopeType; |
79 | 78 | import com.cloud.storage.Storage.TemplateType; |
80 | 79 | import com.cloud.storage.StoragePool; |
81 | 80 | import com.cloud.storage.VMTemplateStorageResourceAssoc; |
@@ -394,7 +393,7 @@ public void handleTemplateSync(DataStore store) { |
394 | 393 | s_logger.info("Template Sync did not find " + uniqueName + " on image store " + storeId + |
395 | 394 | ", may request download based on available hypervisor types"); |
396 | 395 | if (tmpltStore != null) { |
397 | | - if (isRegionStore(store) && tmpltStore.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED |
| 396 | + if (_storeMgr.isRegionStore(store) && tmpltStore.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED |
398 | 397 | && tmpltStore.getState() == State.Ready |
399 | 398 | && tmpltStore.getInstallPath() == null) { |
400 | 399 | s_logger.info("Keep fake entry in template store table for migration of previous NFS to object store"); |
@@ -435,7 +434,7 @@ public void handleTemplateSync(DataStore store) { |
435 | 434 |
|
436 | 435 | // if this is a region store, and there is already an DOWNLOADED entry there without install_path information, which |
437 | 436 | // means that this is a duplicate entry from migration of previous NFS to staging. |
438 | | - if (isRegionStore(store)) { |
| 437 | + if (_storeMgr.isRegionStore(store)) { |
439 | 438 | TemplateDataStoreVO tmpltStore = _vmTemplateStoreDao.findByStoreTemplate(storeId, tmplt.getId()); |
440 | 439 | if (tmpltStore != null && tmpltStore.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED && tmpltStore.getState() == State.Ready |
441 | 440 | && tmpltStore.getInstallPath() == null) { |
@@ -685,18 +684,11 @@ protected Void syncTemplateCallBack(AsyncCallbackDispatcher<TemplateServiceImpl, |
685 | 684 | return null; |
686 | 685 | } |
687 | 686 |
|
688 | | - private boolean isRegionStore(DataStore store) { |
689 | | - if (store.getScope().getScopeType() == ScopeType.ZONE && store.getScope().getScopeId() == null) |
690 | | - return true; |
691 | | - else |
692 | | - return false; |
693 | | - } |
694 | | - |
695 | 687 | // This routine is used to push templates currently on cache store, but not in region store to region store. |
696 | 688 | // used in migrating existing NFS secondary storage to S3. |
697 | 689 | @Override |
698 | 690 | public void syncTemplateToRegionStore(long templateId, DataStore store) { |
699 | | - if (isRegionStore(store)) { |
| 691 | + if (_storeMgr.isRegionStore(store)) { |
700 | 692 | // if template is on region wide object store, check if it is really downloaded there (by checking install_path). Sync template to region |
701 | 693 | // wide store if it is not there physically. |
702 | 694 | TemplateInfo tmplOnStore = _templateFactory.getTemplate(templateId, store); |
|
0 commit comments