Browse Source

Change iogrp property when retyping for Storwize/SVC

If need migration when retyping, Storwize/SVC driver will add a copy
of the volume first, and then start a task to check volume sync
progress which will run each 10 mins. At last delete the origin copy
when sync finished.

But iogrp property is not a parameter of addvdiskcopy, so the iogrp
of the copy volume is the same as the origin. If iogrp property is
diff between the old and new volume type, the property will not
change when retyped.

Change-Id: Ie4414bcf95fa6e61d7d618618f48837eef740da4
closed-bug: #1298247
tags/2014.2.b1
Li Min Liu 5 years ago
parent
commit
5c336123d3

+ 18
- 79
cinder/tests/test_storwize_svc.py View File

@@ -1068,7 +1068,7 @@ port_speed!N/A
1068 1068
         return('FlashCopy Mapping, id [' + fcmap_info['id'] +
1069 1069
                '], successfully created', '')
1070 1070
 
1071
-    def _cmd_gen_prestartfcmap(self, **kwargs):
1071
+    def _cmd_prestartfcmap(self, **kwargs):
1072 1072
         if 'obj' not in kwargs:
1073 1073
             return self._errors['CMMVC5701E']
1074 1074
         id_num = kwargs['obj']
@@ -1084,7 +1084,7 @@ port_speed!N/A
1084 1084
 
1085 1085
         return self._state_transition('prepare', fcmap)
1086 1086
 
1087
-    def _cmd_gen_startfcmap(self, **kwargs):
1087
+    def _cmd_startfcmap(self, **kwargs):
1088 1088
         if 'obj' not in kwargs:
1089 1089
             return self._errors['CMMVC5701E']
1090 1090
         id_num = kwargs['obj']
@@ -1375,6 +1375,16 @@ port_speed!N/A
1375 1375
             vol['IO_group_name'] = iogrp
1376 1376
         return ('', '')
1377 1377
 
1378
+    def _cmd_addvdiskaccess(self, **kwargs):
1379
+        if 'obj' not in kwargs:
1380
+            return self._errors['CMMVC5701E']
1381
+        return ('', '')
1382
+
1383
+    def _cmd_rmvdiskaccess(self, **kwargs):
1384
+        if 'obj' not in kwargs:
1385
+            return self._errors['CMMVC5701E']
1386
+        return ('', '')
1387
+
1378 1388
     def _add_host_to_list(self, connector):
1379 1389
         host_info = {}
1380 1390
         host_info['id'] = self._find_unused_id(self._hosts_list)
@@ -1402,81 +1412,8 @@ port_speed!N/A
1402 1412
 
1403 1413
         command = kwargs['cmd']
1404 1414
         del kwargs['cmd']
