Fix ImageStoreDaoImpl to return only image stores, not image cache

stores.
This commit is contained in:
Min Chen 2013-04-11 11:54:30 -07:00
parent cd2d066fda
commit 582a1f0539
2 changed files with 15 additions and 6 deletions

View File

@ -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);
}

View File

@ -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());
}
}