Skip to content

Commit

Permalink
temporary workaround for libguestfs bug (BZ 790528)
Browse files Browse the repository at this point in the history
  • Loading branch information
imcleod committed Feb 15, 2012
1 parent c7e4975 commit d75d7da
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions imagefactory
Expand Up @@ -20,6 +20,7 @@ import os
import os.path
import signal
import logging
import guestfs
from imgfac.ApplicationConfiguration import ApplicationConfiguration
from imgfac.BuildDispatcher import BuildDispatcher
from imgfac.Singleton import Singleton
Expand Down Expand Up @@ -140,6 +141,8 @@ class Application(Singleton):

debug(self.app_config['debug'])
pem_file = self.app_config['ssl_pem'] if not self.app_config['no_ssl'] else None
# TODO: Remove this call and the function def when BZ 790528 is resolved
self._init_guestfs()
# Don't set reloader to True or you will lose state. You have been warned.
run(server='paste',
app=rest_api,
Expand Down Expand Up @@ -182,5 +185,12 @@ class Application(Singleton):
for dispatcher in dispatchers:
print("Pushing build %s of image %s to provider %s" % (dispatcher.build_id, dispatcher.image_id, dispatcher.provider))

def _init_guestfs(self):
# Doing this once, before going multithreaded, avoids the concurrency issue in BZ 790528
g = guestfs.GuestFS()
g.add_drive ("/dev/zero")
g.launch()
del g

if __name__ == "__main__":
sys.exit(Application().main())

0 comments on commit d75d7da

Please sign in to comment.