vCenter functional tests

Were added following vCenter tests:
- Deploy vmware roles with custom hostname
- Check vmware settings in nova configs
- Check nova services
- Check cinder-vmware services

Closes-bug: #1567815

Change-Id: I51f0ffffe131f4bfd6336a81ee99fc87bb621063
(cherry picked from commit 9307ef7e18)
This commit is contained in:
Ilya Bumarskov 2016-04-05 10:37:33 +03:00
parent a33b8f083e
commit b9c37ef069
3 changed files with 306 additions and 4 deletions

View File

@ -12,13 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from proboscis.asserts import assert_true
from proboscis import SkipTest
from system_test import logger
from random import randrange
from proboscis import SkipTest
from proboscis.asserts import assert_true
from fuelweb_test.helpers.ssh_manager import SSHManager
from system_test import logger
from system_test import deferred_decorator
from system_test import action
from system_test.helpers.decorators import make_snapshot_if_step_fail
@ -155,6 +157,109 @@ class VMwareActions(object):
logger.debug("Attributes of cluster have been updated")
@deferred_decorator([make_snapshot_if_step_fail])
@action
def set_custom_node_names(self):
"""Set custom node names"""
custom_hostnames = []
for node in self.fuel_web.client.list_cluster_nodes(self.cluster_id):
custom_hostname = "{0}-{1}".format(
node['pending_roles'][0], randrange(0, 0xffff))
custom_hostnames.append(custom_hostname)
self.fuel_web.client.set_hostname(node['id'], custom_hostname)
@staticmethod
def get_nova_conf_dict(az, nova):
"""
:param az: vcenter az (api), dict
:param nova: nova (api), dict
:return: dict
"""
conf_dict = {
'host': 'vcenter-{}'.format(nova['service_name']),
'cluster_name': nova['vsphere_cluster'],
'datastore_regex': nova['datastore_regex'],
'host_username': az['vcenter_username'],
'host_password': az['vcenter_password'],
'host_ip': az['vcenter_host']
}
return conf_dict
@deferred_decorator([make_snapshot_if_step_fail])
@action
def check_nova_conf(self):
"""Verify nova-compute vmware configuration"""
nodes = self.fuel_web.client.list_cluster_nodes(self.cluster_id)
vmware_attr = self.fuel_web.client.get_cluster_vmware_attributes(
self.cluster_id)
az = vmware_attr['editable']['value']['availability_zones'][0]
nova_computes = az['nova_computes']
data = []
ctrl_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
self.cluster_id, ["controller"])
for nova in nova_computes:
target_node = nova['target_node']['current']['id']
if target_node == 'controllers':
conf_path = '/etc/nova/nova-compute.d/vmware-vcenter_{0}.' \
'conf'.format(nova['service_name'])
for node in ctrl_nodes:
hostname = node['hostname']
ip = node['ip']
conf_dict = self.get_nova_conf_dict(az, nova)
params = (hostname, ip, conf_path, conf_dict)
data.append(params)
else:
conf_path = '/etc/nova/nova-compute.conf'
for node in nodes:
if node['hostname'] == target_node:
hostname = node['hostname']
ip = node['ip']
conf_dict = self.get_nova_conf_dict(az, nova)
params = (hostname, ip, conf_path, conf_dict)
data.append(params)
for hostname, ip, conf_path, conf_dict in data:
logger.info("Check nova conf of {0}".format(hostname))
for key in conf_dict.keys():
cmd = 'cat {0} | grep {1}={2}'.format(conf_path, key,
conf_dict[key])
logger.debug('CMD: {}'.format(cmd))
SSHManager().execute_on_remote(ip, cmd)
@deferred_decorator([make_snapshot_if_step_fail])
@action
def check_nova_srv(self):
"""Verify nova-compute service for each vSphere cluster"""
vmware_attr = self.fuel_web.client.get_cluster_vmware_attributes(
self.cluster_id)
az = vmware_attr['editable']['value']['availability_zones'][0]
nova_computes = az['nova_computes']
ctrl_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
self.cluster_id, ["controller"])
for nova in nova_computes:
srv_name = nova['service_name']
cmd = '. openrc; nova-manage service describe_resource ' \
'vcenter-{}'.format(srv_name)
logger.debug('CMD: {}'.format(cmd))
SSHManager().execute_on_remote(ctrl_nodes[0]['ip'],
cmd)
@deferred_decorator([make_snapshot_if_step_fail])
@action
def check_cinder_vmware_srv(self):
"""Verify cinder-vmware service"""
ctrl_nodes = self.fuel_web.get_nailgun_cluster_nodes_by_roles(
self.cluster_id, ["controller"])
cmd = '. openrc; cinder-manage service list | grep vcenter | ' \
'grep ":-)"'
logger.debug('CMD: {}'.format(cmd))
SSHManager().execute_on_remote(ctrl_nodes[0]['ip'], cmd)
@deferred_decorator([make_snapshot_if_step_fail])
@action
def deploy_changes(self):

