calc_hn_rusage(): only account for running containers.

While it is usually not the case, sometimes /proc/user_beancounters contains
values from the old (not currently running) containers. There are a few reasons
why it can be the case, with the most common being a kernel bug.

Nevertheless, calc_hn_rusage() should not use beancounters for not running
CTs. We do so by getting a list of running CTs first, and then for every UBC
check that such UBC ID exist in a list of running CTs.

Similar bug, but for vzmemcheck, is a subject of bug report #1757.

NOTE: calc_hn_rusage() is currently unused. The plan is to introduce
a call to check_hn_overcommitment() (which calls calc_hn_rusage()) on
CT start, so that vzctl could complain if a node is overcommitted.
Whether it will be implemented and when is currently unclear, so for now
we are actually patching some dead code (which might be resurrected later).

http://bugzilla.openvz.org/1757

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
1 file changed