Merge "[Dell EMC Unity] Create with user capacity"

This commit is contained in:
Jenkins 2017-03-27 13:43:04 +00:00 committed by Gerrit Code Review
commit ffe135a5b3
6 changed files with 23 additions and 27 deletions

View File

@ -17,7 +17,6 @@ import six
from oslo_log import log
from oslo_utils import excutils
from oslo_utils import importutils
from oslo_utils import units
storops = importutils.try_import('storops')
if storops:
@ -27,12 +26,10 @@ if storops:
from manila.common import constants as const
from manila import exception
from manila.i18n import _, _LI, _LE, _LW
from manila.share.drivers.dell_emc.plugins.unity import utils
LOG = log.getLogger(__name__)
# Minimun file system size in Unity
MIN_FS_SIZE_IN_GB = 3
class UnityClient(object):
def __init__(self, host, username, password):
@ -81,9 +78,9 @@ class UnityClient(object):
:param share_name: file system and share name
:param size_gb: file system size
"""
size = self.get_valid_fs_size_in_byte(size_gb)
size = utils.gib_to_byte(size_gb)
pool.create_nfs_share(
nas_server, share_name, size)
nas_server, share_name, size, user_cap=True)
def get_share(self, name, share_proto):
# Validate the share protocol
@ -103,11 +100,12 @@ class UnityClient(object):
def create_filesystem(self, pool, nas_server, share_name, size_gb, proto):
try:
size = self.get_valid_fs_size_in_byte(size_gb)
size = utils.gib_to_byte(size_gb)
return pool.create_filesystem(nas_server,
share_name,
size,
proto=proto)
proto=proto,
user_cap=True)
except storops_ex.UnityFileSystemNameAlreadyExisted:
LOG.debug('Filesystem %s already exists, '
'ignoring filesystem creation.', share_name)
@ -297,18 +295,10 @@ class UnityClient(object):
return link_up_ports
@staticmethod
def get_valid_fs_size_in_byte(size_gb):
if size_gb < MIN_FS_SIZE_IN_GB:
LOG.debug('Using %(min_size)s GB file system for shares less than '
'%(min_size)s GB.', {'min_size': MIN_FS_SIZE_IN_GB})
size_gb = MIN_FS_SIZE_IN_GB
return size_gb * units.Gi
def extend_filesystem(self, fs, new_size_gb):
size = self.get_valid_fs_size_in_byte(new_size_gb)
size = utils.gib_to_byte(new_size_gb)
try:
fs.extend(size)
fs.extend(size, user_cap=True)
except storops_ex.UnityNothingToModifyError:
LOG.debug('The size of the file system %(id)s is %(size)s '
'bytes.', {'id': fs.get_id(), 'size': size})

View File

@ -35,7 +35,7 @@ from manila.share.drivers.dell_emc.plugins.vnx import utils as emc_utils
from manila.share import utils as share_utils
from manila import utils
VERSION = "2.0.0"
VERSION = "3.0.0"
LOG = log.getLogger(__name__)
SUPPORTED_NETWORK_TYPES = (None, 'flat', 'vlan')

View File

@ -15,6 +15,7 @@
""" Utility module for EMC Unity Manila Driver """
from oslo_utils import fnmatch
from oslo_utils import units
from manila import exception
from manila.i18n import _
@ -73,3 +74,7 @@ def find_ports_by_mtu(all_ports, port_ids_conf, mtu):
'%{mtu}s.') % {'conf': port_ids_conf, 'mtu': mtu})
raise exception.ShareBackendException(msg=msg)
return managed_port_map
def gib_to_byte(size_gib):
return size_gib * units.Gi

View File

@ -170,14 +170,6 @@ class TestClient(test.TestCase):
self.assertEqual('SPA', sp.name)
@ddt.data((1, 3), (2, 3), (3, 3), (4, 4), (10, 10))
@ddt.unpack
@res_mock.patch_client
def test_get_valid_fs_size(self, client, share_size_gb, fs_size_gb):
size = client.get_valid_fs_size_in_byte(share_size_gb)
self.assertEqual(fs_size_gb * units.Gi, size)
@res_mock.mock_client_input
@res_mock.patch_client
def test_extend_filesystem(self, client, mocked_input):

View File

@ -14,6 +14,7 @@
# under the License.
import ddt
from oslo_utils import units
from manila.share.drivers.dell_emc.plugins.unity import utils
from manila import test
@ -111,3 +112,6 @@ class TestUtils(test.TestCase):
self.assertEqual({'spa': {'spa_eth0', 'spa_la_1'},
'spb': {'spb_eth0', 'spb_la_1'}},
port_map)
def test_gb_to_byte(self):
self.assertEqual(3 * units.Gi, utils.gib_to_byte(3))

View File

@ -0,0 +1,5 @@
---
features:
- Dell EMC Unity driver is changed to create shares with the available space
instead of allocated space as the same as the size specified by user.
- Dell EMC Unity driver version is changed to 3.0.0 for Pike release.