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

13 Aug
2013
13 Aug
'13
5:48 a.m.
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
4409
Age (days ago)
4409
Last active (days ago)
0 comments
1 participants
participants (1)
-
Yanbing Du