Merge "move zadara exceptions"
This commit is contained in:
@@ -1100,31 +1100,6 @@ class BadResetResourceStatus(CinderException):
|
|||||||
message = _("Bad reset resource status : %(reason)s")
|
message = _("Bad reset resource status : %(reason)s")
|
||||||
|
|
||||||
|
|
||||||
# ZADARA STORAGE VPSA driver exception
|
|
||||||
class ZadaraServerCreateFailure(VolumeDriverException):
|
|
||||||
message = _("Unable to create server object for initiator %(name)s")
|
|
||||||
|
|
||||||
|
|
||||||
class ZadaraServerNotFound(NotFound):
|
|
||||||
message = _("Unable to find server object for initiator %(name)s")
|
|
||||||
|
|
||||||
|
|
||||||
class ZadaraVPSANoActiveController(VolumeDriverException):
|
|
||||||
message = _("Unable to find any active VPSA controller")
|
|
||||||
|
|
||||||
|
|
||||||
class ZadaraAttachmentsNotFound(NotFound):
|
|
||||||
message = _("Failed to retrieve attachments for volume %(name)s")
|
|
||||||
|
|
||||||
|
|
||||||
class ZadaraInvalidAttachmentInfo(Invalid):
|
|
||||||
message = _("Invalid attachment info for volume %(name)s: %(reason)s")
|
|
||||||
|
|
||||||
|
|
||||||
class ZadaraVolumeNotFound(VolumeDriverException):
|
|
||||||
message = "%(reason)s"
|
|
||||||
|
|
||||||
|
|
||||||
# StorPool driver
|
# StorPool driver
|
||||||
class StorPoolConfigurationInvalid(CinderException):
|
class StorPoolConfigurationInvalid(CinderException):
|
||||||
message = _("Invalid parameter %(param)s in the %(section)s section "
|
message = _("Invalid parameter %(param)s in the %(section)s section "
|
||||||
|
|||||||
@@ -569,7 +569,7 @@ class ZadaraVPSADriverTestCase(test.TestCase):
|
|||||||
self.driver.create_volume(volume2)
|
self.driver.create_volume(volume2)
|
||||||
self.driver.initialize_connection(volume1, connector1)
|
self.driver.initialize_connection(volume1, connector1)
|
||||||
self.driver.initialize_connection(volume2, connector2)
|
self.driver.initialize_connection(volume2, connector2)
|
||||||
self.assertRaises(exception.ZadaraServerNotFound,
|
self.assertRaises(zadara.ZadaraServerNotFound,
|
||||||
self.driver.terminate_connection,
|
self.driver.terminate_connection,
|
||||||
volume1, connector3)
|
volume1, connector3)
|
||||||
self.assertRaises(exception.VolumeNotFound,
|
self.assertRaises(exception.VolumeNotFound,
|
||||||
@@ -653,7 +653,7 @@ class ZadaraVPSADriverTestCase(test.TestCase):
|
|||||||
volume = {'name': 'test_volume_01', 'size': 1, 'id': 123}
|
volume = {'name': 'test_volume_01', 'size': 1, 'id': 123}
|
||||||
connector = dict(initiator='test_iqn.1')
|
connector = dict(initiator='test_iqn.1')
|
||||||
self.driver.create_volume(volume)
|
self.driver.create_volume(volume)
|
||||||
self.assertRaises(exception.ZadaraVPSANoActiveController,
|
self.assertRaises(zadara.ZadaraVPSANoActiveController,
|
||||||
self.driver.initialize_connection,
|
self.driver.initialize_connection,
|
||||||
volume, connector)
|
volume, connector)
|
||||||
|
|
||||||
@@ -690,7 +690,7 @@ class ZadaraVPSADriverTestCase(test.TestCase):
|
|||||||
|
|
||||||
self.driver.create_volume(volume)
|
self.driver.create_volume(volume)
|
||||||
|
|
||||||
self.assertRaises(exception.ZadaraVolumeNotFound,
|
self.assertRaises(zadara.ZadaraVolumeNotFound,
|
||||||
self.driver.extend_volume,
|
self.driver.extend_volume,
|
||||||
volume2, 15)
|
volume2, 15)
|
||||||
self.assertRaises(exception.InvalidInput,
|
self.assertRaises(exception.InvalidInput,
|
||||||
|
|||||||
@@ -74,6 +74,30 @@ CONF = cfg.CONF
|
|||||||
CONF.register_opts(zadara_opts, group=configuration.SHARED_CONF_GROUP)
|
CONF.register_opts(zadara_opts, group=configuration.SHARED_CONF_GROUP)
|
||||||
|
|
||||||
|
|
||||||
|
class ZadaraServerCreateFailure(exception.VolumeDriverException):
|
||||||
|
message = _("Unable to create server object for initiator %(name)s")
|
||||||
|
|
||||||
|
|
||||||
|
class ZadaraServerNotFound(exception.NotFound):
|
||||||
|
message = _("Unable to find server object for initiator %(name)s")
|
||||||
|
|
||||||
|
|
||||||
|
class ZadaraVPSANoActiveController(exception.VolumeDriverException):
|
||||||
|
message = _("Unable to find any active VPSA controller")
|
||||||
|
|
||||||
|
|
||||||
|
class ZadaraAttachmentsNotFound(exception.NotFound):
|
||||||
|
message = _("Failed to retrieve attachments for volume %(name)s")
|
||||||
|
|
||||||
|
|
||||||
|
class ZadaraInvalidAttachmentInfo(exception.Invalid):
|
||||||
|
message = _("Invalid attachment info for volume %(name)s: %(reason)s")
|
||||||
|
|
||||||
|
|
||||||
|
class ZadaraVolumeNotFound(exception.VolumeDriverException):
|
||||||
|
message = "%(reason)s"
|
||||||
|
|
||||||
|
|
||||||
class ZadaraVPSAConnection(object):
|
class ZadaraVPSAConnection(object):
|
||||||
"""Executes volume driver commands on VPSA."""
|
"""Executes volume driver commands on VPSA."""
|
||||||
|
|
||||||
@@ -566,7 +590,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
msg = (_('Volume %(name)s could not be found. '
|
msg = (_('Volume %(name)s could not be found. '
|
||||||
'It might be already deleted') % {'name': name})
|
'It might be already deleted') % {'name': name})
|
||||||
LOG.error(msg)
|
LOG.error(msg)
|
||||||
raise exception.ZadaraVolumeNotFound(reason=msg)
|
raise ZadaraVolumeNotFound(reason=msg)
|
||||||
|
|
||||||
if new_size < size:
|
if new_size < size:
|
||||||
raise exception.InvalidInput(
|
raise exception.InvalidInput(
|
||||||
@@ -604,7 +628,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
initiator_name = connector['initiator']
|
initiator_name = connector['initiator']
|
||||||
vpsa_srv = self._create_vpsa_server(initiator_name)
|
vpsa_srv = self._create_vpsa_server(initiator_name)
|
||||||
if not vpsa_srv:
|
if not vpsa_srv:
|
||||||
raise exception.ZadaraServerCreateFailure(name=initiator_name)
|
raise ZadaraServerCreateFailure(name=initiator_name)
|
||||||
|
|
||||||
# Get volume name
|
# Get volume name
|
||||||
name = self.configuration.zadara_vol_name_template % volume['name']
|
name = self.configuration.zadara_vol_name_template % volume['name']
|
||||||
@@ -615,7 +639,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
# Get Active controller details
|
# Get Active controller details
|
||||||
ctrl = self._get_active_controller_details()
|
ctrl = self._get_active_controller_details()
|
||||||
if not ctrl:
|
if not ctrl:
|
||||||
raise exception.ZadaraVPSANoActiveController()
|
raise ZadaraVPSANoActiveController()
|
||||||
|
|
||||||
xml_tree = self.vpsa.send_cmd('list_vol_attachments',
|
xml_tree = self.vpsa.send_cmd('list_vol_attachments',
|
||||||
vpsa_vol=vpsa_vol)
|
vpsa_vol=vpsa_vol)
|
||||||
@@ -632,11 +656,11 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
server = self._xml_parse_helper(xml_tree, 'servers',
|
server = self._xml_parse_helper(xml_tree, 'servers',
|
||||||
('iqn', initiator_name))
|
('iqn', initiator_name))
|
||||||
if server is None:
|
if server is None:
|
||||||
raise exception.ZadaraAttachmentsNotFound(name=name)
|
raise ZadaraAttachmentsNotFound(name=name)
|
||||||
target = server.findtext('target')
|
target = server.findtext('target')
|
||||||
lun = int(server.findtext('lun'))
|
lun = int(server.findtext('lun'))
|
||||||
if target is None or lun is None:
|
if target is None or lun is None:
|
||||||
raise exception.ZadaraInvalidAttachmentInfo(
|
raise ZadaraInvalidAttachmentInfo(
|
||||||
name=name,
|
name=name,
|
||||||
reason=_('target=%(target)s, lun=%(lun)s') %
|
reason=_('target=%(target)s, lun=%(lun)s') %
|
||||||
{'target': target, 'lun': lun})
|
{'target': target, 'lun': lun})
|
||||||
@@ -663,7 +687,7 @@ class ZadaraVPSAISCSIDriver(driver.ISCSIDriver):
|
|||||||
initiator_name = connector['initiator']
|
initiator_name = connector['initiator']
|
||||||
vpsa_srv = self._get_server_name(initiator_name)
|
vpsa_srv = self._get_server_name(initiator_name)
|
||||||
if not vpsa_srv:
|
if not vpsa_srv:
|
||||||
raise exception.ZadaraServerNotFound(name=initiator_name)
|
raise ZadaraServerNotFound(name=initiator_name)
|
||||||
|
|
||||||
# Get volume name
|
# Get volume name
|
||||||
name = self.configuration.zadara_vol_name_template % volume['name']
|
name = self.configuration.zadara_vol_name_template % volume['name']
|
||||||
|
|||||||
Reference in New Issue
Block a user