[virt-tools-list] [virt-manager] [PATCH v3 4/4] create: Show details of container bootstrap

Radostin Stoyanov rstoyanov1 at gmail.com
Tue Jul 11 00:07:23 UTC 2017


Get get information about the progress from virt-bootstrap
and show it on GUI.
---
 virtManager/create.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/virtManager/create.py b/virtManager/create.py
index b0ebbf1..e9fe7ad 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -2597,7 +2597,8 @@ class vmmCreate(vmmGObjectUI):
     def _create_directory_tree(self, asyncjob, meter, src, dest, user,
                                passwd, insecure):
         """
-        Call bootstrap method from virtBootstrap.
+        Call bootstrap method from virtBootstrap and show logger messages
++        as state/details.
         """
         import virtBootstrap
 
@@ -2606,6 +2607,13 @@ 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()
 
@@ -2615,6 +2623,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