[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] virsh-domain: Check if domain is running for ttyconsole cmd



Signed-off-by: Yanbing Du <ydu redhat com>
---
 tools/virsh-domain.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 4081451..9ccbc35 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -9139,6 +9139,12 @@ cmdTTYConsole(vshControl *ctl, const vshCmd *cmd)
     if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
         return false;
 
+    /* Check if the domain is active */
+    if (!virDomainIsActive(dom)) {
+        vshError(ctl, _("Domain is not running"));
+        goto cleanup;
+    }
+
     doc = virDomainGetXMLDesc(dom, 0);
     if (!doc)
         goto cleanup;
-- 
1.7.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]