Fix bug NMS-5990, wrong node availability calculation. Rebuiling the
query selecting and calculating the availability by a node.
Merge remote-tracking branch 'origin/1.10' into 1.12