JovianDSS: fix iscsi target recovery function
ensure_target_volume does not convert volume name to a proper form, causing failure in case of partial target recovery. This patch fixes name convertion. Added import of i18n to handle errors related to _ Change-Id: I567f09b96e4167b387f5bafc434b0b093b6b11fa Closes-Bug: #1941746
This commit is contained in:
parent
a2f0f57a06
commit
ea50df5d24
@ -1223,7 +1223,7 @@ class TestOpenEJovianDSSDriver(test.TestCase):
|
||||
patches = [
|
||||
mock.patch.object(
|
||||
jdssd,
|
||||
"_create_target_volume",
|
||||
"_ensure_target_volume",
|
||||
return_value=None),
|
||||
mock.patch.object(
|
||||
jdssd,
|
||||
@ -1233,7 +1233,7 @@ class TestOpenEJovianDSSDriver(test.TestCase):
|
||||
self.start_patches(patches)
|
||||
|
||||
ret = jdssd.create_export(ctx, vol, "connector")
|
||||
jdssd._create_target_volume.assert_called_once_with(vol)
|
||||
jdssd._ensure_target_volume.assert_called_once_with(vol)
|
||||
|
||||
self.stop_patches(patches)
|
||||
|
||||
@ -1397,6 +1397,8 @@ class TestOpenEJovianDSSDriver(test.TestCase):
|
||||
|
||||
vol = fake_volume.fake_volume_obj(ctx)
|
||||
vol.id = UUID_1
|
||||
vname = jcom.vname(UUID_1)
|
||||
|
||||
target_name = CONFIG_OK['target_prefix'] + UUID_1
|
||||
vol.provider_auth = 'chap user_name 123456789012'
|
||||
|
||||
@ -1417,7 +1419,8 @@ class TestOpenEJovianDSSDriver(test.TestCase):
|
||||
jdssd._ensure_target_volume(vol)
|
||||
|
||||
jdssd.ra.is_target.assert_called_once_with(target_name)
|
||||
jdssd.ra.is_target_lun.assert_called_once_with(target_name, UUID_1)
|
||||
|
||||
jdssd.ra.is_target_lun.assert_called_once_with(target_name, vname)
|
||||
|
||||
jdssd.ra.get_target_user.assert_called_once_with(target_name)
|
||||
|
||||
@ -1452,7 +1455,7 @@ class TestOpenEJovianDSSDriver(test.TestCase):
|
||||
jdssd._ensure_target_volume(vol)
|
||||
|
||||
jdssd.ra.is_target.assert_called_once_with(target_name)
|
||||
jdssd.ra.is_target_lun.assert_called_once_with(target_name, UUID_1)
|
||||
jdssd.ra.is_target_lun.assert_called_once_with(target_name, vname)
|
||||
|
||||
jdssd._attach_target_volume.assert_called_once_with(
|
||||
target_name, vname)
|
||||
|
@ -694,7 +694,7 @@ class JovianISCSIDriver(driver.ISCSIDriver):
|
||||
"""
|
||||
LOG.debug("create export for volume: %s.", volume.id)
|
||||
|
||||
self._create_target_volume(volume)
|
||||
self._ensure_target_volume(volume)
|
||||
|
||||
return {'provider_location': self._get_provider_location(volume.id)}
|
||||
|
||||
@ -876,8 +876,8 @@ class JovianISCSIDriver(driver.ISCSIDriver):
|
||||
self._create_target_volume(volume)
|
||||
return
|
||||
|
||||
if not self.ra.is_target_lun(target_name, volume.id):
|
||||
vname = jcom.vname(volume.id)
|
||||
vname = jcom.vname(volume.id)
|
||||
if not self.ra.is_target_lun(target_name, vname):
|
||||
self._attach_target_volume(target_name, vname)
|
||||
|
||||
try:
|
||||
|
@ -20,6 +20,7 @@ import re
|
||||
from oslo_log import log as logging
|
||||
|
||||
from cinder import exception
|
||||
from cinder.i18n import _
|
||||
from cinder.volume.drivers.open_e.jovian_common import exception as jexc
|
||||
from cinder.volume.drivers.open_e.jovian_common import rest_proxy
|
||||
|
||||
@ -45,8 +46,8 @@ class JovianRESTAPI(object):
|
||||
code = resp.get('code', 'Unknown')
|
||||
msg = resp.get('message', 'Unknown')
|
||||
|
||||
reason = ("Request to {url} failed with code: {code} "
|
||||
"of type:{eclass} reason:{message}")
|
||||
reason = _("Request to {url} failed with code: {code} "
|
||||
"of type:{eclass} reason:{message}")
|
||||
reason = reason.format(eclass=eclass,
|
||||
code=code,
|
||||
message=msg,
|
||||
@ -166,7 +167,7 @@ class JovianRESTAPI(object):
|
||||
|
||||
if resp["error"]:
|
||||
raise jexc.JDSSRESTException(
|
||||
'Failed to extend volume {}'.format(resp['error']['message']))
|
||||
_('Failed to extend volume %s' % resp['error']['message']))
|
||||
|
||||
raise jexc.JDSSRESTException('Failed to extend volume.')
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
JovianDSS driver: `Bug #1941746 <https://bugs.launchpad.net/cinder/+bug/1941746>`_: Fixed
|
||||
Fix ensure_export function failure in case of partial target recovery.
|
Loading…
Reference in New Issue
Block a user