Skip to content

Commit

Permalink
Run libguestfs API calls in a thread pool
Browse files Browse the repository at this point in the history
The libguestfs API is a binding to a native C library, and thus
it will block greenthreads. To avoid this all libguestfs API
calls need to be run in a threadpool. This can be done by just
wrapping the GuestFS object in an eventlet.tpool.Proxy object

Fixes bug #1132742
Change-Id: I877ad9e88442e41c9ad234503d9b1ddf1fb27408
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
  • Loading branch information
berrange committed Feb 25, 2013
1 parent 42d058b commit ea07be6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nova/virt/disk/vfs/guestfs.py
Expand Up @@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.

from eventlet import tpool
import guestfs

from nova import exception
Expand Down Expand Up @@ -93,7 +94,7 @@ def setup_os_root(self, root):
def setup(self):
LOG.debug(_("Setting up appliance for %(imgfile)s %(imgfmt)s") %
{'imgfile': self.imgfile, 'imgfmt': self.imgfmt})
self.handle = guestfs.GuestFS()
self.handle = tpool.Proxy(guestfs.GuestFS())

try:
self.handle.add_drive_opts(self.imgfile, format=self.imgfmt)
Expand Down

0 comments on commit ea07be6

Please sign in to comment.