Search in sources :

Example 6 with VdsStatistics

use of org.ovirt.engine.core.common.businessentities.VdsStatistics in project ovirt-engine by oVirt.

the class HostMonitoring method saveDataToDb.

private void saveDataToDb() {
    if (saveVdsDynamic) {
        vdsManager.updateDynamicData(vds.getDynamicData());
        if (refreshedCapabilities) {
            vdsManager.updateNumaData(vds);
        }
    }
    if (saveVdsStatistics) {
        VdsStatistics stat = vds.getStatisticsData();
        vdsManager.updateStatisticsData(stat);
        checkVdsMemoryThreshold(stat);
        checkVdsCpuThreshold(stat);
        checkVdsNetworkThreshold(stat);
        checkVdsSwapThreshold(stat);
        final List<VdsNetworkStatistics> statistics = new LinkedList<>();
        for (VdsNetworkInterface iface : vds.getInterfaces()) {
            statistics.add(iface.getStatistics());
        }
        if (!statistics.isEmpty()) {
            TransactionSupport.executeInScope(TransactionScopeOption.Required, () -> {
                getDbFacade().getInterfaceDao().massUpdateStatisticsForVds(statistics);
                return null;
            });
        }
        saveNumaStatisticsDataToDb();
    }
}
Also used : VdsNetworkStatistics(org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics) VdsNetworkInterface(org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface) VdsStatistics(org.ovirt.engine.core.common.businessentities.VdsStatistics) LinkedList(java.util.LinkedList)

Aggregations

VdsStatistics (org.ovirt.engine.core.common.businessentities.VdsStatistics)6 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 Statistic (org.ovirt.engine.api.model.Statistic)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 VdsNetworkInterface (org.ovirt.engine.core.common.businessentities.network.VdsNetworkInterface)1 VdsNetworkStatistics (org.ovirt.engine.core.common.businessentities.network.VdsNetworkStatistics)1 RandomUtils (org.ovirt.engine.core.utils.RandomUtils)1