bug 8096: secondary storage vm doesn't have to be UP when we do attachIso/startVm from iso

status 8096: resolved fixed
This commit is contained in:
alena 2011-01-19 10:36:58 -08:00
parent 46c55529e1
commit 2f608c31a4
3 changed files with 13 additions and 3 deletions

View File

@ -40,7 +40,8 @@ public interface HostDao extends GenericDao<HostVO, Long> {
List<HostVO> listByDataCenter(long dcId);
List<HostVO> listByHostPod(long podId);
List<HostVO> listByStatus(Status... status);
List<HostVO> listBy(Host.Type type, long dcId);
List<HostVO> listBy(Host.Type type, long dcId);
List<HostVO> listAllBy(Host.Type type, long dcId);
HostVO findSecondaryStorageHost(long dcId);
List<HostVO> listByCluster(long clusterId);
/**

View File

@ -311,6 +311,15 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
sc.setParameters("status", Status.Up.toString());
return listBy(sc);
}
@Override
public List<HostVO> listAllBy(Host.Type type, long dcId) {
SearchCriteria<HostVO> sc = TypeDcStatusSearch.create();
sc.setParameters("type", type.toString());
sc.setParameters("dc", dcId);
return listBy(sc);
}
@Override

View File

@ -1089,7 +1089,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
public Pair<String, String> getAbsoluteIsoPath(long templateId, long dataCenterId) {
String isoPath = null;
List<HostVO> storageHosts = _hostDao.listBy(Host.Type.SecondaryStorage, dataCenterId);
List<HostVO> storageHosts = _hostDao.listAllBy(Host.Type.SecondaryStorage, dataCenterId);
if (storageHosts != null) {
for (HostVO storageHost : storageHosts) {
VMTemplateHostVO templateHostVO = _vmTemplateHostDao.findByHostTemplate(storageHost.getId(), templateId);
@ -1099,7 +1099,7 @@ public class StorageManagerImpl implements StorageManager, StorageService, Manag
}
}
}
s_logger.warn("Unable to find secondary storage in zone id=" + dataCenterId);
return null;
}