summaryrefslogtreecommitdiff
path: root/nova/virt/disk/vfs/guestfs.py
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2013-02-25 12:00:05 +0000
committerDaniel P. Berrange <berrange@redhat.com>2013-02-25 12:01:23 +0000
commitea07be64a455caa19e5088639cad70ee0e4e91fb (patch)
tree73216b7afae9c71815105c39cd5e3b9ef2177ade /nova/virt/disk/vfs/guestfs.py
parent42d058b2a1364266560dcd0aa205e743741d0a41 (diff)
downloadnova-ea07be64a455caa19e5088639cad70ee0e4e91fb.tar.gz
Run libguestfs API calls in a thread pool
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>
Diffstat (limited to 'nova/virt/disk/vfs/guestfs.py')
-rw-r--r--nova/virt/disk/vfs/guestfs.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/nova/virt/disk/vfs/guestfs.py b/nova/virt/disk/vfs/guestfs.py
index 11cf9d098b..985858a0d8 100644
--- a/nova/virt/disk/vfs/guestfs.py
+++ b/nova/virt/disk/vfs/guestfs.py
@@ -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
@@ -93,7 +94,7 @@ class VFSGuestFS(vfs.VFS):
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)