python/qemu: qmp: Make QEMUMonitorProtocol a context manager
This implement the __enter__ and __exit__ functions on
QEMUMonitorProtocol class so that it can be used on 'with'
statement and the resources will be free up on block end:
with QEMUMonitorProtocol(socket_path) as qmp:
qmp.connect()
qmp.command('query-status')
Signed-off-by: Wainer dos Santos Moschetta <[email protected]>
Reviewed-by: John Snow <[email protected]>
Message-Id: <
20200204141111[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>