diff --git a/system_test/actions/base.py b/system_test/actions/base.py index 2d63332bc..dd45475e5 100644 --- a/system_test/actions/base.py +++ b/system_test/actions/base.py @@ -15,6 +15,7 @@ from __future__ import division import time +import itertools from proboscis import SkipTest from proboscis.asserts import assert_equal @@ -423,12 +424,70 @@ class BaseActions(PrepareActions, HealthCheckActions, PluginsActions): for node in step_config: if node['action'] == 'add': self._add_node([node]) + if node.get('vmware_vcenter'): + nova_computes = node['vmware_vcenter']['nova-compute'] + self.add_vmware_nova_compute(nova_computes) elif node['action'] == 'delete': self._del_node([node]) + if 'compute-vmware' in node['roles']: + self.del_vmware_nova_compute() else: logger.error("Unknow scale action: {}".format(node['action'])) self.scale_step += 1 + def add_vmware_nova_compute(self, nova_computes): + vmware_attr = \ + self.fuel_web.client.get_cluster_vmware_attributes(self.cluster_id) + vcenter_data = vmware_attr['editable']['value']['availability_zones'][ + 0]["nova_computes"] + + comp_vmware_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles( + self.cluster_id, ['compute-vmware'], role_status='pending_roles') + + for instance in nova_computes: + cluster_name = instance['cluster'] + srv_name = instance['srv_name'] + datastore = instance['datastore'] + if instance['target_node'] == 'compute-vmware': + node = comp_vmware_nodes.pop() + target_node = node['hostname'] + else: + target_node = instance['target_node'] + + vcenter_data.append( + {"vsphere_cluster": cluster_name, + "service_name": srv_name, + "datastore_regex": datastore, + "target_node": { + "current": {"id": target_node, + "label": target_node}, + "options": [{"id": target_node, + "label": target_node}, ]}, + } + ) + + logger.debug("Try to update cluster with next " + "vmware_attributes {0}".format(vmware_attr)) + self.fuel_web.client.update_cluster_vmware_attributes( + self.cluster_id, vmware_attr) + + def del_vmware_nova_compute(self): + vmware_attr = \ + self.fuel_web.client.get_cluster_vmware_attributes(self.cluster_id) + vcenter_data = vmware_attr['editable']['value']['availability_zones'][ + 0]["nova_computes"] + + comp_vmware_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles( + self.cluster_id, ['compute-vmware'], + role_status='pending_deletion') + + for node, nova_comp in itertools.product(comp_vmware_nodes, + vcenter_data): + if node['hostname'] == nova_comp['target_node']['current']['id']: + vcenter_data.remove(nova_comp) + self.fuel_web.client.update_cluster_vmware_attributes(self.cluster_id, + vmware_attr) + @deferred_decorator([make_snapshot_if_step_fail]) @action def reset_cluster(self): diff --git a/system_test/actions/vcenter_actions.py b/system_test/actions/vcenter_actions.py index 66b739f01..4e27be2ed 100644 --- a/system_test/actions/vcenter_actions.py +++ b/system_test/actions/vcenter_actions.py @@ -13,6 +13,7 @@ # under the License. from proboscis.asserts import assert_true +from proboscis import SkipTest from system_test import logger from system_test import deferred_decorator @@ -153,3 +154,13 @@ class VMwareActions(object): vmware_attr) logger.debug("Attributes of cluster have been updated") + + @deferred_decorator([make_snapshot_if_step_fail]) + @action + def deploy_changes(self): + """Deploy environment""" + if self.cluster_id is None: + raise SkipTest() + + self.fuel_web.deploy_cluster_wait(self.cluster_id, + check_services=False) diff --git a/system_test/tests/vcenter/test_vcenter_dvs.py b/system_test/tests/vcenter/test_vcenter_dvs.py index c0b5a7c3c..576f73d1f 100644 --- a/system_test/tests/vcenter/test_vcenter_dvs.py +++ b/system_test/tests/vcenter/test_vcenter_dvs.py @@ -94,6 +94,50 @@ class ScaleWithVMware(ActionTest, BaseActions, VMwareActions): 'network_check', 'deploy_cluster', 'scale_node', - 'deploy_cluster', + 'deploy_changes', + 'health_check_sanity_smoke_ha' + ] + + +@testcase(groups=['system_test', + 'system_test.vcenter', + 'system_test.vcenter.scale_vcenter_dvs_skipsrvcheck']) +class ScaleWithVMwareSkipSrvCheck(ActionTest, BaseActions, VMwareActions): + """Deploy and scale cluster with vCenter and dvs plugin + + Scenario: + 1. Upload plugin to the master node + 2. Install plugin + 3. Create cluster + 4. Configure dvs settings (depends on yaml config) + 5. Add nodes (depends on yaml config) + 6. Configure vmware settings (depends on yaml config) + 7. Run network verification + 8. Deploy the cluster + 9. Add/Delete nodes + 10. Redeploy cluster + 11. Run OSTF + + Duration 3h 00min + Snapshot scale_vcenter_dvs + """ + + plugin_name = "fuel-plugin-vmware-dvs" + plugin_path = DVS_PLUGIN_PATH + plugin_version = DVS_PLUGIN_VERSION + ostf_tests_should_failed = 1 + failed_test_name = ['Check that required services are running'] + + actions_order = [ + 'prepare_env_with_plugin', + 'create_env', + 'enable_plugin', + 'configure_dvs_plugin', + 'add_nodes', + 'configure_vcenter', + 'network_check', + 'deploy_cluster', + 'scale_node', + 'deploy_changes', 'health_check_sanity_smoke_ha' ] diff --git a/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_add_computevmware.yaml b/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_add_computevmware.yaml new file mode 100644 index 000000000..d8b619ded --- /dev/null +++ b/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_add_computevmware.yaml @@ -0,0 +1,47 @@ +--- +template: + name: 1 controller, 1 compute + cinder, 1 compute-vmware on Neutron/VLAN with DVS plugin + slaves: 3 + cluster_template: + name: vcenter_add_computevmware + release: ubuntu + network: + !include cluster_configs/networks/neutron_vlan.yaml + settings: + components: + !include cluster_configs/settings/components/wo_components.yaml + storages: + !include cluster_configs/settings/storages/cinder_only.yaml + vmware_vcenter: + settings: + !include cluster_configs/settings/vmware/vcenter_main.yaml + nova-compute: + !include cluster_configs/settings/vmware/nova_compute/1cluster_ctrl.yaml + glance: + enable: false + vmware_dvs: + !include cluster_configs/settings/vmware/dvs/dvs_1cluster.yaml + nodes: + - roles: + - controller + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1 + + - roles: + - compute + - cinder + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1 + + scale_nodes: + - - roles: + - compute-vmware + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1 + action: add + vmware_vcenter: + nova-compute: + - cluster: Cluster2 + srv_name: srv_cluster2 + datastore: .* + target_node: compute-vmware \ No newline at end of file diff --git a/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_delete_computevmware.yaml b/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_delete_computevmware.yaml new file mode 100644 index 000000000..442b58e4b --- /dev/null +++ b/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_delete_computevmware.yaml @@ -0,0 +1,46 @@ +--- +template: + name: 1 controller, 1 compute + cinder, 1 compute-vmware on Neutron/VLAN with DVS plugin + slaves: 3 + cluster_template: + name: vcenter_delete_computevmware + release: ubuntu + network: + !include cluster_configs/networks/neutron_vlan.yaml + settings: + components: + !include cluster_configs/settings/components/wo_components.yaml + storages: + !include cluster_configs/settings/storages/cinder_only.yaml + vmware_vcenter: + settings: + !include cluster_configs/settings/vmware/vcenter_main.yaml + nova-compute: + !include cluster_configs/settings/vmware/nova_compute/2clusters_ctrl_comp-vmware.yaml + glance: + enable: false + vmware_dvs: + !include cluster_configs/settings/vmware/dvs/dvs_main.yaml + nodes: + - roles: + - controller + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1 + + - roles: + - compute + - cinder + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1 + + - roles: + - compute-vmware + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1 + + scale_nodes: + - - roles: + - compute-vmware + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1 + action: delete \ No newline at end of file diff --git a/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_multiroles_computevmware_cindervmvare.yaml b/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_multiroles_computevmware_cindervmvare.yaml new file mode 100644 index 000000000..c203af282 --- /dev/null +++ b/system_test/tests_templates/tests_configs/vcenter_dvs/vcenter_multiroles_computevmware_cindervmvare.yaml @@ -0,0 +1,34 @@ +--- +template: + name: 1 controller, 1 compute-vmware + cinder-vmware on Neutron/VLAN with DVS plugin + slaves: 2 + cluster_template: + name: vcenter_multiroles_computevmware_cindervmware + release: ubuntu + network: + !include cluster_configs/networks/neutron_vlan.yaml + settings: + components: + !include cluster_configs/settings/components/wo_components.yaml + storages: + !include cluster_configs/settings/storages/cinder_only.yaml + vmware_vcenter: + settings: + !include cluster_configs/settings/vmware/vcenter_main.yaml + nova-compute: + !include cluster_configs/settings/vmware/nova_compute/2clusters_ctrl_comp-vmware.yaml + glance: + enable: false + vmware_dvs: + !include cluster_configs/settings/vmware/dvs/dvs_main.yaml + nodes: + - roles: + - controller + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1 + + - roles: + - compute-vmware + - cinder-vmware + iface: !include cluster_configs/settings/vmware/vcenter_ifaces.yaml + count: 1