[libvirt] [PATCH 3/3] Check if domain is running in qemuDomainAgentIsAvailable

Ján Tomko jtomko at redhat.com
Fri Feb 27 15:30:46 UTC 2015


If the domain is not running, the agent will not respond.
Do not even try.

https://bugzilla.redhat.com/show_bug.cgi?id=872424
---
 src/qemu/qemu_domain.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f3f3910..28bfbee 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -2818,6 +2818,13 @@ qemuDomainAgentAvailable(virDomainObjPtr vm,
         }
         return false;
     }
+    if (virDomainObjGetState(vm, NULL) != VIR_DOMAIN_RUNNING) {
+        if (reportError) {
+            virReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                           _("domain is not running"));
+        }
+        return false;
+    }
     return true;
 }
 
-- 
2.0.5




More information about the libvir-list mailing list