From cde50fe4bea7a1f1f73a90cff8bd5478d75dc5ec Mon Sep 17 00:00:00 2001 From: Victor Ryzhenkin Date: Thu, 8 Dec 2016 18:14:01 +0400 Subject: [PATCH] Update ceph usage with correct osd_pool_size Change-Id: I408c7a46c1aa13179341ed686ad8e47766e6b8c1 --- murano_plugin_tests/helpers/helpers.py | 52 ++++++++++++++++++- murano_plugin_tests/murano_plugin/api.py | 6 +++ .../murano_plugin/test_murano_plugin_bvt.py | 11 +++- .../murano_plugin/test_system.py | 12 +++-- 4 files changed, 76 insertions(+), 5 deletions(-) diff --git a/murano_plugin_tests/helpers/helpers.py b/murano_plugin_tests/helpers/helpers.py index beb6b6a..fd579bd 100644 --- a/murano_plugin_tests/helpers/helpers.py +++ b/murano_plugin_tests/helpers/helpers.py @@ -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. diff --git a/murano_plugin_tests/murano_plugin/api.py b/murano_plugin_tests/murano_plugin/api.py index b58b205..62f1c56 100644 --- a/murano_plugin_tests/murano_plugin/api.py +++ b/murano_plugin_tests/murano_plugin/api.py @@ -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) diff --git a/murano_plugin_tests/murano_plugin/test_murano_plugin_bvt.py b/murano_plugin_tests/murano_plugin/test_murano_plugin_bvt.py index fb07e0d..1d8a407 100644 --- a/murano_plugin_tests/murano_plugin/test_murano_plugin_bvt.py +++ b/murano_plugin_tests/murano_plugin/test_murano_plugin_bvt.py @@ -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() diff --git a/murano_plugin_tests/murano_plugin/test_system.py b/murano_plugin_tests/murano_plugin/test_system.py index e21b683..9d61877 100644 --- a/murano_plugin_tests/murano_plugin/test_system.py +++ b/murano_plugin_tests/murano_plugin/test_system.py @@ -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()