self.configuration.nexenta_volume_compression = 'on'
self.configuration.nfs_mount_point_base = '/mnt/test'
self.configuration.nfs_mount_options = None
+ self.configuration.nexenta_nms_cache_volroot = False
self.nms_mock = self.mox.CreateMockAnything()
for mod in ('appliance', 'folder', 'server', 'volume', 'netstorsvc'):
setattr(self.nms_mock, mod, self.mox.CreateMockAnything())
+ self.nms_mock.__hash__ = lambda *_, **__: 1
self.stubs.Set(jsonrpc, 'NexentaJSONProxy',
lambda *_, **__: self.nms_mock)
self.drv = nfs.NexentaNfsDriver(configuration=self.configuration)
import hashlib
import os
-import urlparse
from oslo.config import cfg
from cinder.volume.drivers.nexenta import utils
from cinder.volume.drivers import nfs
+VERSION = '1.1.1'
LOG = logging.getLogger(__name__)
CONF = cfg.CONF
Version history:
1.0.0 - Initial driver version.
1.1.0 - Auto sharing for enclosing folder.
+ 1.1.1 - Added caching for NexentaStor appliance 'volroot' value.
"""
- VERSION = '1.1.0'
-
+ VERSION = VERSION
driver_prefix = 'nexenta'
def __init__(self, *args, **kwargs):
if self.configuration:
self.configuration.append_config_values(
options.NEXENTA_NFS_OPTIONS)
+ conf = self.configuration
+ self.nms_cache_volroot = conf.nexenta_nms_cache_volroot
+ self._nms2volroot = {}
def do_setup(self, context):
super(NexentaNfsDriver, self).do_setup(context)
ctxt = context.get_admin_context()
return self.db.volume_get(ctxt, snapshot['volume_id'])
+ def _get_volroot(self, nms):
+ """Returns volroot property value from NexentaStor appliance."""
+ if not self.nms_cache_volroot:
+ return nms.server.get_prop('volroot')
+ if nms not in self._nms2volroot:
+ self._nms2volroot[nms] = nms.server.get_prop('volroot')
+ return self._nms2volroot[nms]
+
def _get_share_datasets(self, nfs_share):
nms = self.share2nms[nfs_share]
- volroot = nms.server.get_prop('volroot')
+ volroot = self._get_volroot(nms)
path = nfs_share.split(':')[1][len(volroot):].strip('/')
volume_name = path.split('/')[0]
folder_name = '/'.join(path.split('/')[1:])
default=1.0,
help=('This will compare the allocated to available space on '
'the volume destination. If the ratio exceeds this '
- 'number, the destination will no longer be valid.'))
+ 'number, the destination will no longer be valid.')),
+ cfg.BoolOpt('nexenta_nms_cache_volroot',
+ default=True,
+ help=('If set True cache NexentaStor appliance volroot option '
+ 'value.'))
]
NEXENTA_VOLUME_OPTIONS = [
# destination will no longer be valid. (floating point value)
#nexenta_oversub_ratio=1.0
+# If set True cache NexentaStor appliance volroot option
+# value. (boolean value)
+#nexenta_nms_cache_volroot=true
+
# block size for volumes (blank=default,8KB) (string value)
#nexenta_blocksize=