admin: Introduce virAdmConnectIsAlive

Since most of our APIs rely on an acive functional connection to a daemon and
we have such a mechanism in libvirt already, there's need to have such a way in
libvirt-admin as well. By introducing a new public API, this patch provides
support to check for an active connection.
This commit is contained in:
Erik Skultety
2015-10-14 15:10:02 +02:00
parent 6409578790
commit 47a089f06c
4 changed files with 37 additions and 2 deletions

View File

@@ -159,10 +159,10 @@ vshAdmConnectionHandler(vshControl *ctl)
{
vshAdmControlPtr priv = ctl->privData;
if (!priv->conn)
if (!virAdmConnectIsAlive(priv->conn))
vshAdmReconnect(ctl);
if (!priv->conn) {
if (!virAdmConnectIsAlive(priv->conn)) {
vshError(ctl, "%s", _("no valid connection"));
return NULL;
}