From: Nikos Skalkotos Date: Sun, 30 Dec 2012 16:39:25 +0000 (+0200) Subject: Remove progress bar for guestfs.launch() progress X-Git-Tag: v0.2~24 X-Git-Url: https://code.grnet.gr/git/snf-image-creator/commitdiff_plain/923d52df05c347bd9fc6e57acdf23a8bf7b1cd6c 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(). --- 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."""