Update ceph usage with correct osd_pool_size

Change-Id: I408c7a46c1aa13179341ed686ad8e47766e6b8c1
This commit is contained in:
Victor Ryzhenkin 2016-12-08 18:14:01 +04:00
parent 6992efb05f
commit cde50fe4be
4 changed files with 76 additions and 5 deletions

View File

@ -115,7 +115,9 @@ class PluginHelper(object):
'volumes_lvm': False,
'volumes_ceph': True,
'images_ceph': True,
'objects_ceph': True
'objects_ceph': True,
'ephemeral_ceph': True,
'osd_pool_size': "1"
}
def prepare_plugin(self, plugin_path):
@ -346,6 +348,54 @@ class PluginHelper(object):
helpers.wait(lambda: not self.fuel_web.get_nailgun_node_by_devops_node(
node)['online'], timeout=60 * 5, timeout_msg=msg)
def update_cluster_settings(self, opts):
attrs = self.fuel_web.client.get_cluster_attributes(self.cluster_id)
for option in opts:
section = ''
if option in ('sahara', 'murano', 'ceilometer', 'mongo',
'ironic'):
section = 'additional_components'
elif option in {'mongo_db_name', 'mongo_replset', 'mongo_user',
'hosts_ip', 'mongo_password'}:
section = 'external_mongo'
elif option in {'volumes_ceph', 'images_ceph',
'ephemeral_ceph', 'objects_ceph',
'osd_pool_size', 'volumes_lvm',
'volumes_block_device', 'images_vcenter'}:
section = 'storage'
elif option in {'tenant', 'password', 'user'}:
section = 'access'
elif option == 'assign_to_all_nodes':
section = 'public_network_assignment'
elif option in {'neutron_l3_ha', 'neutron_dvr',
'neutron_l2_pop'}:
section = 'neutron_advanced_configuration'
elif option in {'dns_list'}:
section = 'external_dns'
elif option in {'ntp_list'}:
section = 'external_ntp'
elif option in {'propagate_task_deploy'}:
section = 'common'
if section:
try:
attrs['editable'][section][option]['value'] = \
opts[option]
except KeyError:
if section not in attrs['editable']:
raise KeyError(
"Section '{0}' not in "
"attributes['editable']: {1}".format(
section, attrs['editable'].keys()))
raise KeyError(
"Option {0} not in attributes['editable'][{1}]: "
"{2}".format(
option, section,
attrs['editable'][section].keys()))
return self.fuel_web.client.update_cluster_attributes(
self.cluster_id, attrs)
def emulate_whole_network_disaster(self, delay_before_recover=5 * 60,
wait_become_online=True):
"""Simulate a full network outage for all nodes.

View File

@ -92,6 +92,12 @@ class MuranoPluginApi(object):
'slave-09': self.settings.role_name,
}
def set_replication_factor(self, replicas='1'):
opts = {
'osd_pool_size': replicas
}
return self.helpers.update_cluster_settings(opts)
def prepare_plugin(self):
"""Upload and install the plugin on the Fuel master node."""
self.helpers.prepare_plugin(self.settings.plugin_path)

View File

@ -191,7 +191,16 @@ class TestMuranoPluginBvt(api.MuranoPluginApi):
self.prepare_plugin()
self.helpers.create_cluster(name=self.__class__.__name__)
opts = {
'volumes_lvm': False,
'volumes_ceph': True,
'images_ceph': True,
'objects_ceph': True,
'osd_pool_size': "3"
}
self.helpers.create_cluster(name=self.__class__.__name__,
opts=opts)
self.activate_plugin()

View File

@ -62,10 +62,13 @@ class TestSystemMuranoPlugin(api.MuranoPluginApi):
self.run_ostf(['sanity', 'smoke', 'ha'])
compute_manipulated_node = {'slave-04': ['compute', 'cinder']}
compute_manipulated_node = {'slave-04': ['compute', 'ceph-osd']}
# Remove compute
self.helpers.remove_nodes_from_cluster(compute_manipulated_node)
self.helpers.remove_nodes_from_cluster(compute_manipulated_node,
redeploy=False)
self.set_replication_factor(replicas="2")
self.helpers.apply_changes()
self.check_plugin_online()
@ -82,7 +85,10 @@ class TestSystemMuranoPlugin(api.MuranoPluginApi):
self.run_ostf(['sanity', 'smoke', 'ha'])
# Add compute
self.helpers.add_nodes_to_cluster(compute_manipulated_node)
self.helpers.add_nodes_to_cluster(compute_manipulated_node,
redeploy=False)
self.set_replication_factor(replicas="3")
self.helpers.apply_changes()
self.check_plugin_online()