Update use of removed driver name for icehouse and above
This commit is contained in:
parent
425ea678bd
commit
5a81874c2c
@ -9,6 +9,10 @@ from charmhelpers.contrib.openstack.context import (
|
||||
ApacheSSLContext as SSLContext,
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
get_os_codename_install_source
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
determine_apache_port,
|
||||
determine_api_port,
|
||||
@ -35,8 +39,13 @@ class CephContext(OSContextGenerator):
|
||||
if not relation_ids('ceph'):
|
||||
return {}
|
||||
service = service_name()
|
||||
if get_os_codename_install_source(config('openstack-origin')) \
|
||||
>= "icehouse":
|
||||
volume_driver = 'cinder.volume.drivers.rbd.RBDDriver'
|
||||
else:
|
||||
volume_driver = 'cinder.volume.driver.RBDDriver'
|
||||
return {
|
||||
'volume_driver': 'cinder.volume.driver.RBDDriver',
|
||||
'volume_driver': volume_driver,
|
||||
# ensure_ceph_pool() creates pool based on service name.
|
||||
'rbd_pool': service,
|
||||
'rbd_user': service,
|
||||
|
@ -16,6 +16,7 @@ TO_PATCH = [
|
||||
'service_name',
|
||||
'determine_apache_port',
|
||||
'determine_api_port',
|
||||
'get_os_codename_install_source'
|
||||
]
|
||||
|
||||
|
||||
@ -45,6 +46,7 @@ class TestCinderContext(CharmTestCase):
|
||||
|
||||
def test_ceph_related(self):
|
||||
self.relation_ids.return_value = ['ceph:0']
|
||||
self.get_os_codename_install_source.return_value = 'havana'
|
||||
service = 'mycinder'
|
||||
self.service_name.return_value = service
|
||||
self.assertEquals(
|
||||
@ -54,6 +56,18 @@ class TestCinderContext(CharmTestCase):
|
||||
'rbd_user': service,
|
||||
'host': service})
|
||||
|
||||
def test_ceph_related_icehouse(self):
|
||||
self.relation_ids.return_value = ['ceph:0']
|
||||
self.get_os_codename_install_source.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})
|
||||
|
||||
@patch.object(utils, 'service_enabled')
|
||||
def test_apache_ssl_context_service_disabled(self, service_enabled):
|
||||
service_enabled.return_value = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user