|
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; |
@@ -399,7 +398,7 @@ public void handleTemplateSync(DataStore store) { |
399 | 398 | } else { |
400 | 399 | s_logger.info("Template Sync did not find " + uniqueName + " on image store " + storeId + ", may request download based on available hypervisor types"); |
401 | 400 | if (tmpltStore != null) { |
402 | | - if (isRegionStore(store) && tmpltStore.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED |
| 401 | + if (_storeMgr.isRegionStore(store) && tmpltStore.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED |
403 | 402 | && tmpltStore.getState() == State.Ready |
404 | 403 | && tmpltStore.getInstallPath() == null) { |
405 | 404 | s_logger.info("Keep fake entry in template store table for migration of previous NFS to object store"); |
@@ -440,7 +439,7 @@ public void handleTemplateSync(DataStore store) { |
440 | 439 |
|
441 | 440 | // if this is a region store, and there is already an DOWNLOADED entry there without install_path information, which |
442 | 441 | // means that this is a duplicate entry from migration of previous NFS to staging. |
443 | | - if (isRegionStore(store)) { |
| 442 | + if (_storeMgr.isRegionStore(store)) { |
444 | 443 | TemplateDataStoreVO tmpltStore = _vmTemplateStoreDao.findByStoreTemplate(storeId, tmplt.getId()); |
445 | 444 | if (tmpltStore != null && tmpltStore.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED && tmpltStore.getState() == State.Ready |
446 | 445 | && tmpltStore.getInstallPath() == null) { |
@@ -700,18 +699,11 @@ protected Void syncTemplateCallBack(AsyncCallbackDispatcher<TemplateServiceImpl, |
700 | 699 | return null; |
701 | 700 | } |
702 | 701 |
|
703 | | - private boolean isRegionStore(DataStore store) { |
704 | | - if (store.getScope().getScopeType() == ScopeType.ZONE && store.getScope().getScopeId() == null) |
705 | | - return true; |
706 | | - else |
707 | | - return false; |
708 | | - } |
709 | | - |
710 | 702 | // This routine is used to push templates currently on cache store, but not in region store to region store. |
711 | 703 | // used in migrating existing NFS secondary storage to S3. |
712 | 704 | @Override |
713 | 705 | public void syncTemplateToRegionStore(long templateId, DataStore store) { |
714 | | - if (isRegionStore(store)) { |
| 706 | + if (_storeMgr.isRegionStore(store)) { |
715 | 707 | // if template is on region wide object store, check if it is really downloaded there (by checking install_path). Sync template to region |
716 | 708 | // wide store if it is not there physically. |
717 | 709 | TemplateInfo tmplOnStore = _templateFactory.getTemplate(templateId, store); |
|
0 commit comments