Merge "VNX/PowerMax: Fix export locations"

This commit is contained in:
Zuul 2020-04-21 07:22:07 +00:00 committed by Gerrit Code Review
commit 8949b6e92e
5 changed files with 86 additions and 56 deletions

View File

@ -40,8 +40,9 @@ from manila import utils
3.0.0 - Rebranding to PowerMax
3.1.0 - Access Host details prevents a read-only share mounts
(bug #1845147)
3.2.0 - Wrong format of export locations (bug #1871999)
"""
VERSION = "3.1.0"
VERSION = "3.2.0"
LOG = log.getLogger(__name__)
@ -127,7 +128,9 @@ class PowerMaxStorageConnection(driver.StorageConnection):
elif share_proto == 'CIFS':
location = self._create_cifs_share(share_name, share_server)
return location
return [
{'path': location}
]
def _share_server_validation(self, share_server):
"""Validate the share server."""
@ -191,13 +194,9 @@ class PowerMaxStorageConnection(driver.StorageConnection):
self._get_context('CIFSShare').disable_share_access(share_name,
vdm_name)
locations = []
location = (r'\\%(interface)s\%(name)s' %
{'interface': interface, 'name': share_name})
locations.append(location)
return locations
return location
@enas_utils.log_enter_exit
def _create_nfs_share(self, share_name, share_server):
@ -249,7 +248,9 @@ class PowerMaxStorageConnection(driver.StorageConnection):
elif share_proto == 'CIFS':
location = self._create_cifs_share(share_name, share_server)
return location
return [
{'path': location}
]
def create_snapshot(self, context, snapshot, share_server=None):
"""Create snapshot from share."""

View File

@ -40,8 +40,9 @@ from manila import utils
4.0.0 - Bumped the version for Pike
5.0.0 - Bumped the version for Queens
9.0.0 - Bumped the version for Ussuri
9.0.1 - Fixes bug 1871999: wrong format of export locations
"""
VERSION = "9.0.0"
VERSION = "9.0.1"
LOG = log.getLogger(__name__)
@ -126,7 +127,9 @@ class VNXStorageConnection(driver.StorageConnection):
elif share_proto == 'CIFS':
location = self._create_cifs_share(share_name, share_server)
return location
return [
{'path': location}
]
def _share_server_validation(self, share_server):
"""Validate the share server."""
@ -246,7 +249,9 @@ class VNXStorageConnection(driver.StorageConnection):
elif share_proto == 'CIFS':
location = self._create_cifs_share(share_name, share_server)
return location
return [
{'path': location}
]
def create_snapshot(self, context, snapshot, share_server=None):
"""Create snapshot from share."""

View File

@ -173,9 +173,10 @@ class StorageConnectionTestCase(test.TestCase):
ssh_calls = [mock.call(self.cifs_share.cmd_disable_access(), True)]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, r'\\%s\%s' %
(fakes.FakeData.network_allocations_ip1,
share['name']),
self.assertEqual(location,
[{'path': r'\\%s\%s' % (
fakes.FakeData.network_allocations_ip1,
share['name'])}],
'CIFS export path is incorrect')
def test_create_cifs_share_with_ipv6(self):
@ -214,11 +215,12 @@ class StorageConnectionTestCase(test.TestCase):
ssh_calls = [mock.call(self.cifs_share.cmd_disable_access(), True)]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, r'\\%s.ipv6-literal.net\%s' %
(fakes.FakeData.network_allocations_ip3.replace(
':', '-'),
share['name']),
'CIFS export path is incorrect')
self.assertEqual(
location,
[{'path': r'\\%s.ipv6-literal.net\%s' % (
fakes.FakeData.network_allocations_ip3.replace(':', '-'),
share['name'])}],
'CIFS export path is incorrect')
def test_create_nfs_share(self):
share_server = fakes.SHARE_SERVER
@ -248,7 +250,8 @@ class StorageConnectionTestCase(test.TestCase):
ssh_calls = [mock.call(self.nfs_share.cmd_create(), True)]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, '192.168.1.2:/%s' % share['name'],
self.assertEqual(location,
[{'path': '192.168.1.2:/%s' % share['name']}],
'NFS export path is incorrect')
def test_create_nfs_share_with_ipv6(self):
@ -281,9 +284,10 @@ class StorageConnectionTestCase(test.TestCase):
ssh_calls = [mock.call(self.nfs_share.cmd_create(), True)]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, '[%s]:/%s' %
(fakes.FakeData.network_allocations_ip4,
share['name']),
self.assertEqual(location,
[{'path': '[%s]:/%s' % (
fakes.FakeData.network_allocations_ip4,
share['name'])}],
'NFS export path is incorrect')
def test_create_cifs_share_without_share_server(self):
@ -412,7 +416,8 @@ class StorageConnectionTestCase(test.TestCase):
]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, r'\\192.168.1.1\%s' % share['name'],
self.assertEqual(location,
[{'path': r'\\192.168.1.1\%s' % share['name']}],
'CIFS export path is incorrect')
def test_create_cifs_share_from_snapshot_with_ipv6(self):
@ -473,11 +478,12 @@ class StorageConnectionTestCase(test.TestCase):
]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, r'\\%s.ipv6-literal.net\%s' %
(fakes.FakeData.network_allocations_ip3.replace(':',
'-'),
share['name']),
'CIFS export path is incorrect')
self.assertEqual(
location,
[{'path': r'\\%s.ipv6-literal.net\%s' % (
fakes.FakeData.network_allocations_ip3.replace(':', '-'),
share['name'])}],
'CIFS export path is incorrect')
def test_create_nfs_share_from_snapshot(self):
share_server = fakes.SHARE_SERVER
@ -525,7 +531,8 @@ class StorageConnectionTestCase(test.TestCase):
]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, '192.168.1.2:/%s' % share['name'],
self.assertEqual(location,
[{'path': '192.168.1.2:/%s' % share['name']}],
'NFS export path is incorrect')
def test_create_nfs_share_from_snapshot_with_ipv6(self):
@ -574,10 +581,12 @@ class StorageConnectionTestCase(test.TestCase):
]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, '[%s]:/%s' %
(fakes.FakeData.network_allocations_ip4,
share['name']),
'NFS export path is incorrect')
self.assertEqual(
location,
[{'path': '[%s]:/%s' % (
fakes.FakeData.network_allocations_ip4,
share['name'])}],
'NFS export path is incorrect')
def test_create_share_with_incorrect_proto(self):
share_server = fakes.SHARE_SERVER

