From 923d52df05c347bd9fc6e57acdf23a8bf7b1cd6c Mon Sep 17 00:00:00 2001 From: Nikos Skalkotos Date: Sun, 30 Dec 2012 18:39:25 +0200 Subject: [PATCH] Remove progress bar for guestfs.launch() progress In Guestfs you get notifications about progress on some functions like launch() by registring callback functions. When using guestfs from python, this is fragile. If the callback functions raises an exception, you end up with segmentation fault. It is better to completely remove the progress monitoring from launch(). --- image_creator/disk.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/image_creator/disk.py b/image_creator/disk.py index a8d5d66..0c1f558 100644 --- a/image_creator/disk.py +++ b/image_creator/disk.py @@ -205,15 +205,18 @@ class DiskDevice(object): def enable(self): """Enable a newly created DiskDevice""" - self.progressbar = self.out.Progress(100, "Launching helper VM", - "percent") - eh = self.g.set_event_callback(self.progress_callback, - guestfs.EVENT_PROGRESS) + + self.out.output('Launching helper VM (may take a while) ...', False) + # self.progressbar = self.out.Progress(100, "Launching helper VM", + # "percent") + # eh = self.g.set_event_callback(self.progress_callback, + # guestfs.EVENT_PROGRESS) self.g.launch() self.guestfs_enabled = True - self.g.delete_event_callback(eh) - self.progressbar.success('done') - self.progressbar = None + # self.g.delete_event_callback(eh) + # self.progressbar.success('done') + # self.progressbar = None + self.out.success('done') self.out.output('Inspecting Operating System ...', False) roots = self.g.inspect_os() @@ -244,11 +247,11 @@ class DiskDevice(object): # Close the guestfs handler if open self.g.close() - def progress_callback(self, ev, eh, buf, array): - position = array[2] - total = array[3] - - self.progressbar.goto((position * 100) // total) +# def progress_callback(self, ev, eh, buf, array): +# position = array[2] +# total = array[3] +# +# self.progressbar.goto((position * 100) // total) def mount(self, readonly=False): """Mount all disk partitions in a correct order.""" -- 1.7.10.4