Skip to content
Snippets Groups Projects
Commit 923d52df authored by Nikos Skalkotos's avatar Nikos Skalkotos
Browse files

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().
parent 83fe59dd
No related branches found
No related tags found
No related merge requests found
...@@ -205,15 +205,18 @@ class DiskDevice(object): ...@@ -205,15 +205,18 @@ class DiskDevice(object):
def enable(self): def enable(self):
"""Enable a newly created DiskDevice""" """Enable a newly created DiskDevice"""
self.progressbar = self.out.Progress(100, "Launching helper VM",
"percent") self.out.output('Launching helper VM (may take a while) ...', False)
eh = self.g.set_event_callback(self.progress_callback, # self.progressbar = self.out.Progress(100, "Launching helper VM",
guestfs.EVENT_PROGRESS) # "percent")
# eh = self.g.set_event_callback(self.progress_callback,
# guestfs.EVENT_PROGRESS)
self.g.launch() self.g.launch()
self.guestfs_enabled = True self.guestfs_enabled = True
self.g.delete_event_callback(eh) # self.g.delete_event_callback(eh)
self.progressbar.success('done') # self.progressbar.success('done')
self.progressbar = None # self.progressbar = None
self.out.success('done')
self.out.output('Inspecting Operating System ...', False) self.out.output('Inspecting Operating System ...', False)
roots = self.g.inspect_os() roots = self.g.inspect_os()
...@@ -244,11 +247,11 @@ class DiskDevice(object): ...@@ -244,11 +247,11 @@ class DiskDevice(object):
# Close the guestfs handler if open # Close the guestfs handler if open
self.g.close() self.g.close()
def progress_callback(self, ev, eh, buf, array): # def progress_callback(self, ev, eh, buf, array):
position = array[2] # position = array[2]
total = array[3] # total = array[3]
#
self.progressbar.goto((position * 100) // total) # self.progressbar.goto((position * 100) // total)
def mount(self, readonly=False): def mount(self, readonly=False):
"""Mount all disk partitions in a correct order.""" """Mount all disk partitions in a correct order."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment