Search in sources :

Example 1 with VmBalloonInfo

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

the class VmAnalyzer method proceedBalloonCheck.

private void proceedBalloonCheck() {
    VmBalloonInfo balloonInfo = vdsmVm.getVmBalloonInfo();
    if (balloonInfo == null) {
        return;
    }
    if (!vdsManager.getCopyVds().isBalloonEnabled()) {
        return;
    }
    // TODO: getBalloonLastMemory always returns null - need to fix
    if (balloonInfo.getBalloonLastMemory() == null || balloonInfo.getBalloonLastMemory() == 0) {
        balloonInfo.setBalloonLastMemory(balloonInfo.getCurrentMemory());
        return;
    }
    if (isBalloonDeviceActiveOnVm() && (Objects.equals(balloonInfo.getCurrentMemory(), balloonInfo.getBalloonMaxMemory()) || !isBalloonWorking(balloonInfo))) {
        vmBalloonDriverRequestedAndUnavailable = true;
    } else {
        vmBalloonDriverNotRequestedOrAvailable = true;
    }
    // save the current value for the next time we check it
    balloonInfo.setBalloonLastMemory(balloonInfo.getCurrentMemory());
    if (vdsmVm.getVmStatistics().getUsageMemPercent() != null && // guest agent is down
    vdsmVm.getVmStatistics().getUsageMemPercent() == 0 && // check if the device is present
    balloonInfo.isBalloonDeviceEnabled() && !Objects.equals(balloonInfo.getCurrentMemory(), balloonInfo.getBalloonMaxMemory())) {
        guestAgentDownAndBalloonInfalted = true;
    } else {
        guestAgentUpOrBalloonDeflated = true;
    }
}
Also used : VmBalloonInfo(org.ovirt.engine.core.common.businessentities.VmBalloonInfo)

Example 2 with VmBalloonInfo

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

the class VmAnalyzer method proceedGuaranteedMemoryCheck.

private void proceedGuaranteedMemoryCheck() {
    VmBalloonInfo vmBalloonInfo = vdsmVm.getVmBalloonInfo();
    if (vmBalloonInfo != null && vmBalloonInfo.getCurrentMemory() != null && vmBalloonInfo.getCurrentMemory() > 0 && getVmManager().getMinAllocatedMem() > vmBalloonInfo.getCurrentMemory() / TO_MEGA_BYTES) {
        AuditLogableBase auditLogable = Injector.injectMembers(new AuditLogableBase());
        auditLogable.addCustomValue("VmName", getVmManager().getName());
        auditLogable.addCustomValue("VdsName", vdsManager.getVdsName());
        auditLogable.addCustomValue("MemGuaranteed", String.valueOf(getVmManager().getMinAllocatedMem()));
        auditLogable.addCustomValue("MemActual", Long.toString(vmBalloonInfo.getCurrentMemory() / TO_MEGA_BYTES));
        auditLog(auditLogable, AuditLogType.VM_MEMORY_UNDER_GUARANTEED_VALUE);
    }
}
Also used : AuditLogableBase(org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase) VmBalloonInfo(org.ovirt.engine.core.common.businessentities.VmBalloonInfo)

Example 3 with VmBalloonInfo

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

the class VdsBrokerObjectsBuilder method buildVmBalloonInfo.

public static VmBalloonInfo buildVmBalloonInfo(Map<String, Object> struct) {
    VmBalloonInfo vmBalloonInfo = new VmBalloonInfo();
    Map<String, Object> balloonInfo = (Map<String, Object>) struct.get(VdsProperties.vm_balloonInfo);
    if (balloonInfo != null && !balloonInfo.isEmpty()) {
        vmBalloonInfo.setCurrentMemory(assignLongValue(balloonInfo, VdsProperties.vm_balloon_cur));
        vmBalloonInfo.setBalloonMaxMemory(assignLongValue(balloonInfo, VdsProperties.vm_balloon_max));
        vmBalloonInfo.setBalloonTargetMemory(assignLongValue(balloonInfo, VdsProperties.vm_balloon_target));
        vmBalloonInfo.setBalloonMinMemory(assignLongValue(balloonInfo, VdsProperties.vm_balloon_min));
        // only if all 4 properties are found the balloon is considered enabled (available from 3.3)
        vmBalloonInfo.setBalloonDeviceEnabled(balloonInfo.size() >= 4);
    }
    return vmBalloonInfo;
}
Also used : VmBalloonInfo(org.ovirt.engine.core.common.businessentities.VmBalloonInfo) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

VmBalloonInfo (org.ovirt.engine.core.common.businessentities.VmBalloonInfo)3 HashMap (java.util.HashMap)1 Map (java.util.Map)1 AuditLogableBase (org.ovirt.engine.core.dal.dbbroker.auditloghandling.AuditLogableBase)1