The main bug being the lack of memCap.setTotalCapacity(host.getTotalMemory());

Darren

On Wed, Sep 25, 2013 at 1:13 PM, Daan Hoogland <daan.hoogl...@gmail.com> wrote:
> I agree Darren,
>
> if (cpuCap.getUsedCapacity() == usedCpu &&
> cpuCap.getReservedCapacity() == reservedCpu) {
> } else {
>    if (cpuCap.getReservedCapacity() != reservedCpu) {
>                 cpuCap.setReservedCapacity(reservedCpu);
>    }
>    if (cpuCap.getUsedCapacity() != usedCpu) {
>                 cpuCap.setUsedCapacity(usedCpu);
>             }
> }
>
> makes more sense. (same for mem)
>
>
> On Wed, Sep 25, 2013 at 9:59 PM, Darren Shepherd <
> darren.s.sheph...@gmail.com> wrote:
>
>> 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