On Thu, Oct 27, 2011 at 08:04:20PM +0300, Vangelis Koukis wrote: > Ensure ports previously allocated by calling ConfigWriter's AllocatePort() are > returned to the pool of free ports when no longer needed: > > * Return the network_port of an instance when it is removed > * Return the port used by a DRBD-based disk when it is removed > > Signed-off-by: Vangelis Koukis <vkou...@grnet.gr> > --- > > Hello, > > we have been playing with Ganeti for quite some time now, and seem to > have hit a bug with the way the pool of free TCP/UDP ports is managed. > > While stress-testing Ganeti, we hit the limit of highest_used_port > exceeding constants.LAST_DRBD_PORT and were no longer able to create any > new instances. > > In lib/config.py, there are functions to allocate and return ports > (AllocatePort() and AddTcpUdpPort() respectively). AllocatePort() is > used to allocate network ports for instances, and ports for DRBD-based > disks. However, once allocated, ports are never actually returned to > the pool of free ports. > > To fix the problem: > a) make sure the network port gets returned to the pool when an instance > is destroyed, > b) make sure the port used for a DRBD disk gets returned to the pool > whenever a disk is removed. This happens in various places throughout > the code: when an instance is removed altogether, when a disk is > removed, and when an instance template is converted from drbd to plain. > > Please comment on the following patch for devel-2.4.
Sorry for the late reply. The patch is LGTM and I will apply it, plus I have one comment: it would be good to enhance config.py:ConfigWriter._UnlockedVerifyConfig to detect this case, so that (if we miss another case where we should return a port) it can be easily seen. thanks! iustin