use of org.ovirt.engine.core.common.businessentities.VDSDomainsData in project ovirt-engine by oVirt.
the class VdsManager method afterRefreshTreatment.
public void afterRefreshTreatment(boolean succeeded) {
if (!succeeded) {
lockManager.releaseLock(monitoringLock);
return;
}
try {
synchronized (this) {
unrespondedAttempts.set(0);
setLastUpdate();
Guid storagePoolId = null;
ArrayList<VDSDomainsData> domainsList = null;
try {
hostMonitoring.afterRefreshTreatment();
// the storage anymore (so there is no sense in updating the domains list in that case).
if (cachedVds != null && cachedVds.getStatus() != VDSStatus.Maintenance) {
storagePoolId = cachedVds.getStoragePoolId();
domainsList = cachedVds.getDomains();
}
hostMonitoring = null;
} catch (IRSErrorException ex) {
logAfterRefreshFailureMessage(ex);
if (log.isDebugEnabled()) {
logException(ex);
}
} catch (RuntimeException ex) {
logAfterRefreshFailureMessage(ex);
logException(ex);
}
// synchronized part of code
if (domainsList != null) {
updateVdsDomainsData(cachedVds, storagePoolId, domainsList);
}
}
} catch (Exception e) {
log.error("Timer update runtime info failed. Exception:", ExceptionUtils.getRootCauseMessage(e));
log.debug("Exception:", e);
} finally {
lockManager.releaseLock(monitoringLock);
}
}
use of org.ovirt.engine.core.common.businessentities.VDSDomainsData in project ovirt-engine by oVirt.
the class VdsBrokerObjectsBuilder method updateVDSDomainData.
private static void updateVDSDomainData(VDS vds, Map<String, Object> struct) {
if (struct.containsKey(VdsProperties.domains)) {
Map<String, Object> domains = (Map<String, Object>) struct.get(VdsProperties.domains);
ArrayList<VDSDomainsData> domainsData = new ArrayList<>();
for (Map.Entry<String, ?> value : domains.entrySet()) {
try {
VDSDomainsData data = new VDSDomainsData();
data.setDomainId(new Guid(value.getKey().toString()));
Map<String, Object> internalValue = (Map<String, Object>) value.getValue();
double lastCheck = 0;
data.setCode((Integer) internalValue.get(VdsProperties.code));
if (internalValue.containsKey(VdsProperties.lastCheck)) {
lastCheck = Double.parseDouble((String) internalValue.get(VdsProperties.lastCheck));
}
data.setLastCheck(lastCheck);
double delay = 0;
if (internalValue.containsKey(VdsProperties.delay)) {
delay = Double.parseDouble((String) internalValue.get(VdsProperties.delay));
}
data.setDelay(delay);
Boolean actual = Boolean.TRUE;
if (internalValue.containsKey(VdsProperties.actual)) {
actual = (Boolean) internalValue.get(VdsProperties.actual);
}
data.setActual(actual);
domainsData.add(data);
} catch (Exception e) {
log.error("failed building domains: {}", e.getMessage());
log.debug("Exception", e);
}
}
vds.setDomains(domainsData);
}
}
use of org.ovirt.engine.core.common.businessentities.VDSDomainsData in project ovirt-engine by oVirt.
the class IrsProxy method handleMonitoredDomainsForHost.
/**
* Provides handling for the domains that are monitored by the given host.
* @return map between the domain id and the reason for domains that
* the host reporting is problematic for.
*/
private Map<Guid, DomainMonitoringResult> handleMonitoredDomainsForHost(final Guid vdsId, final String vdsName, final ArrayList<VDSDomainsData> data, Collection<Guid> monitoredDomains) {
Map<Guid, DomainMonitoringResult> domainsProblematicReportInfo = new HashMap<>();
// build a list of all domains in pool
// which are in status Active or Unknown
Set<Guid> activeDomainsInPool = new HashSet<>(storageDomainStaticDao.getAllIds(storagePoolId, StorageDomainStatus.Active));
Set<Guid> unknownDomainsInPool = new HashSet<>(storageDomainStaticDao.getAllIds(storagePoolId, StorageDomainStatus.Unknown));
Set<Guid> inActiveDomainsInPool = new HashSet<>(storageDomainStaticDao.getAllIds(storagePoolId, StorageDomainStatus.Inactive));
// visible by the host.
for (Guid tempDomainId : activeDomainsInPool) {
if (!monitoredDomains.contains(tempDomainId)) {
domainsProblematicReportInfo.put(tempDomainId, DomainMonitoringResult.NOT_REPORTED);
}
}
for (Guid tempDomainId : unknownDomainsInPool) {
if (!monitoredDomains.contains(tempDomainId)) {
domainsProblematicReportInfo.put(tempDomainId, DomainMonitoringResult.NOT_REPORTED);
}
}
Collection<Guid> storageDomainsToSync = new LinkedList<>();
// Unknown domains in pool
for (VDSDomainsData tempData : data) {
StorageDomainStatic storageDomain = storageDomainStaticDao.get(tempData.getDomainId());
if (activeDomainsInPool.contains(tempData.getDomainId()) || unknownDomainsInPool.contains(tempData.getDomainId())) {
DomainMonitoringResult domainMonitoringResult = analyzeDomainReport(tempData, false);
if (domainMonitoringResult.invalidAndActual()) {
domainsProblematicReportInfo.put(tempData.getDomainId(), domainMonitoringResult);
} else if (domainMonitoringResult.actual() && tempData.getDelay() > Config.<Double>getValue(ConfigValues.MaxStorageVdsDelayCheckSec)) {
logDelayedDomain(vdsName, storageDomain.getName(), tempData.getDelay());
}
} else if (inActiveDomainsInPool.contains(tempData.getDomainId()) && analyzeDomainReport(tempData, false).validAndActual()) {
log.warn("Storage Domain '{}' was reported by Host '{}' as Active in Pool '{}', moving to active status", getDomainIdTuple(tempData.getDomainId()), vdsName, storagePoolId);
StoragePoolIsoMap map = storagePoolIsoMapDao.get(new StoragePoolIsoMapId(tempData.getDomainId(), storagePoolId));
map.setStatus(StorageDomainStatus.Active);
storagePoolIsoMapDao.update(map);
if (storageDomain.getStorageType().isBlockDomain()) {
storageDomainsToSync.add(storageDomain.getId());
}
}
}
// For block domains, synchronize LUN details comprising the storage domain with the DB
if (!storageDomainsToSync.isEmpty()) {
getEventListener().syncStorageDomainsLuns(vdsId, storageDomainsToSync);
}
return domainsProblematicReportInfo;
}
use of org.ovirt.engine.core.common.businessentities.VDSDomainsData in project ovirt-engine by oVirt.
the class IrsProxy method obtainDomainsReportedAsProblematic.
public List<Guid> obtainDomainsReportedAsProblematic(List<VDSDomainsData> vdsDomainsData) {
List<Guid> domainsInProblem = new LinkedList<>();
Set<Guid> domainsInPool = new HashSet<>(storageDomainStaticDao.getAllIds(storagePoolId, StorageDomainStatus.Active));
domainsInPool.addAll(storageDomainStaticDao.getAllIds(storagePoolId, StorageDomainStatus.Unknown));
List<Guid> domainWhichWereSeen = new ArrayList<>();
for (VDSDomainsData vdsDomainData : vdsDomainsData) {
if (domainsInPool.contains(vdsDomainData.getDomainId())) {
if (analyzeDomainReport(vdsDomainData, true).invalidAndActual()) {
domainsInProblem.add(vdsDomainData.getDomainId());
}
domainWhichWereSeen.add(vdsDomainData.getDomainId());
}
}
domainsInPool.removeAll(domainWhichWereSeen);
if (domainsInPool.size() > 0) {
for (Guid domainId : domainsInPool) {
log.error("Domain '{}' is not seen by Host", domainId);
}
domainsInProblem.addAll(domainsInPool);
}
return domainsInProblem;
}
use of org.ovirt.engine.core.common.businessentities.VDSDomainsData in project ovirt-engine by oVirt.
the class IrsProxy method updateVdsDomainsData.
public void updateVdsDomainsData(VDS vds, final ArrayList<VDSDomainsData> data) {
if (!shouldProcessVdsDomainReport(vds)) {
return;
}
StoragePool storagePool = storagePoolDao.get(storagePoolId);
if (storagePool != null && (storagePool.getStatus() == StoragePoolStatus.Up || storagePool.getStatus() == StoragePoolStatus.NonResponsive)) {
Guid vdsId = vds.getId();
String vdsName = vds.getName();
try {
Set<Guid> monitoredDomains = new HashSet<>();
for (VDSDomainsData tempData : data) {
monitoredDomains.add(tempData.getDomainId());
}
Map<Guid, DomainMonitoringResult> domainsProblematicReportInfo = Collections.emptyMap();
if (StoragePoolDomainHelper.vdsDomainsActiveMonitoringStatus.contains(vds.getStatus())) {
domainsProblematicReportInfo = handleMonitoredDomainsForHost(vdsId, vdsName, data, monitoredDomains);
}
Set<Guid> domainsInMaintenance = Collections.emptySet();
if (StoragePoolDomainHelper.vdsDomainsMaintenanceMonitoringStatus.contains(vds.getStatus())) {
domainsInMaintenance = handleDomainsInMaintenanceForHost(monitoredDomains);
}
updateDomainInProblem(vdsId, vdsName, domainsProblematicReportInfo, domainsInMaintenance);
} catch (RuntimeException ex) {
log.error("error in updateVdsDomainsData: {}", ex.getMessage());
log.debug("Exception", ex);
}
}
}
Aggregations