View File

@ -173,9 +173,10 @@ class StorageConnectionTestCase(test.TestCase):
ssh_calls = [mock.call(self.cifs_share.cmd_disable_access(), True)]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, r'\\%s\%s' %
(fakes.FakeData.network_allocations_ip1,
share['name']),
self.assertEqual(location,
[{'path': r'\\%s\%s' % (
fakes.FakeData.network_allocations_ip1,
share['name'])}],
'CIFS export path is incorrect')
def test_create_cifs_share_with_ipv6(self):
@ -214,11 +215,13 @@ class StorageConnectionTestCase(test.TestCase):
ssh_calls = [mock.call(self.cifs_share.cmd_disable_access(), True)]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, r'\\%s.ipv6-literal.net\%s' %
(fakes.FakeData.network_allocations_ip3.replace(':',
'-'),
share['name']),
'CIFS export path is incorrect')
self.assertEqual(
location,
[{'path': r'\\%s.ipv6-literal.net\%s' % (
fakes.FakeData.network_allocations_ip3.replace(':', '-'),
share['name'])}],
'CIFS export path is incorrect'
)
def test_create_nfs_share(self):
share_server = fakes.SHARE_SERVER
@ -248,7 +251,8 @@ class StorageConnectionTestCase(test.TestCase):
ssh_calls = [mock.call(self.nfs_share.cmd_create(), True)]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, '192.168.1.2:/%s' % share['name'],
self.assertEqual(location,
[{'path': '192.168.1.2:/%s' % share['name']}],
'NFS export path is incorrect')
def test_create_nfs_share_with_ipv6(self):
@ -281,9 +285,10 @@ class StorageConnectionTestCase(test.TestCase):
ssh_calls = [mock.call(self.nfs_share.cmd_create(), True)]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, '[%s]:/%s' %
(fakes.FakeData.network_allocations_ip4,
share['name']),
self.assertEqual(location,
[{'path': '[%s]:/%s' % (
fakes.FakeData.network_allocations_ip4,
share['name'])}],
'NFS export path is incorrect')
def test_create_cifs_share_without_share_server(self):
@ -412,7 +417,8 @@ class StorageConnectionTestCase(test.TestCase):
]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, r'\\192.168.1.1\%s' % share['name'],
self.assertEqual(location,
[{'path': r'\\192.168.1.1\%s' % share['name']}],
'CIFS export path is incorrect')
def test_create_cifs_share_from_snapshot_with_ipv6(self):
@ -473,11 +479,12 @@ class StorageConnectionTestCase(test.TestCase):
]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, r'\\%s.ipv6-literal.net\%s' %
(fakes.FakeData.network_allocations_ip3.replace(':',
'-'),
share['name']),
'CIFS export path is incorrect')
self.assertEqual(
location,
[{'path': r'\\%s.ipv6-literal.net\%s' % (
fakes.FakeData.network_allocations_ip3.replace(':', '-'),
share['name'])}],
'CIFS export path is incorrect')
def test_create_nfs_share_from_snapshot(self):
share_server = fakes.SHARE_SERVER
@ -525,7 +532,8 @@ class StorageConnectionTestCase(test.TestCase):
]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, '192.168.1.2:/%s' % share['name'],
self.assertEqual(location,
[{'path': '192.168.1.2:/%s' % share['name']}],
'NFS export path is incorrect')
def test_create_nfs_share_from_snapshot_with_ipv6(self):
@ -574,9 +582,10 @@ class StorageConnectionTestCase(test.TestCase):
]
ssh_cmd_mock.assert_has_calls(ssh_calls)
self.assertEqual(location, '[%s]:/%s' %
(fakes.FakeData.network_allocations_ip4,
share['name']),
self.assertEqual(location,
[{'path': '[%s]:/%s' % (
fakes.FakeData.network_allocations_ip4,
share['name'])}],
'NFS export path is incorrect')
def test_create_share_with_incorrect_proto(self):

View File

@ -0,0 +1,6 @@
---
fixes:
- |
Dell EMC VNX and PowerMax Drivers: Fixes `bug 1871999
<https://bugs.launchpad.net/manila/+bug/1871999>`__ to make `create_share`
and `create_share_from_snapshot` return correct list of export locations.