Fix glance filesystem store race condition

Fixes bug 1066416

Change-Id: I94c57b79efa251c5e11643e13052a549ab487dae
This commit is contained in:
Mark Washenberger
2012-10-14 00:03:26 +00:00
parent fd8e6cf371
commit 04b0ed7ae4

View File

@@ -126,7 +126,12 @@ class Store(glance.store.base.Store):
LOG.info(msg)
try:
os.makedirs(self.datadir)
except IOError:
except (IOError, OSError):
if os.path.exists(self.datadir):
# NOTE(markwash): If the path now exists, some other
# process must have beat us in the race condition. But it
# doesn't hurt, so we can safely ignore the error.
return
reason = _("Unable to create datadir: %s") % self.datadir
LOG.error(reason)
raise exception.BadStoreConfiguration(store_name="filesystem",