Implement job filtering

This implements the design doc
  "Filtering of jobs for the Ganeti job queue"
(design-optables.rst).

Included are some preparatory additions, the logic implementation, unit tests and system tests in the QA.