Search in sources :

Example 1 with ZoneHostInfo

use of com.cloud.consoleproxy.RunningHostInfoAgregator.ZoneHostInfo in project cosmic by MissionCriticalCloud.

the class ConsoleProxyManagerImpl method isZoneReady.

public boolean isZoneReady(final Map<Long, ZoneHostInfo> zoneHostInfoMap, final long dataCenterId) {
    final ZoneHostInfo zoneHostInfo = zoneHostInfoMap.get(dataCenterId);
    if (zoneHostInfo != null && isZoneHostReady(zoneHostInfo)) {
        final VMTemplateVO template = this._templateDao.findSystemVMReadyTemplate(dataCenterId, HypervisorType.Any);
        if (template == null) {
            logger.debug("System vm template is not ready at data center " + dataCenterId + ", wait until it is ready to launch console proxy vm");
            return false;
        }
        final TemplateDataStoreVO templateHostRef = this._vmTemplateStoreDao.findByTemplateZoneDownloadStatus(template.getId(), dataCenterId, VMTemplateStatus.DOWNLOADED);
        if (templateHostRef != null) {
            boolean useLocalStorage = false;
            final Boolean useLocal = ConfigurationManagerImpl.SystemVMUseLocalStorage.valueIn(dataCenterId);
            if (useLocal != null) {
                useLocalStorage = useLocal.booleanValue();
            }
            final List<Pair<Long, Integer>> l = this._consoleProxyDao.getDatacenterStoragePoolHostInfo(dataCenterId, useLocalStorage);
            if (l != null && l.size() > 0 && l.get(0).second().intValue() > 0) {
                return true;
            } else {
                logger.debug("Primary storage is not ready, wait until it is ready to launch console proxy");
            }
        } else {
            logger.debug("Zone host is ready, but console proxy template: " + template.getId() + " is not ready on secondary storage.");
        }
    }
    return false;
}
Also used : ZoneHostInfo(com.cloud.consoleproxy.RunningHostInfoAgregator.ZoneHostInfo) VMTemplateVO(com.cloud.storage.VMTemplateVO) TemplateDataStoreVO(com.cloud.storage.datastore.db.TemplateDataStoreVO) Pair(com.cloud.legacymodel.utils.Pair)

Example 2 with ZoneHostInfo

use of com.cloud.consoleproxy.RunningHostInfoAgregator.ZoneHostInfo in project cosmic by MissionCriticalCloud.

the class SecondaryStorageManagerImpl method isZoneReady.

public boolean isZoneReady(final Map<Long, ZoneHostInfo> zoneHostInfoMap, final long dataCenterId) {
    final ZoneHostInfo zoneHostInfo = zoneHostInfoMap.get(dataCenterId);
    if (zoneHostInfo != null && (zoneHostInfo.getFlags() & RunningHostInfoAgregator.ZoneHostInfo.ROUTING_HOST_MASK) != 0) {
        final VMTemplateVO template = this._templateDao.findSystemVMReadyTemplate(dataCenterId, HypervisorType.Any);
        if (template == null) {
            logger.debug("System vm template is not ready at data center " + dataCenterId + ", wait until it is ready to launch secondary storage vm");
            return false;
        }
        final List<DataStore> stores = this._dataStoreMgr.getImageStoresByScope(new ZoneScope(dataCenterId));
        if (stores.size() < 1) {
            logger.debug("No image store added  in zone " + dataCenterId + ", wait until it is ready to launch secondary storage vm");
            return false;
        }
        final DataStore store = this.templateMgr.getImageStore(dataCenterId, template.getId());
        if (store == null) {
            logger.debug("No secondary storage available in zone " + dataCenterId + ", wait until it is ready to launch secondary storage vm");
            return false;
        }
        boolean useLocalStorage = false;
        final Boolean useLocal = ConfigurationManagerImpl.SystemVMUseLocalStorage.valueIn(dataCenterId);
        if (useLocal != null) {
            useLocalStorage = useLocal.booleanValue();
        }
        final List<Pair<Long, Integer>> l = this._storagePoolHostDao.getDatacenterStoragePoolHostInfo(dataCenterId, !useLocalStorage);
        if (l != null && l.size() > 0 && l.get(0).second().intValue() > 0) {
            return true;
        } else {
            logger.debug("Primary storage is not ready, wait until it is ready to launch secondary storage vm. dcId: " + dataCenterId + ", " + ConfigurationManagerImpl.SystemVMUseLocalStorage.key() + ": " + useLocalStorage + ". " + "If you want to use local storage to start SSVM, need to set " + ConfigurationManagerImpl.SystemVMUseLocalStorage.key() + " to true");
        }
    }
    return false;
}
Also used : ZoneScope(com.cloud.engine.subsystem.api.storage.ZoneScope) ZoneHostInfo(com.cloud.consoleproxy.RunningHostInfoAgregator.ZoneHostInfo) DataStore(com.cloud.engine.subsystem.api.storage.DataStore) VMTemplateVO(com.cloud.storage.VMTemplateVO) Pair(com.cloud.legacymodel.utils.Pair)

Aggregations

ZoneHostInfo (com.cloud.consoleproxy.RunningHostInfoAgregator.ZoneHostInfo)2 Pair (com.cloud.legacymodel.utils.Pair)2 VMTemplateVO (com.cloud.storage.VMTemplateVO)2 DataStore (com.cloud.engine.subsystem.api.storage.DataStore)1 ZoneScope (com.cloud.engine.subsystem.api.storage.ZoneScope)1 TemplateDataStoreVO (com.cloud.storage.datastore.db.TemplateDataStoreVO)1