1405
-
1406
-        if command == 'lsmdiskgrp':
1407
-            out, err = self._cmd_lsmdiskgrp(**kwargs)
1408
-        elif command == 'lslicense':
1409
-            out, err = self._cmd_lslicense(**kwargs)
1410
-        elif command == 'lssystem':
1411
-            out, err = self._cmd_lssystem(**kwargs)
1412
-        elif command == 'lsnodecanister':
1413
-            out, err = self._cmd_lsnodecanister(**kwargs)
1414
-        elif command == 'lsnode':
1415
-            out, err = self._cmd_lsnode(**kwargs)
1416
-        elif command == 'lsportip':
1417
-            out, err = self._cmd_lsportip(**kwargs)
1418
-        elif command == 'lsfabric':
1419
-            out, err = self._cmd_lsfabric(**kwargs)
1420
-        elif command == 'mkvdisk':
1421
-            out, err = self._cmd_mkvdisk(**kwargs)
1422
-        elif command == 'rmvdisk':
1423
-            out, err = self._cmd_rmvdisk(**kwargs)
1424
-        elif command == 'expandvdisksize':
1425
-            out, err = self._cmd_expandvdisksize(**kwargs)
1426
-        elif command == 'lsvdisk':
1427
-            out, err = self._cmd_lsvdisk(**kwargs)
1428
-        elif command == 'lsiogrp':
1429
-            out, err = self._cmd_lsiogrp(**kwargs)
1430
-        elif command == 'mkhost':
1431
-            out, err = self._cmd_mkhost(**kwargs)
1432
-        elif command == 'addhostport':
1433
-            out, err = self._cmd_addhostport(**kwargs)
1434
-        elif command == 'chhost':
1435
-            out, err = self._cmd_chhost(**kwargs)
1436
-        elif command == 'rmhost':
1437
-            out, err = self._cmd_rmhost(**kwargs)
1438
-        elif command == 'lshost':
1439
-            out, err = self._cmd_lshost(**kwargs)
1440
-        elif command == 'lsiscsiauth':
1441
-            out, err = self._cmd_lsiscsiauth(**kwargs)
1442
-        elif command == 'mkvdiskhostmap':
1443
-            out, err = self._cmd_mkvdiskhostmap(**kwargs)
1444
-        elif command == 'rmvdiskhostmap':
1445
-            out, err = self._cmd_rmvdiskhostmap(**kwargs)
1446
-        elif command == 'lshostvdiskmap':
1447
-            out, err = self._cmd_lshostvdiskmap(**kwargs)
1448
-        elif command == 'lsvdiskhostmap':
1449
-            out, err = self._cmd_lsvdiskhostmap(**kwargs)
1450
-        elif command == 'mkfcmap':
1451
-            out, err = self._cmd_mkfcmap(**kwargs)
1452
-        elif command == 'prestartfcmap':
1453
-            out, err = self._cmd_gen_prestartfcmap(**kwargs)
1454
-        elif command == 'startfcmap':
1455
-            out, err = self._cmd_gen_startfcmap(**kwargs)
1456
-        elif command == 'stopfcmap':
1457
-            out, err = self._cmd_stopfcmap(**kwargs)
1458
-        elif command == 'rmfcmap':
1459
-            out, err = self._cmd_rmfcmap(**kwargs)
1460
-        elif command == 'chfcmap':
1461
-            out, err = self._cmd_chfcmap(**kwargs)
1462
-        elif command == 'lsfcmap':
1463
-            out, err = self._cmd_lsfcmap(**kwargs)
1464
-        elif command == 'lsvdiskfcmappings':
1465
-            out, err = self._cmd_lsvdiskfcmappings(**kwargs)
1466
-        elif command == 'migratevdisk':
1467
-            out, err = self._cmd_migratevdisk(**kwargs)
1468
-        elif command == 'addvdiskcopy':
1469
-            out, err = self._cmd_addvdiskcopy(**kwargs)
1470
-        elif command == 'lsvdiskcopy':
1471
-            out, err = self._cmd_lsvdiskcopy(**kwargs)
1472
-        elif command == 'rmvdiskcopy':
1473
-            out, err = self._cmd_rmvdiskcopy(**kwargs)
1474
-        elif command == 'chvdisk':
1475
-            out, err = self._cmd_chvdisk(**kwargs)
1476
-        elif command == 'movevdisk':
1477
-            out, err = self._cmd_movevdisk(**kwargs)
1478
-        else:
1479
-            out, err = ('', 'ERROR: Unsupported command')
1415
+        func = getattr(self, '_cmd_' + command)
1416
+        out, err = func(**kwargs)
1480 1417
 
1481 1418
         if (check_exit_code) and (len(err) != 0):
1482 1419
             raise processutils.ProcessExecutionError(exit_code=1,
@@ -2403,8 +2340,8 @@ class StorwizeSVCDriverTestCase(test.TestCase):
2403 2340
         host = {'host': 'foo', 'capabilities': cap}
2404 2341
         ctxt = context.get_admin_context()
2405 2342
 
2406
-        key_specs_old = {'compression': True}
2407
-        key_specs_new = {'compression': False}
2343
+        key_specs_old = {'compression': True, 'iogrp': 0}
2344
+        key_specs_new = {'compression': False, 'iogrp': 1}
2408 2345
         old_type_ref = volume_types.create(ctxt, 'old', key_specs_old)
2409 2346
         new_type_ref = volume_types.create(ctxt, 'new', key_specs_new)
2410 2347
 
@@ -2421,6 +2358,8 @@ class StorwizeSVCDriverTestCase(test.TestCase):
2421 2358
         self.driver.retype(ctxt, volume, new_type, diff, host)
2422 2359
         attrs = self.driver._helpers.get_vdisk_attributes(volume['name'])
2423 2360
         self.assertEqual('no', attrs['compressed_copy'])
2361
+        self.assertEqual('1', attrs['IO_group_id'], 'Volume retype '
2362
+                         'failed')
2424 2363
         self.driver.delete_volume(volume)
2425 2364
 
2426 2365
     def test_set_storage_code_level_success(self):

+ 11
- 1
cinder/volume/drivers/ibm/storwize_svc/__init__.py View File

@@ -703,7 +703,7 @@ class StorwizeSVCDriver(san.SanDriver):
703 703
                                                        'host': host})
704 704
 
705 705
         ignore_keys = ['protocol', 'multipath']
706
-        no_copy_keys = ['warning', 'autoexpand', 'easytier', 'iogrp']
706
+        no_copy_keys = ['warning', 'autoexpand', 'easytier']
707 707
         copy_keys = ['rsize', 'grainsize', 'compression']
708 708
         all_keys = ignore_keys + no_copy_keys + copy_keys
709 709
         old_opts = self._get_vdisk_params(volume['volume_type_id'])
@@ -729,11 +729,21 @@ class StorwizeSVCDriver(san.SanDriver):
729 729
             if dest_pool is None:
730 730
                 return False
731 731
 
732
+            if old_opts['iogrp'] != new_opts['iogrp']:
733
+                self._helpers.change_vdisk_iogrp(volume['name'], self._state,
734
+                                                 (new_opts['iogrp'],
735
+                                                  old_opts['iogrp']))
736
+
732 737
             new_op = self._helpers.add_vdisk_copy(volume['name'], dest_pool,
733 738
                                                   new_type, self._state,
734 739
                                                   self.configuration)
735 740
             self._add_vdisk_copy_op(ctxt, volume, new_op)
736 741
         else:
742
+            if old_opts['iogrp'] != new_opts['iogrp']:
743
+                self._helpers.change_vdisk_iogrp(volume['name'], self._state,
744
+                                                 (new_opts['iogrp'],
745
+                                                  old_opts['iogrp']))
746
+
737 747
             self._helpers.change_vdisk_options(volume['name'], vdisk_changes,
738 748
                                                new_opts, self._state)
739 749
 

+ 10
- 11
cinder/volume/drivers/ibm/storwize_svc/helpers.py View File

@@ -726,8 +726,6 @@ class StorwizeHelpers(object):
726 726
         return dest_pool
727 727
 
728 728
     def change_vdisk_options(self, vdisk, changes, opts, state):
729
-        if 'iogrp' in opts:
730
-            opts['iogrp'] = str(opts['iogrp'])
731 729
         if 'warning' in opts:
732 730
             opts['warning'] = '%s%%' % str(opts['warning'])
733 731
         if 'easytier' in opts:
@@ -735,18 +733,19 @@ class StorwizeHelpers(object):
735 733
         if 'autoexpand' in opts:
736 734
             opts['autoexpand'] = 'on' if opts['autoexpand'] else 'off'
737 735
 
738
-        if 'iogrp' in changes:
739
-            changes.remove('iogrp')
740
-            if state['code_level'] < (6, 4, 0, 0):
741
-                LOG.debug(_('Ignore change IO group as storage code level '
742
-                            'is %(code_level)s, below then '
743
-                            '6.4.0.0') % {'code_level': state['code_level']})
744
-            else:
745
-                self.ssh.movevdisk(vdisk, opts['iogrp'])
746
-
747 736
         for key in changes:
748 737
             self.ssh.chvdisk(vdisk, ['-' + key, opts[key]])
749 738
 
739
+    def change_vdisk_iogrp(self, vdisk, state, iogrp):
740
+        if state['code_level'] < (6, 4, 0, 0):
741
+            LOG.debug(_('Ignore change IO group as storage code level is '
742
+                        '%(code_level)s, below the required 6.4.0.0') %
743
+                      {'code_level': state['code_level']})
744
+        else:
745
+            self.ssh.movevdisk(vdisk, str(iogrp[0]))
746
+            self.ssh.addvdiskaccess(vdisk, str(iogrp[0]))
747
+            self.ssh.rmvdiskaccess(vdisk, str(iogrp[1]))
748
+
750 749
     def vdisk_by_uid(self, vdisk_uid):
751 750
         """Returns the properties of the vdisk with the specified UID.
752 751
 

+ 8
- 0
cinder/volume/drivers/ibm/storwize_svc/ssh.py View File

@@ -316,6 +316,14 @@ class StorwizeSSH(object):
316 316
         ssh_cmd = ['svctask', 'rmvdiskcopy', '-copy', copy_id, vdisk]
317 317
         self.run_ssh_assert_no_output(ssh_cmd)
318 318
 
319
+    def addvdiskaccess(self, vdisk, iogrp):
320
+        ssh_cmd = ['svctask', 'addvdiskaccess', '-iogrp', iogrp, vdisk]
321
+        self.run_ssh_assert_no_output(ssh_cmd)
322
+
323
+    def rmvdiskaccess(self, vdisk, iogrp):
324
+        ssh_cmd = ['svctask', 'rmvdiskaccess', '-iogrp', iogrp, vdisk]
325
+        self.run_ssh_assert_no_output(ssh_cmd)
326
+
319 327
 
320 328
 class CLIResponse(object):
321 329
     '''Parse SVC CLI output and generate iterable.'''

Loading…
Cancel
Save