Factor out and alter the instance running check
Factor out and alter the instance running check

Examining whether an instance is running is useful outside the instance
state check, especially as the check relies on the admin_state recorded
within the configuration, which the code treats as the desired rather
than the actual state. This patch pulls the check out into a separate
function. It also updates the function to account for possible user
shutdowns, if the right option is passed.

Signed-off-by: Hrvoje Ribicic <be5828fca31f89218048bec4189e30a581aa65da@google.com>
Reviewed-by: Jose A. Lopes <0fb9c4f8511df4ec2ae28af879e9d462f6218a2c@google.com>

mbakke/ganeti,grnet/snf-ganeti,yiannist/ganeti,onponomarev/ganeti,dimara/ganeti,leshchevds/ganeti,dimara/ganeti,grnet/snf-ganeti,ganeti-github-testing/ganeti-test-1,mbakke/ganeti,bitemyapp/ganeti,onponomarev/ganeti,andir/ganeti,leshchevds/ganeti,andir/ganeti,andir/ganeti,ganeti-github-testing/ganeti-test-1,yiannist/ganeti,yiannist/ganeti,mbakke/ganeti,ganeti/ganeti,leshchevds/ganeti,ganeti/ganeti,apyrgio/ganeti,bitemyapp/ganeti,apyrgio/ganeti,ganeti/ganeti