Raise specific exception for an invalid protocol connector
Nova's libvirt driver attempts to load up a set of volume drivers which use os-brick connectors on start of the nova-compute service. If there is a missing or invalid mapping, like ISER + s390x, it results in a ValueError and nova-compute fails to start. This change raises a specific exception, which is still a ValueError for backward compatibility, so that Nova can handle this situation gracefully and not crash. Change-Id: I1d016c226416cf2b77d6e0393498905f56fd8cde Partial-Bug: #1639239
This commit is contained in:
parent
fe5d9999be
commit
f7b8d242f7
|
@ -154,3 +154,8 @@ class InvalidIOHandleObject(BrickException):
|
|||
class VolumeEncryptionNotSupported(Invalid):
|
||||
message = _("Volume encryption is not supported for %(volume_type)s "
|
||||
"volume %(volume_id)s.")
|
||||
|
||||
|
||||
# NOTE(mriedem): This extends ValueError to maintain backward compatibility.
|
||||
class InvalidConnectorProtocol(ValueError):
|
||||
pass
|
||||
|
|
|
@ -29,6 +29,7 @@ from oslo_concurrency import lockutils
|
|||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
|
||||
from os_brick import exception
|
||||
from os_brick.i18n import _
|
||||
from os_brick import initiator
|
||||
from os_brick import utils
|
||||
|
@ -282,7 +283,7 @@ class InitiatorConnector(object):
|
|||
msg = (_("Invalid InitiatorConnector protocol "
|
||||
"specified %(protocol)s") %
|
||||
dict(protocol=protocol))
|
||||
raise ValueError(msg)
|
||||
raise exception.InvalidConnectorProtocol(msg)
|
||||
|
||||
conn_cls = importutils.import_class(connector)
|
||||
return conn_cls(*args, **kwargs)
|
||||
|
|
|
@ -18,6 +18,7 @@ import sys
|
|||
import mock
|
||||
from oslo_concurrency import processutils as putils
|
||||
|
||||
from os_brick import exception
|
||||
from os_brick.initiator import connector
|
||||
from os_brick.initiator.connectors import base
|
||||
from os_brick.initiator.connectors import fake
|
||||
|
@ -222,7 +223,7 @@ class ConnectorTestCase(test_base.TestCase):
|
|||
obj = connector.InitiatorConnector.factory("disco", None)
|
||||
self.assertEqual("DISCOConnector", obj.__class__.__name__)
|
||||
|
||||
self.assertRaises(ValueError,
|
||||
self.assertRaises(exception.InvalidConnectorProtocol,
|
||||
connector.InitiatorConnector.factory,
|
||||
"bogus", None)
|
||||
|
||||
|
|
Loading…
Reference in New Issue