View File

@ -141,3 +141,155 @@ class ScaleWithVMwareSkipSrvCheck(ActionTest, BaseActions, VMwareActions):
'deploy_changes',
'health_check_sanity_smoke_ha'
]
@testcase(groups=['system_test',
'system_test.vcenter',
'system_test.vcenter.deploy_with_custom_hostname'])
class DeployWithCustomHostname(ActionTest, BaseActions, VMwareActions):
"""Deploy cluster with vCenter and custom hostname
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. Set custom hostname for nodes
7. Configure vmware settings (depends on yaml config)
8. Deploy the cluster
9. Run OSTF
Duration 1h 40min
Snapshot deploy_vcenter_dvs
"""
plugin_name = "fuel-plugin-vmware-dvs"
plugin_path = DVS_PLUGIN_PATH
plugin_version = DVS_PLUGIN_VERSION
actions_order = [
'prepare_env_with_plugin',
'create_env',
'enable_plugin',
'configure_dvs_plugin',
'add_nodes',
'set_custom_node_names',
'configure_vcenter',
'deploy_cluster',
'health_check_sanity_smoke_ha'
]
@testcase(groups=['system_test',
'system_test.vcenter',
'system_test.vcenter.check_nova_config'])
class CheckNovaConfig(ActionTest, BaseActions, VMwareActions):
"""Deploy cluster with vCenter and custom hostname
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. Deploy the cluster
8. Check nova configuration (vCenter)
9. Run OSTF
Duration 1h 40min
Snapshot deploy_vcenter_dvs
"""
plugin_name = "fuel-plugin-vmware-dvs"
plugin_path = DVS_PLUGIN_PATH
plugin_version = DVS_PLUGIN_VERSION
actions_order = [
'prepare_env_with_plugin',
'create_env',
'enable_plugin',
'configure_dvs_plugin',
'add_nodes',
'configure_vcenter',
'deploy_cluster',
'check_nova_conf',
'health_check_sanity_smoke_ha'
]
@testcase(groups=['system_test',
'system_test.vcenter',
'system_test.vcenter.check_nova_srv'])
class CheckNovaSrv(ActionTest, BaseActions, VMwareActions):
"""Deploy cluster with vCenter and custom hostname
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. Deploy the cluster
8. Check nova services (vCenter)
9. Run OSTF
Duration 1h 40min
Snapshot deploy_vcenter_dvs
"""
plugin_name = "fuel-plugin-vmware-dvs"
plugin_path = DVS_PLUGIN_PATH
plugin_version = DVS_PLUGIN_VERSION
actions_order = [
'prepare_env_with_plugin',
'create_env',
'enable_plugin',
'configure_dvs_plugin',
'add_nodes',
'configure_vcenter',
'deploy_cluster',
'check_nova_srv',
'health_check_sanity_smoke_ha'
]
@testcase(groups=['system_test',
'system_test.vcenter',
'system_test.vcenter.check_cinder_srv'])
class CheckCinderVmwareSrv(ActionTest, BaseActions, VMwareActions):
"""Deploy cluster with vCenter and custom hostname
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. Deploy the cluster
8. Check vmware cinder service
9. Run OSTF
Duration 1h 40min
Snapshot deploy_vcenter_dvs
"""
plugin_name = "fuel-plugin-vmware-dvs"
plugin_path = DVS_PLUGIN_PATH
plugin_version = DVS_PLUGIN_VERSION
actions_order = [
'prepare_env_with_plugin',
'create_env',
'enable_plugin',
'configure_dvs_plugin',
'add_nodes',
'configure_vcenter',
'deploy_cluster',
'check_cinder_vmware_srv',
'health_check_sanity_smoke_ha'
]

View File

@ -0,0 +1,45 @@
---
template:
name: 1 controller, 1 cinder-vmware, 1 compute-vmware on Neutron/VLAN with DVS plugin
slaves: 3
cluster_template:
name: vcenter_roles
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:
- cluster: Cluster1
srv_name: srv_cluster1
datastore: n.*
target_node: controllers
- cluster: Cluster2
srv_name: srv_cluster2
datastore: nf.*
target_node: compute-vmware
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:
- cinder-vmware
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