RBD: Check for OSError before using errno

Change-Id: I40d46ddbe1e5a4e8c48a38f8b52f7281c5e0f7dd
Closes-Bug: #1852471
This commit is contained in:
Jon Bernard 2019-11-13 13:59:19 -05:00 committed by Eric Harney
parent 3e048975d0
commit 25a5145a9d
1 changed files with 2 additions and 1 deletions

View File

@ -389,7 +389,8 @@ class RBDDriver(driver.CloneableImageVD, driver.MigrateVD,
# so that the periodic purge retries on the next iteration
# and leaves ERRORs in the logs in case the deletion fails
# repeatedly.
if e.errno == errno.EPERM:
# pylint: disable=E1101
if (e is OSError) and (e.errno == errno.EPERM):
LOG.debug("%s has not expired yet on backend '%s'",
vol.get('name'),
self._backend_name)