Query libvirt for the state of an instance

With this commit, the state of an instance is gathered from libvirt
at the time of the request and not some possibly/likely outdated
database entry.
Refactor the API servers

Make them classes that inherit from threading and also add setup()
and teardown() methods that are called before and after the servers
startup and shutdown.