Merge "move NVMEOF exception to target file"

This commit is contained in:
Zuul 2019-05-21 10:56:16 +00:00 committed by Gerrit Code Review
commit bf7e586f61
3 changed files with 8 additions and 7 deletions

View File

@ -1213,8 +1213,3 @@ class ServiceUserTokenNoAuth(CinderException):
message = _("The [service_user] send_service_user_token option was "
"requested, but no service auth could be loaded. Please check "
"the [service_user] configuration section.")
class UnsupportedNVMETProtocol(Invalid):
message = _("An invalid 'target_protocol' "
"value was provided: %(protocol)s")

View File

@ -133,7 +133,7 @@ class TestNVMeOFDriver(tf.TargetDriverFixture):
def test_invalid_target_protocol(self):
self.configuration.target_protocol = 'iser'
self.assertRaises(exception.UnsupportedNVMETProtocol,
self.assertRaises(nvmeof.UnsupportedNVMETProtocol,
FakeNVMeOFDriver,
root_helper=utils.get_root_helper(),
configuration=self.configuration)

View File

@ -15,12 +15,18 @@ import abc
from oslo_log import log as logging
from cinder import exception
from cinder.i18n import _
from cinder.volume.targets import driver
LOG = logging.getLogger(__name__)
class UnsupportedNVMETProtocol(exception.Invalid):
message = _("An invalid 'target_protocol' "
"value was provided: %(protocol)s")
class NVMeOF(driver.Target):
"""Target object for block storage devices with RDMA transport."""
@ -44,7 +50,7 @@ class NVMeOF(driver.Target):
self.nvme_transport_type = self.target_protocol_map[
target_protocol]
else:
raise exception.UnsupportedNVMETProtocol(
raise UnsupportedNVMETProtocol(
protocol=target_protocol
)