Factorize agent code

There was some code duplication between the central and compute agent around
their managers, so let's factorize that.

Change-Id: I90514e7591833254145ceab366ad5a0d03d8f228
Signed-off-by: Julien Danjou <julien@danjou.info>