I added more memory to a hypervisor, and the host tables was updated
properly, but the op_host_capacity is not updated.  I tracked down the
code to CapacityManagerImpl.updateCapacityForHost.  The below logic
seems completely wrong.  Unless I'm reading it wrong, it seems like it
will only update EITHER used or reserved (not both) and never update
total.  I removed log statements to make it more readable.

if (cpuCap.getUsedCapacity() == usedCpu &&
cpuCap.getReservedCapacity() == reservedCpu) {
            } else if (cpuCap.getReservedCapacity() != reservedCpu) {
                cpuCap.setReservedCapacity(reservedCpu);
            } else if (cpuCap.getUsedCapacity() != usedCpu) {
                cpuCap.setUsedCapacity(usedCpu);
            }

            if (memCap.getUsedCapacity() == usedMemory &&
memCap.getReservedCapacity() == reservedMemory) {
            } else if (memCap.getReservedCapacity() != reservedMemory) {
                memCap.setReservedCapacity(reservedMemory);
            } else if (memCap.getUsedCapacity() != usedMemory) {
                memCap.setUsedCapacity(usedMemory);
            }

Reply via email to