[virt-manager] [PATCH v2 8/8] create: Show details of container bootstrap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux