Browse Source

Merge "Fix LVM driver not handling IPv6 in recovery mode"

Zuul 1 year ago
parent
commit
6368a9e887

+ 2
- 1
manila/share/drivers/helpers.py View File

@@ -241,8 +241,9 @@ class NFSHelper(NASHelperBase):
241 241
 
242 242
             hosts = self.get_host_list(out, local_path)
243 243
             for host in hosts:
244
+                parsed_host = self._get_parsed_address_or_cidr(host)
244 245
                 self._ssh_exec(server, ['sudo', 'exportfs', '-u',
245
-                                        ':'.join((host, local_path))])
246
+                                        ':'.join((parsed_host, local_path))])
246 247
             self._sync_nfs_temp_and_perm_files(server)
247 248
             for access in access_rules:
248 249
                 rules_options = '%s,no_subtree_check,no_root_squash'

+ 15
- 7
manila/tests/share/drivers/test_helpers.py View File

@@ -226,14 +226,22 @@ class NFSHelperTestCase(test.TestCase):
226 226
         result = self._helper.get_host_list(fake_exportfs, '/shares/share-1')
227 227
         self.assertEqual(expected, result)
228 228
 
229
-    @ddt.data(const.ACCESS_LEVEL_RW, const.ACCESS_LEVEL_RO)
230
-    def test_update_access_recovery_mode(self, access_level):
229
+    @ddt.data({"level": const.ACCESS_LEVEL_RW, "ip": "1.1.1.1",
230
+               "expected": "1.1.1.1"},
231
+              {"level": const.ACCESS_LEVEL_RO, "ip": "1.1.1.1",
232
+               "expected": "1.1.1.1"},
233
+              {"level": const.ACCESS_LEVEL_RW, "ip": "fd12:abcd::10",
234
+               "expected": "[fd12:abcd::10]"},
235
+              {"level": const.ACCESS_LEVEL_RO, "ip": "fd12:abcd::10",
236
+               "expected": "[fd12:abcd::10]"})
237
+    @ddt.unpack
238
+    def test_update_access_recovery_mode(self, level, ip, expected):
231 239
         expected_mount_options = '%s,no_subtree_check,no_root_squash'
232 240
         access_rules = [test_generic.get_fake_access_rule(
233
-            '1.1.1.1', access_level), ]
241
+            ip, level), ]
234 242
         self.mock_object(self._helper, '_sync_nfs_temp_and_perm_files')
235 243
         self.mock_object(self._helper, 'get_host_list',
236
-                         mock.Mock(return_value=['1.1.1.1']))
244
+                         mock.Mock(return_value=[ip]))
237 245
         self._helper.update_access(self.server, self.share_name, access_rules,
238 246
                                    [], [])
239 247
         local_path = os.path.join(CONF.share_mount_path, self.share_name)
@@ -241,11 +249,11 @@ class NFSHelperTestCase(test.TestCase):
241 249
             mock.call(self.server, ['sudo', 'exportfs']),
242 250
             mock.call(
243 251
                 self.server, ['sudo', 'exportfs', '-u',
244
-                              ':'.join([access_rules[0]['access_to'],
252
+                              ':'.join([expected,
245 253
                                         local_path])]),
246 254
             mock.call(self.server, ['sudo', 'exportfs', '-o',
247
-                                    expected_mount_options % access_level,
248
-                                    ':'.join(['1.1.1.1', local_path])]),
255
+                                    expected_mount_options % level,
256
+                                    ':'.join([expected, local_path])]),
249 257
         ])
250 258
         self._helper._sync_nfs_temp_and_perm_files.assert_called_with(
251 259
             self.server)

+ 5
- 0
releasenotes/notes/bug-1746723-8b89633062885f0b.yaml View File

@@ -0,0 +1,5 @@
1
+---
2
+fixes:
3
+  - LVM driver now correctly parses IPv6 addresses during a Host-assisted
4
+    share migration.
5
+

Loading…
Cancel
Save