ksm: janitorial: with construct, file() to open()

Summary: use open() and with wherever feasible.

Details:
- move from file() to open(), as the direct usage of file()
  is deprecated:
  http://docs.python.org/2/library/functions.html#file
  http://docs.python.org/release/3.0/whatsnew/3.0.html#builtins
- use the with construct wherever possible, with files and
  threading.Locks
  http://docs.python.org/2/library/threading.html#using-locks-conditions-and-semaphores-in-the-with-statement
- factor the code which read the procfs entries in a couple
  of helper functions, and a few tests for them.

PatchSet V2:
- moved tests into specific file ksmTests.py.
- used more specific check assertGreater insted of generic assertTrue.

PatchSet V3:
- registered ksmTests.py in Makefiles
- fix pep8 in ksmTests.py
- in KsmMonitorThread.adjust there is no need to call running() with
  lock held.

PatchSet V4:
- revert to assertTrue in tests, because more specific asserts require
  python 2.7; EL6 is python 2.6.

PatchSet V5:
- keep the tests ordered.

Change-Id: I47213b3d85eac9afd4cb316c50b192b9c1dfbbd8
Signed-off-by: Francesco Romani <fromani@redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22084
Reviewed-by: Dan Kenigsberg <danken@redhat.com>
Reviewed-by: Antoni Segura Puimedon <asegurap@redhat.com>