Add Upgrade Check for Drivers Removed in Stein
This patch adds a check for configuration of CoprHD, HGST and ITRI DISCO drivers which were all removed in the Stein release. The upgrade check will fail if any of these drivers are configured in enabled_backends. Change-Id: I285cc12a28f8648a9aecd47c82a7695f5f2e4f00 Co-authored-by: Brian Rosmaita <romaita.fossdev@gmail.com>
This commit is contained in:
parent
bc18906f01
commit
e78e05c95d
@ -37,6 +37,9 @@ CONF = cfg.CONF
|
||||
SUCCESS = uc.Code.SUCCESS
|
||||
FAILURE = uc.Code.FAILURE
|
||||
WARNING = uc.Code.WARNING
|
||||
REMOVED_DRVRS = ["coprhd",
|
||||
"disco",
|
||||
"hgst", ]
|
||||
|
||||
|
||||
def _get_enabled_drivers():
|
||||
@ -197,11 +200,42 @@ class Checks(uc.UpgradeCommands):
|
||||
|
||||
return uc.Result(SUCCESS)
|
||||
|
||||
def _check_removed_drivers(self):
|
||||
"""Checks to ensure that no removed drivers are configured.
|
||||
|
||||
Checks start with drivers removed in the Stein release.
|
||||
"""
|
||||
removed_drivers = []
|
||||
for volume_driver in _get_enabled_drivers():
|
||||
for removed_driver in REMOVED_DRVRS:
|
||||
if removed_driver in volume_driver:
|
||||
removed_drivers.append(volume_driver)
|
||||
|
||||
if removed_drivers:
|
||||
if len(removed_drivers) > 1:
|
||||
return uc.Result(
|
||||
FAILURE,
|
||||
'The following drivers, which no longer exist, were found '
|
||||
'configured in your cinder.conf file:\n%s.\n'
|
||||
'These drivers have been removed and all data should '
|
||||
'be migrated off of the associated backends before '
|
||||
'upgrading Cinder.' % ",\n".join(removed_drivers))
|
||||
else:
|
||||
return uc.Result(
|
||||
FAILURE,
|
||||
'Found driver %s configured in your cinder.conf file. '
|
||||
'This driver has been removed and all data should '
|
||||
'be migrated off of this backend before upgrading '
|
||||
'Cinder.' % removed_drivers[0])
|
||||
|
||||
return uc.Result(SUCCESS)
|
||||
|
||||
_upgrade_checks = (
|
||||
# added in Stein
|
||||
('Backup Driver Path', _check_backup_module),
|
||||
('Use of Policy File', _check_policy_file),
|
||||
('Windows Driver Path', _check_legacy_windows_config),
|
||||
('Removed Drivers', _check_removed_drivers),
|
||||
# added in Train
|
||||
('Periodic Interval Use', _check_periodic_interval),
|
||||
('Use of Nest Quota Driver', _check_nested_quota),
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_upgradecheck import upgradecheck as uc
|
||||
import testtools
|
||||
@ -50,6 +51,10 @@ class TestCinderStatus(testtools.TestCase):
|
||||
CONF.set_override(key, value, group=group)
|
||||
self.addCleanup(CONF.clear_override, key, group=group)
|
||||
|
||||
def _set_backup_driver(self, driver_path):
|
||||
CONF.set_override('backup_driver', driver_path)
|
||||
self.addCleanup(CONF.clear_override, 'backup_driver')
|
||||
|
||||
def _set_volume_driver(self, volume_driver, enabled_backend):
|
||||
CONF.register_opts(volume_manager.volume_backend_opts,
|
||||
group=enabled_backend)
|
||||
@ -155,3 +160,52 @@ class TestCinderStatus(testtools.TestCase):
|
||||
self._set_config('enabled_backends', None)
|
||||
result = self.checks._check_legacy_windows_config()
|
||||
self.assertEqual(uc.Code.SUCCESS, result.code)
|
||||
|
||||
def test_check_removed_drivers(self):
|
||||
self._set_volume_driver(
|
||||
'cinder.volume.drivers.lvm.LVMVolumeDriver',
|
||||
'winiscsi')
|
||||
result = self.checks._check_removed_drivers()
|
||||
self.assertEqual(uc.Code.SUCCESS, result.code)
|
||||
|
||||
@ddt.data('cinder.volume.drivers.coprhd.fc.EMCCoprHDFCDriver',
|
||||
'cinder.volume.drivers.coprhd.iscsi.EMCCoprHDISCSIDriver',
|
||||
'cinder.volume.drivers.coprhd.scaleio.EMCCoprHDScaleIODriver',
|
||||
'cinder.volume.drivers.disco.disco.DiscoDriver',
|
||||
'cinder.volume.drivers.hgst.HGSTDriver')
|
||||
def test_check_removed_drivers_fail(self, volume_driver):
|
||||
self._set_volume_driver(
|
||||
volume_driver,
|
||||
'testDriver')
|
||||
result = self.checks._check_removed_drivers()
|
||||
self.assertEqual(uc.Code.FAILURE, result.code)
|
||||
self.assertIn(volume_driver, result.details)
|
||||
# Check for singular version of result message
|
||||
self.assertIn('This driver has been removed', result.details)
|
||||
|
||||
def test_check_multiple_removed_drivers_fail(self):
|
||||
d1 = 'cinder.volume.drivers.coprhd.fc.EMCCoprHDFCDriver'
|
||||
d3 = 'cinder.volume.drivers.coprhd.scaleio.EMCCoprHDScaleIODriver'
|
||||
d5 = 'cinder.volume.drivers.hgst.HGSTDriver'
|
||||
d2 = 'cinder.volume.drivers.foo.iscsi.FooDriver'
|
||||
d4 = 'cinder.volume.drivers.bar.fc.BarFCDriver'
|
||||
self._set_volume_driver(d1, 'b1')
|
||||
self._set_volume_driver(d2, 'b2')
|
||||
self._set_volume_driver(d3, 'b3')
|
||||
self._set_volume_driver(d4, 'b4')
|
||||
self._set_volume_driver(d5, 'b5')
|
||||
CONF.set_override('enabled_backends', 'b1,b2,b3,b4,b5')
|
||||
result = self.checks._check_removed_drivers()
|
||||
self.assertEqual(uc.Code.FAILURE, result.code)
|
||||
self.assertIn(d1, result.details)
|
||||
self.assertIn(d3, result.details)
|
||||
self.assertIn(d5, result.details)
|
||||
self.assertNotIn(d2, result.details)
|
||||
self.assertNotIn(d4, result.details)
|
||||
# check for plural version of result message
|
||||
self.assertIn('The following drivers', result.details)
|
||||
|
||||
def test_check_removed_drivers_no_drivers(self):
|
||||
self._set_config('enabled_backends', None)
|
||||
result = self.checks._check_removed_drivers()
|
||||
self.assertEqual(uc.Code.SUCCESS, result.code)
|
||||
|
@ -90,6 +90,12 @@ Upgrade
|
||||
* Checks for the presence of a **policy.json** file have been added to warn
|
||||
if policy changes should be present in a **policy.yaml** file.
|
||||
* Ensure that correct volume_driver path is used for Windows iSCSI driver.
|
||||
* Ensure that none of the volume drivers removed in Stein are enabled.
|
||||
Please note that if a driver is in **cinder.conf** but not in the
|
||||
``enabled_drivers`` config option this check will not catch the problem.
|
||||
If you have used the CoprHD, ITRI Disco or HGST drivers in the past you
|
||||
should ensure that any data from these backends is transferred to a
|
||||
supported storage array before upgrade.
|
||||
|
||||
**15.0.0 (Train)**
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
A new check is added to the ``cinder-status upgrade check`` CLI to check
|
||||
for the configuration of CoprHD, HGST or ITRI DISCO drivers. These
|
||||
drivers were removed in the Stein release and should not be
|
||||
configured at the time of upgrade.
|
Loading…
Reference in New Issue
Block a user