I created a bug here if a developer could describe the code problem. I have merely added some mysql commands showing how to fix it.
https://issues.apache.org/jira/browse/CLOUDSTACK-4755 On Fri, Sep 27, 2013 at 4:54 PM, Jeronimo Garcia <garciaj...@gmail.com>wrote: > Has this bug been raised? I have this issue as well .. we are on 4.0.2 and > 4.1.1 > > > On Wed, Sep 25, 2013 at 4:43 PM, Prachi Damle <prachi.da...@citrix.com > >wrote: > > > Yes, the main bug here is not updating the Total Capacity - this is > > avoiding the total getting updated on host reconnects. > > > > Bug with the Used and Reserved Capacities gets masked since > > CapacityManager also listens to the VM state changes and updates these > > values. > > > > Prachi > > -----Original Message----- > > From: Darren Shepherd [mailto:darren.s.sheph...@gmail.com] > > Sent: Wednesday, September 25, 2013 1:45 PM > > To: dev@cloudstack.apache.org > > Subject: Re: bug? capacity not updated when adding memory to hypervisor > > > > 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); > > >> } > > >> > > > -- Tim Ehlers