Bug 8966 - Oracle VM (OVM) support

OCFS2 support -- use ComponentLocater to load OCFS2 manager
This commit is contained in:
frank 2011-08-08 13:30:15 -07:00
parent c6fba0fd42
commit c881bae64e
3 changed files with 26 additions and 2 deletions

4
server/src/com/cloud/host/dao/HostDao.java Normal file → Executable file
View File

@ -165,5 +165,7 @@ public interface HostDao extends GenericDao<HostVO, Long> {
long countRoutingHostsByDataCenter(long dcId);
List<HostVO> listSecondaryStorageHosts(long dataCenterId);
List<HostVO> listSecondaryStorageHosts(long dataCenterId);
List<HostVO> listByInAllStatus(Type type, Long clusterId, Long podId, long dcId);
}

17
server/src/com/cloud/host/dao/HostDaoImpl.java Normal file → Executable file
View File

@ -332,6 +332,23 @@ public class HostDaoImpl extends GenericDaoBase<HostVO, Long> implements HostDao
return listBy(sc);
}
@Override
public List<HostVO> listByInAllStatus(Host.Type type, Long clusterId, Long podId, long dcId) {
SearchCriteria<HostVO> sc = TypePodDcStatusSearch.create();
if ( type != null ) {
sc.setParameters("type", type.toString());
}
if (clusterId != null) {
sc.setParameters("cluster", clusterId);
}
if (podId != null ) {
sc.setParameters("pod", podId);
}
sc.setParameters("dc", dcId);
return listBy(sc);
}
@Override
public List<HostVO> listBy(Long clusterId, Long podId, long dcId) {
SearchCriteria<HostVO> sc = TypePodDcStatusSearch.create();

View File

@ -32,22 +32,27 @@ import com.cloud.exception.ConnectionException;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.server.ManagementService;
import com.cloud.storage.OCFS2Manager;
import com.cloud.storage.StorageManagerImpl;
import com.cloud.storage.StoragePoolVO;
import com.cloud.storage.Storage.StoragePoolType;
import com.cloud.storage.dao.StoragePoolDao;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.component.Inject;
public class StoragePoolMonitor implements Listener {
private static final Logger s_logger = Logger.getLogger(StoragePoolMonitor.class);
private final StorageManagerImpl _storageManager;
private final StoragePoolDao _poolDao;
@Inject OCFS2Manager _ocfs2Mgr;
OCFS2Manager _ocfs2Mgr;
public StoragePoolMonitor(StorageManagerImpl mgr, StoragePoolDao poolDao) {
this._storageManager = mgr;
this._poolDao = poolDao;
ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
this._ocfs2Mgr = locator.getManager(OCFS2Manager.class);
}