Fix for NexentaEdge jsonrpc url formatting

LOG.info if the volume is already deleted on appliance instead of
raising an error.
Convert nexenta_blocksize to str before sending request.
Changed the chunksize default to recommended value of 32768.

Change-Id: I3f8d7c668450972e336450488b75ce2ab7d78ba1
This commit is contained in:
Mikhail Khodos 2016-03-11 17:20:23 -08:00 committed by Alexey Khodos
parent 4e67160776
commit 57bde97bc9
5 changed files with 14 additions and 9 deletions

View File

@ -17,6 +17,7 @@
import mock
from cinder import context
from cinder import exception
from cinder import test
from cinder.volume import configuration as conf
from cinder.volume.drivers.nexenta.nexentaedge import iscsi
@ -97,6 +98,8 @@ class TestNexentaEdgeISCSIDriver(test.TestCase):
self.assertRaises(RuntimeError, self.driver.create_volume, MOCK_VOL)
def test_delete_volume(self):
self.mock_api.side_effect = exception.VolumeBackendAPIException(
'No volume')
self.driver.delete_volume(MOCK_VOL)
self.mock_api.assert_called_with(NEDGE_URL, {
'objectPath': NEDGE_BUCKET + '/' + MOCK_VOL['id']

View File

@ -17,6 +17,7 @@
.. automodule:: nexenta.iscsi
"""
import six
from oslo_log import log as logging
from oslo_utils import excutils
@ -214,7 +215,7 @@ class NexentaISCSIDriver(driver.ISCSIDriver):
self.nms.zvol.create(
self._get_zvol_name(volume['name']),
'%sG' % (volume['size'],),
self.configuration.nexenta_blocksize,
six.text_type(self.configuration.nexenta_blocksize),
self.configuration.nexenta_sparse)
def extend_volume(self, volume, new_size):

View File

@ -20,7 +20,7 @@ from oslo_utils import excutils
from oslo_utils import units
from cinder import exception
from cinder.i18n import _, _LE
from cinder.i18n import _, _LE, _LI
from cinder.volume import driver
from cinder.volume.drivers.nexenta.nexentaedge import jsonrpc
from cinder.volume.drivers.nexenta import options
@ -164,8 +164,9 @@ class NexentaEdgeISCSIDriver(driver.ISCSIDriver):
'/iscsi', {'objectPath': self.bucket_path +
'/' + volume['name']})
except exception.VolumeBackendAPIException:
with excutils.save_and_reraise_exception():
LOG.exception(_LE('Error deleting volume'))
LOG.info(
_LI('Volume was already deleted from appliance, skipping.'),
resource=volume)
def extend_volume(self, volume, new_size):
try:

View File

@ -47,8 +47,8 @@ class NexentaEdgeJSONProxy(object):
@property
def url(self):
return '%s://%s:%s%s' % (self.protocol,
self.host, self.port, self.path)
return '%s://%s:%s/%s' % (self.protocol,
self.host, self.port, self.path)
def __getattr__(self, name):
if not self.method:
@ -68,7 +68,7 @@ class NexentaEdgeJSONProxy(object):
@retry(retry_exc_tuple, interval=1, retries=6)
def __call__(self, *args):
self.path += args[0]
self.path = args[0]
data = None
if len(args) > 1:
data = json.dumps(args[1])
@ -79,7 +79,7 @@ class NexentaEdgeJSONProxy(object):
'Authorization': 'Basic %s' % auth
}
LOG.debug('Sending JSON data: %s', self.url)
LOG.debug('Sending JSON data: %s, data: %s', self.url, data)
if self.method == 'get':
req = requests.get(self.url, headers=headers)

View File

@ -44,7 +44,7 @@ NEXENTA_EDGE_OPTS = [
help='NexentaEdge iSCSI Gateway client '
'address for non-VIP service'),
cfg.IntOpt('nexenta_chunksize',
default=16384,
default=32768,
help='NexentaEdge iSCSI LUN object chunk size')
]