libvirt: Log exception when unable to import rbd or rados
This should help provide some context when the RbdDriver later raises a RuntimeError if rbd or rados hasn't been imported correctly. Change-Id: Ie8bb5e5622bd37dfe8073cca12f77174e8e7d98c
This commit is contained in:
@@ -17,13 +17,6 @@
|
||||
from eventlet import tpool
|
||||
from six.moves import urllib
|
||||
|
||||
try:
|
||||
import rados
|
||||
import rbd
|
||||
except ImportError:
|
||||
rados = None
|
||||
rbd = None
|
||||
|
||||
from oslo_concurrency import processutils
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
@@ -42,6 +35,25 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
RESIZE_SNAPSHOT_NAME = 'nova-resize'
|
||||
|
||||
# NOTE(lyarwood): Log exceptions if we fail to import rbd or rados in order to
|
||||
# provide context later if we end up attempting to use the RbdDriver and
|
||||
# raising RuntimeError
|
||||
try:
|
||||
import rados
|
||||
except ImportError:
|
||||
rados = None
|
||||
LOG.exception(
|
||||
"Unable to import the rados module, this can be ignored if Ceph is "
|
||||
"not used within this environment")
|
||||
|
||||
try:
|
||||
import rbd
|
||||
except ImportError:
|
||||
rbd = None
|
||||
LOG.exception(
|
||||
"Unable to import the rbd module, this can be ignored if Ceph is not "
|
||||
"used within this environment")
|
||||
|
||||
|
||||
class RbdProxy(object):
|
||||
"""A wrapper around rbd.RBD class instance to avoid blocking of process.
|
||||
|
||||
Reference in New Issue
Block a user