[virt-tools-list] [virt-manager] [PATCH v2 6/8] create: Show progress of container bootstrap
Radostin Stoyanov
rstoyanov1 at gmail.com
Wed Jul 5 16:51:23 UTC 2017
Display the current status and progress from virt-bootstrap.
---
virtManager/create.py | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/virtManager/create.py b/virtManager/create.py
index f823ab7..c4a4be6 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -2633,16 +2633,27 @@ class vmmCreate(vmmGObjectUI):
except ImportError as err:
asyncjob.set_error("Please install virt-bootstrap", err)
+ meter = asyncjob.get_meter()
+ meter.start(text=_("Bootstraping container"), size=100)
+ def progress_update_cb(prog):
+ meter.text = _(prog['status'])
+ meter.update(prog['value'])
+
# Use string buffer to store log messages
log_stream = cStringIO.StringIO()
# Get virt-bootstrap logger
vbLogger = logging.getLogger('virtBootstrap')
vbLogger.setLevel(logging.DEBUG)
- vbLogger.addHandler(logging.StreamHandler(log_stream))
+
+ # Create hander to store log messages in the string buffer
+ hdlr = logging.StreamHandler(log_stream)
+ hdlr.setFormatter(logging.Formatter('%(message)s'))
+ vbLogger.addHandler(hdlr)
# Key word arguments to be passed
kwargs = {'uri': src, 'dest': dest, 'not_secure': insecure}
+ kwargs['progress_cb'] = progress_update_cb
if user and passwd:
kwargs['username'] = user
kwargs['password'] = passwd
--
2.9.4
More information about the virt-tools-list
mailing list