Fix volume_driver configuration < ocata
For releases prior to ocata, the volume_driver key must be provided by the CephContext to ensure that a single driver is set for cinder. Specialize behaviour for >= ocata only, resolving issues with pre ocata deployments with direct relations to ceph. Change-Id: I9ff47853ab0726ed5c77c67f21f873349bc64f7b
This commit is contained in:
parent
8641e81498
commit
d1714de91e
@ -70,8 +70,12 @@ class CephContext(OSContextGenerator):
|
||||
volume_driver = 'cinder.volume.drivers.rbd.RBDDriver'
|
||||
else:
|
||||
volume_driver = 'cinder.volume.driver.RBDDriver'
|
||||
if os_release('cinder-common') >= "ocata":
|
||||
driver_key = 'ceph_volume_driver'
|
||||
else:
|
||||
driver_key = 'volume_driver'
|
||||
return {
|
||||
'ceph_volume_driver': volume_driver,
|
||||
driver_key: volume_driver,
|
||||
# ensure_ceph_pool() creates pool based on service name.
|
||||
'rbd_pool': service,
|
||||
'rbd_user': service,
|
||||
|
@ -75,7 +75,7 @@ class TestCinderContext(CharmTestCase):
|
||||
self.service_name.return_value = service
|
||||
self.assertEquals(
|
||||
contexts.CephContext()(),
|
||||
{'ceph_volume_driver': 'cinder.volume.driver.RBDDriver',
|
||||
{'volume_driver': 'cinder.volume.driver.RBDDriver',
|
||||
'rbd_pool': service,
|
||||
'rbd_user': service,
|
||||
'host': service})
|
||||
@ -85,6 +85,18 @@ class TestCinderContext(CharmTestCase):
|
||||
self.os_release.return_value = 'icehouse'
|
||||
service = 'mycinder'
|
||||
self.service_name.return_value = service
|
||||
self.assertEquals(
|
||||
contexts.CephContext()(),
|
||||
{'volume_driver': 'cinder.volume.drivers.rbd.RBDDriver',
|
||||
'rbd_pool': service,
|
||||
'rbd_user': service,
|
||||
'host': service})
|
||||
|
||||
def test_ceph_related_ocata(self):
|
||||
self.relation_ids.return_value = ['ceph:0']
|
||||
self.os_release.return_value = 'ocata'
|
||||
service = 'mycinder'
|
||||
self.service_name.return_value = service
|
||||
self.assertEquals(
|
||||
contexts.CephContext()(),
|
||||
{'ceph_volume_driver': 'cinder.volume.drivers.rbd.RBDDriver',
|
||||
|
Loading…
Reference in New Issue
Block a user