Allow users to choose to flattern volumes

Expose rbd_flatten_volume_from_snapshot to the user which allows
then to flatten volumes created from snapshots to remove
dependency from volume to snapshot.

Change-Id: I22a3c82535efac5334dd5deaadbba0dd1eae83ab
Closes-Bug: #1824582
This commit is contained in:
Liam Young 2019-04-17 14:49:04 +00:00
parent 15016cfe9a
commit 2f8b158b15
4 changed files with 14 additions and 1 deletions

View File

@ -39,3 +39,10 @@ options:
type: string
description: |
Optionally specify an existing rbd pool that cinder should map to.
rbd-flatten-volume-from-snapshot:
default:
type: boolean
default: False
description: |
Flatten volumes created from snapshots to remove dependency from
volume to snapshot. Supported on Queens+

View File

@ -68,5 +68,8 @@ class CephSubordinateContext(OSContextGenerator):
if CompareOpenStackReleases(os_codename) >= "queens":
section[service].append(('rbd_exclusive_cinder_pool', True))
section[service].append(
('rbd_flatten_volume_from_snapshot',
config('rbd-flatten-volume-from-snapshot')))
return {'cinder': {'/etc/cinder/cinder.conf': {'sections': section}}}

View File

@ -365,6 +365,8 @@ class CinderCephBasicDeployment(OpenStackAmuletDeployment):
if self._get_openstack_release() >= self.xenial_queens:
section = sub_dict['cinder']["/etc/cinder/cinder.conf"]["sections"]
section["cinder-ceph"].append(('rbd_exclusive_cinder_pool', True))
section["cinder-ceph"].append(
('rbd_flatten_volume_from_snapshot', False))
expected = {
'subordinate_configuration': json.dumps(sub_dict),

View File

@ -108,7 +108,8 @@ class TestCinderContext(CharmTestCase):
('rbd_ceph_conf',
'/var/lib/charm/mycinder/ceph.conf'),
('report_discard_supported', True),
('rbd_exclusive_cinder_pool', True)
('rbd_exclusive_cinder_pool', True),
('rbd_flatten_volume_from_snapshot', False)
]
}
}