[virt-tools-list] [virt-manager] [PATCH v2 8/8] create: Show details of container bootstrap
Radostin Stoyanov
rstoyanov1 at gmail.com
Wed Jul 5 16:51:25 UTC 2017
Get get information about the progress from virt-bootstrap
and show it on GUI.
---
virtManager/create.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/virtManager/create.py b/virtManager/create.py
index c4a4be6..0683979 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -2626,7 +2626,8 @@ class vmmCreate(vmmGObjectUI):
def _create_directory_tree(self, asyncjob, src, dest, user, passwd, insecure):
"""
- Call bootstrap method from virtBootstrap.
+ Call bootstrap method from virtBootstrap and show logger messages
+ as state/details.
"""
try:
import virtBootstrap
@@ -2639,6 +2640,14 @@ class vmmCreate(vmmGObjectUI):
meter.text = _(prog['status'])
meter.update(prog['value'])
+ asyncjob.details_enable()
+ # Use logging filter to show messages of the progreess on the GUI
+ class SetStateFilter(logging.Filter):
+ def filter(self, record):
+ asyncjob.details_update("%s\n" % record.getMessage())
+ return True
+
+
# Use string buffer to store log messages
log_stream = cStringIO.StringIO()
@@ -2649,6 +2658,8 @@ class vmmCreate(vmmGObjectUI):
# Create hander to store log messages in the string buffer
hdlr = logging.StreamHandler(log_stream)
hdlr.setFormatter(logging.Formatter('%(message)s'))
+ # Use logging filter to show messages on GUI
+ hdlr.addFilter(SetStateFilter())
vbLogger.addHandler(hdlr)
# Key word arguments to be passed
--
2.9.4
More information about the virt-tools-list
mailing list