From 8c57c6d3ee32c6ad3db7f4936412aa4773ff5ada Mon Sep 17 00:00:00 2001 From: John Griffith Date: Thu, 15 Jun 2017 17:36:37 -0600 Subject: [PATCH] Set default lvm_type to auto We've had an lvm_type=thin for quite some time, and we've wanted to make it Cinders default for a while, but there's no clean way to migrate on upgrades. So, we have a compromise, detect if the deployment has volumes (including the thin pool). If there are no LVs or if the thin pool exists, use thin. Otherwise, use the old thick lvm-default. This patch makes the default setting "auto" instead of "default" (which is actually thick). DocImpact: Need to update docs to reflect the default setting for new deployments is auto (thin) Change-Id: If25e814eb6282fef9a1dd30d17c80eab6860e275 --- cinder/tests/unit/volume/drivers/test_lvm_driver.py | 6 ++++-- cinder/volume/drivers/lvm.py | 2 +- .../notes/lvm-type-default-to-auto-a2ad554fc8bb25f2.yaml | 7 +++++++ 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/lvm-type-default-to-auto-a2ad554fc8bb25f2.yaml diff --git a/cinder/tests/unit/volume/drivers/test_lvm_driver.py b/cinder/tests/unit/volume/drivers/test_lvm_driver.py index bbbf1beb824..a86d6e62b7f 100644 --- a/cinder/tests/unit/volume/drivers/test_lvm_driver.py +++ b/cinder/tests/unit/volume/drivers/test_lvm_driver.py @@ -98,11 +98,13 @@ class LVMVolumeDriverTestCase(test_driver.BaseDriverTestCase): @mock.patch.object(volutils, 'get_all_volume_groups', return_value=[{'name': 'cinder-volumes'}]) - def test_check_for_setup_error(self, vgs): + @mock.patch('cinder.brick.local_dev.lvm.LVM.get_lvm_version', + return_value=(2, 2, 100)) + def test_check_for_setup_error(self, _mock_get_version, vgs): vg_obj = fake_lvm.FakeBrickLVM('cinder-volumes', False, None, - 'default') + 'auto') configuration = conf.Configuration(fake_opt, 'fake_group') lvm_driver = lvm.LVMVolumeDriver(configuration=configuration, diff --git a/cinder/volume/drivers/lvm.py b/cinder/volume/drivers/lvm.py index d8d7e9ffaa6..4f88ec09afd 100644 --- a/cinder/volume/drivers/lvm.py +++ b/cinder/volume/drivers/lvm.py @@ -51,7 +51,7 @@ volume_opts = [ help='If >0, create LVs with multiple mirrors. Note that ' 'this requires lvm_mirrors + 2 PVs with available space'), cfg.StrOpt('lvm_type', - default='default', + default='auto', choices=['default', 'thin', 'auto'], help='Type of LVM volumes to deploy; (default, thin, or auto). ' 'Auto defaults to thin if thin is supported.'), diff --git a/releasenotes/notes/lvm-type-default-to-auto-a2ad554fc8bb25f2.yaml b/releasenotes/notes/lvm-type-default-to-auto-a2ad554fc8bb25f2.yaml new file mode 100644 index 00000000000..130b9db7173 --- /dev/null +++ b/releasenotes/notes/lvm-type-default-to-auto-a2ad554fc8bb25f2.yaml @@ -0,0 +1,7 @@ +--- +other: + - | + Modify default lvm_type setting from thick to auto. This will result in + Cinder preferring thin on init, if there are no LV's in the VG it will + create a thin-pool and use thin. If there are LV's and no thin-pool + it will continue using thick.