qmp-shell: don't show version greeting if unavailable

qemu-ga doesn't have greeting.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20170504125432.21653-4-marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Marc-André Lureau 2017-05-04 16:54:31 +04:00 committed by Markus Armbruster
parent daa5a72eba
commit b13d2ff3de

View File

@ -286,6 +286,9 @@ class QMPShell(qmp.QEMUMonitorProtocol):
def show_banner(self, msg='Welcome to the QMP low-level shell!'):
print msg
if not self._greeting:
print 'Connected'
return
version = self._greeting['QMP']['version']['qemu']
print 'Connected to QEMU %d.%d.%d\n' % (version['major'],version['minor'],version['micro'])