Updated Branches: refs/heads/object_store cd2d066fd -> bb6467271
Fix ImageStoreDaoImpl to return only image stores, not image cache stores. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/582a1f05 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/582a1f05 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/582a1f05 Branch: refs/heads/object_store Commit: 582a1f0539869290d65d4a05b7ccf2897205f859 Parents: cd2d066 Author: Min Chen <[email protected]> Authored: Thu Apr 11 11:54:30 2013 -0700 Committer: Min Chen <[email protected]> Committed: Thu Apr 11 11:54:30 2013 -0700 ---------------------------------------------------------------------- .../storage/image/db/ImageStoreDaoImpl.java | 10 ++++++++-- .../cloud/storage/download/DownloadListener.java | 11 +++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/582a1f05/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java ---------------------------------------------------------------------- diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java index 5bcf2f3..ee07822 100644 --- a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java +++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageStoreDaoImpl.java @@ -24,6 +24,7 @@ import java.util.Map; import javax.naming.ConfigurationException; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; import org.apache.cloudstack.engine.subsystem.api.storage.Scope; import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; import org.apache.cloudstack.storage.datastore.db.ImageStoreDao; @@ -50,10 +51,12 @@ public class ImageStoreDaoImpl extends GenericDaoBase<ImageStoreVO, Long> implem nameSearch = createSearchBuilder(); nameSearch.and("name", nameSearch.entity().getName(), SearchCriteria.Op.EQ); + nameSearch.and("role", nameSearch.entity().getRole(), SearchCriteria.Op.EQ); nameSearch.done(); providerSearch = createSearchBuilder(); providerSearch.and("providerName", providerSearch.entity().getProviderName(), SearchCriteria.Op.EQ); + providerSearch.and("role", providerSearch.entity().getProviderName(), SearchCriteria.Op.EQ); providerSearch.done(); return true; @@ -76,8 +79,11 @@ public class ImageStoreDaoImpl extends GenericDaoBase<ImageStoreVO, Long> implem @Override public List<ImageStoreVO> findByScope(ZoneScope scope) { SearchCriteria<ImageStoreVO> sc = createSearchCriteria(); - sc.addOr("scope", SearchCriteria.Op.EQ, ScopeType.REGION); - sc.addOr("dcId", SearchCriteria.Op.EQ, scope.getScopeId()); + sc.addAnd("role", SearchCriteria.Op.EQ, DataStoreRole.Image); + SearchCriteria<ImageStoreVO> scc = createSearchCriteria(); + scc.addOr("scope", SearchCriteria.Op.EQ, ScopeType.REGION); + scc.addOr("dcId", SearchCriteria.Op.EQ, scope.getScopeId()); + sc.addAnd("scope", SearchCriteria.Op.SC, scc); return listBy(sc); } http://git-wip-us.apache.org/repos/asf/cloudstack/blob/582a1f05/server/src/com/cloud/storage/download/DownloadListener.java ---------------------------------------------------------------------- diff --git a/server/src/com/cloud/storage/download/DownloadListener.java b/server/src/com/cloud/storage/download/DownloadListener.java index 2741af1..8e979ab 100755 --- a/server/src/com/cloud/storage/download/DownloadListener.java +++ b/server/src/com/cloud/storage/download/DownloadListener.java @@ -474,17 +474,20 @@ public class DownloadListener implements Listener { @Override public void processConnect(HostVO agent, StartupCommand cmd, boolean forRebalance) throws ConnectionException { if (cmd instanceof StartupRoutingCommand) { + downloadMonitor.handleSysTemplateDownload(agent); - } else if ( cmd instanceof StartupStorageCommand) { + } + /* This can be removed since + else if ( cmd instanceof StartupStorageCommand) { StartupStorageCommand storage = (StartupStorageCommand)cmd; if( storage.getResourceType() == Storage.StorageResourceType.SECONDARY_STORAGE || storage.getResourceType() == Storage.StorageResourceType.LOCAL_SECONDARY_STORAGE ) { downloadMonitor.addSystemVMTemplatesToHost(agent, storage.getTemplateInfo()); - // DO we need to do sync here since we have been doing sync in StartupSecondaryStorageCommand? - // downloadMonitor.handleTemplateSync(agent); + downloadMonitor.handleTemplateSync(agent); downloadMonitor.handleVolumeSync(agent); } - } else if ( cmd instanceof StartupSecondaryStorageCommand ) { + }*/ + else if ( cmd instanceof StartupSecondaryStorageCommand ) { downloadMonitor.handleSync(agent.getDataCenterId()); } }
