template-based test for fuel installation on Centos node
Add test for testing Separate master node deployment on pre-provisioned Centos 7 server Change-Id: I9b9d40a59d24f579502a38dfc9b8c142bc219a06 Closes-Bug: #1575650
This commit is contained in:
parent
2dc510fe14
commit
fa522254a4
@ -700,4 +700,9 @@ Test for ssl components
|
||||
Test for network outage
|
||||
-----------------------
|
||||
.. automodule:: fuelweb_test.tests.tests_strength.test_network_outage
|
||||
:members:
|
||||
|
||||
Test for separate master node deployment
|
||||
----------------------------------------
|
||||
.. automodule:: system_test.tests.test_centos_master_deploy_ceph
|
||||
:members:
|
@ -30,9 +30,9 @@ def generate_cloud_image_settings(cloud_image_settings_path, admin_network,
|
||||
os.makedirs(dir_path)
|
||||
|
||||
meta_data_path = os.path.join(dir_path,
|
||||
"meta_data")
|
||||
"meta-data")
|
||||
user_data_path = os.path.join(dir_path,
|
||||
"user_data")
|
||||
"user-data")
|
||||
|
||||
# create meta_data and user_data
|
||||
|
||||
@ -71,12 +71,12 @@ def generate_cloud_image_settings(cloud_image_settings_path, admin_network,
|
||||
"password": password
|
||||
}
|
||||
|
||||
user_data_content = ("#cloud-config\n"
|
||||
user_data_content = ("\n#cloud-config\n"
|
||||
"ssh_pwauth: True\n"
|
||||
"chpasswd:\n"
|
||||
"list: |\n"
|
||||
" {user}:{password}\n"
|
||||
"expire: False \n\n"
|
||||
" list: |\n"
|
||||
" {user}:{password}\n"
|
||||
" expire: False \n\n"
|
||||
"runcmd:\n"
|
||||
" - sudo ifup {interface_name}\n"
|
||||
" - sudo sed -i -e '/^PermitRootLogin/s/^"
|
||||
@ -98,6 +98,4 @@ def generate_cloud_image_settings(cloud_image_settings_path, admin_network,
|
||||
user_data_path,
|
||||
meta_data_path)
|
||||
|
||||
cmd = cmd.split()
|
||||
|
||||
subprocess.check_call(cmd, shell=True)
|
||||
|
@ -476,6 +476,12 @@ class EnvironmentModel(object):
|
||||
|
||||
@logwrap
|
||||
def wait_for_external_config(self, timeout=120):
|
||||
|
||||
wait(lambda: self.ssh_manager.exists_on_remote(
|
||||
self.ssh_manager.admin_ip,
|
||||
'/var/lock/wait_for_external_config'),
|
||||
timeout=600)
|
||||
|
||||
check_cmd = 'pkill -0 -f wait_for_external_config'
|
||||
|
||||
wait(
|
||||
|
@ -655,3 +655,5 @@ GERRIT_PATCHSET_NUMBER = os.environ.get("GERRIT_PATCHSET_NUMBER")
|
||||
DOWNLOAD_FACTS = get_var_as_bool("DOWNLOAD_FACTS", False)
|
||||
|
||||
TASK_BASED_ENGINE = get_var_as_bool("TASK_BASED_ENGINE", True)
|
||||
|
||||
FUEL_RELEASE_PATH = os.environ.get("FUEL_RELEASE_PATH")
|
||||
|
@ -12,6 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
from proboscis import TestProgram
|
||||
@ -31,6 +32,8 @@ from fuelweb_test.settings import MULTIPLE_NETWORKS_TEMPLATE
|
||||
from fuelweb_test.settings import REPLACE_DEFAULT_REPOS
|
||||
from fuelweb_test.settings import REPLACE_DEFAULT_REPOS_ONLY_ONCE
|
||||
|
||||
from gates_tests.helpers import exceptions
|
||||
|
||||
|
||||
class TestBasic(object):
|
||||
"""Basic test case class for all system tests.
|
||||
@ -265,6 +268,65 @@ class TestBasic(object):
|
||||
self.env.setup_environment()
|
||||
self.fuel_post_install_actions()
|
||||
|
||||
def centos_setup_fuel(self, hostname):
|
||||
logger.info("upload fuel-release packet")
|
||||
if not settings.FUEL_RELEASE_PATH:
|
||||
raise exceptions.FuelQAVariableNotSet('FUEL_RELEASE_PATH', '/path')
|
||||
try:
|
||||
ssh = SSHManager()
|
||||
pack_path = '/tmp/'
|
||||
full_pack_path = os.path.join(pack_path,
|
||||
'fuel-release*.noarch.rpm')
|
||||
ssh.upload_to_remote(
|
||||
ip=ssh.admin_ip,
|
||||
source=settings.FUEL_RELEASE_PATH.rstrip('/'),
|
||||
target=pack_path)
|
||||
|
||||
except Exception:
|
||||
logger.exception("Could not upload package")
|
||||
|
||||
logger.debug("Update host information")
|
||||
cmd = "echo HOSTNAME={} >> /etc/sysconfig/network".format(hostname)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
|
||||
cmd = "echo {0} {1} {2} >> /etc/hosts".format(
|
||||
ssh.admin_ip,
|
||||
hostname,
|
||||
settings.FUEL_MASTER_HOSTNAME)
|
||||
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
|
||||
cmd = "hostname {}".format(hostname)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
|
||||
logger.debug("setup MOS repositories")
|
||||
cmd = "rpm -ivh {}".format(full_pack_path)
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
|
||||
cmd = "yum install -y fuel-setup"
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
|
||||
cmd = "yum install -y screen"
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
|
||||
logger.info("Install Fuel services")
|
||||
|
||||
cmd = "screen -dm bash -c 'showmenu=no wait_for_external_config=yes " \
|
||||
"bootstrap_admin_node.sh'"
|
||||
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
|
||||
|
||||
self.env.wait_for_external_config()
|
||||
self.env.admin_actions.modify_configs(self.env.d_env.router())
|
||||
self.env.kill_wait_for_external_config()
|
||||
|
||||
self.env.wait_bootstrap()
|
||||
|
||||
logger.debug("Check Fuel services")
|
||||
self.env.admin_actions.wait_for_fuel_ready()
|
||||
|
||||
logger.debug("post-installation configuration of Fuel services")
|
||||
self.fuel_post_install_actions()
|
||||
|
||||
|
||||
@test
|
||||
class SetupEnvironment(TestBasic):
|
||||
|
@ -14,9 +14,12 @@
|
||||
|
||||
from __future__ import division
|
||||
|
||||
import os
|
||||
import time
|
||||
import itertools
|
||||
|
||||
from devops.helpers.helpers import wait
|
||||
|
||||
from proboscis import SkipTest
|
||||
from proboscis.asserts import assert_equal
|
||||
from proboscis.asserts import assert_true
|
||||
@ -24,7 +27,9 @@ from proboscis.asserts import assert_true
|
||||
from six.moves import xrange
|
||||
# pylint: enable=redefined-builtin
|
||||
|
||||
import fuelweb_test
|
||||
from fuelweb_test.helpers import checkers
|
||||
from fuelweb_test.helpers.cloud_image import generate_cloud_image_settings
|
||||
from fuelweb_test.helpers.utils import TimeStat
|
||||
from fuelweb_test import settings
|
||||
|
||||
@ -118,6 +123,62 @@ class PrepareActions(object):
|
||||
|
||||
self.env.make_snapshot("empty", is_make=True)
|
||||
|
||||
@deferred_decorator([make_snapshot_if_step_fail])
|
||||
@action
|
||||
def setup_centos_master(self):
|
||||
"""Create environment, bootstrap centos_master
|
||||
and install fuel services
|
||||
|
||||
Snapshot "empty_centos"
|
||||
|
||||
1. bootstrap_centos_master
|
||||
2. Download fuel_release from remote repository
|
||||
3. install fuel_setup package
|
||||
4. Install Fuel services by executing bootstrap_admin_node.sh
|
||||
5. check Fuel services
|
||||
|
||||
|
||||
"""
|
||||
self.check_run("empty_centos")
|
||||
self.show_step(1, initialize=True)
|
||||
cloud_image_settings_path = os.path.join(
|
||||
os.path.dirname(fuelweb_test.__file__),
|
||||
'cloud_image_settings/cloud_settings.iso')
|
||||
|
||||
admin_net_object = self.env.d_env.get_network(
|
||||
name=self.env.d_env.admin_net)
|
||||
admin_network = admin_net_object.ip.network
|
||||
admin_netmask = admin_net_object.ip.netmask
|
||||
admin_ip = str(self.env.d_env.nodes(
|
||||
).admin.get_ip_address_by_network_name(self.env.d_env.admin_net))
|
||||
interface_name = settings.iface_alias("eth0")
|
||||
gateway = self.env.d_env.router()
|
||||
dns = settings.DNS
|
||||
dns_ext = ''.join(settings.EXTERNAL_DNS)
|
||||
hostname = ''.join((settings.FUEL_MASTER_HOSTNAME,
|
||||
settings.DNS_SUFFIX))
|
||||
user = settings.SSH_CREDENTIALS['login']
|
||||
password = settings.SSH_CREDENTIALS['password']
|
||||
generate_cloud_image_settings(cloud_image_settings_path, admin_network,
|
||||
interface_name, admin_ip, admin_netmask,
|
||||
gateway, dns, dns_ext,
|
||||
hostname, user, password)
|
||||
|
||||
with TimeStat("bootstrap_centos_node", is_uniq=True):
|
||||
admin = self.env.d_env.nodes().admin
|
||||
logger.info(cloud_image_settings_path)
|
||||
admin.disk_devices.get(
|
||||
device='cdrom').volume.upload(cloud_image_settings_path)
|
||||
self.env.d_env.start([admin])
|
||||
logger.info("Waiting for Centos node to start up")
|
||||
wait(lambda: admin.driver.node_active(admin), 60)
|
||||
logger.info("Waiting for Centos node ssh ready")
|
||||
self.env.wait_for_provisioning()
|
||||
|
||||
self.centos_setup_fuel(hostname)
|
||||
|
||||
self.env.make_snapshot("empty", is_make=True)
|
||||
|
||||
@deferred_decorator([make_snapshot_if_step_fail])
|
||||
@action
|
||||
def config_release(self):
|
||||
|
@ -87,6 +87,11 @@ def define_custom_groups():
|
||||
add_group(group="fuel_master_migrate",
|
||||
systest_group="system_test.fuel_migration",
|
||||
config_name="1ctrl_1comp_neutronVLAN")
|
||||
|
||||
add_group(group="fuel_master_migrate",
|
||||
systest_group="system_test.fuel_migration",
|
||||
config_name="1ctrl_1comp_neutronTUN")
|
||||
|
||||
add_group(group="system_test.deploy_centos_master",
|
||||
systest_group="system_test.centos_deploy_and_check_radosgw",
|
||||
config_name="centos_master_ceph_all_on_neutron_vlan")
|
||||
|
76
system_test/tests/test_centos_master_deploy_ceph.py
Normal file
76
system_test/tests/test_centos_master_deploy_ceph.py
Normal file
@ -0,0 +1,76 @@
|
||||
# Copyright 2016 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE_2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from proboscis.asserts import assert_true
|
||||
|
||||
from system_test import testcase
|
||||
from system_test import action
|
||||
from system_test import deferred_decorator
|
||||
|
||||
from system_test.tests import ActionTest
|
||||
from system_test.actions import BaseActions
|
||||
|
||||
from system_test.helpers.decorators import make_snapshot_if_step_fail
|
||||
|
||||
|
||||
@testcase(groups=['system_test',
|
||||
'system_test.centos_deploy_and_check_radosgw'])
|
||||
class CentosDeployCheckRadosGW(ActionTest, BaseActions):
|
||||
"""Deploy cluster and check RadosGW
|
||||
|
||||
Scenario:
|
||||
1. Bootstrap Centos node and install Fuel services
|
||||
2. Create Environment
|
||||
3. Add nodes to Environment
|
||||
4. Run network checker
|
||||
5. Deploy Environment
|
||||
6. Run network checker
|
||||
7. Check HAProxy backends
|
||||
8. Check ceph status
|
||||
9. Run OSTF
|
||||
10. Check the radosgw daemon is started
|
||||
|
||||
"""
|
||||
|
||||
actions_order = [
|
||||
'setup_centos_master',
|
||||
'config_release',
|
||||
'make_slaves',
|
||||
'revert_slaves',
|
||||
'create_env',
|
||||
'add_nodes',
|
||||
'network_check',
|
||||
'deploy_cluster',
|
||||
'network_check',
|
||||
'check_haproxy',
|
||||
'check_ceph_status',
|
||||
'health_check',
|
||||
'check_rados_daemon'
|
||||
]
|
||||
|
||||
@deferred_decorator([make_snapshot_if_step_fail])
|
||||
@action
|
||||
def check_ceph_status(self):
|
||||
"""Check Ceph status in cluster"""
|
||||
self.fuel_web.check_ceph_status(self.cluster_id)
|
||||
|
||||
@deferred_decorator([make_snapshot_if_step_fail])
|
||||
@action
|
||||
def check_rados_daemon(self):
|
||||
"""Check the radosgw daemon is started"""
|
||||
def radosgw_started(remote):
|
||||
return remote.check_call('pkill -0 radosgw')['exit_code'] == 0
|
||||
|
||||
with self.fuel_web.get_ssh_for_node('slave-01') as remote:
|
||||
assert_true(radosgw_started(remote), 'radosgw daemon started')
|
189
system_test/tests_templates/devops_configs/centos_master.yaml
Normal file
189
system_test/tests_templates/devops_configs/centos_master.yaml
Normal file
@ -0,0 +1,189 @@
|
||||
---
|
||||
aliases:
|
||||
|
||||
dynamic_address_pool:
|
||||
- &pool_default !os_env POOL_DEFAULT, 10.109.0.0/16:24
|
||||
|
||||
default_interface_model:
|
||||
- &interface_model !os_env INTERFACE_MODEL, e1000
|
||||
|
||||
rack-01-slave-interfaces: &rack-01-slave-interfaces
|
||||
- label: eth0
|
||||
l2_network_device: admin # Libvirt bridge name. It is *NOT* Nailgun networks
|
||||
interface_model: *interface_model
|
||||
- label: eth1
|
||||
l2_network_device: public
|
||||
interface_model: *interface_model
|
||||
- label: eth2
|
||||
l2_network_device: storage
|
||||
interface_model: *interface_model
|
||||
- label: eth3
|
||||
l2_network_device: management
|
||||
interface_model: *interface_model
|
||||
- label: eth4
|
||||
l2_network_device: private
|
||||
interface_model: *interface_model
|
||||
|
||||
rack-01-slave-network_config: &rack-01-slave-network_config
|
||||
eth0:
|
||||
networks:
|
||||
- fuelweb_admin
|
||||
eth1:
|
||||
networks:
|
||||
- public
|
||||
eth2:
|
||||
networks:
|
||||
- storage
|
||||
eth3:
|
||||
networks:
|
||||
- management
|
||||
eth4:
|
||||
networks:
|
||||
- private
|
||||
|
||||
rack-01-slave-node-params: &rack-01-slave-node-params
|
||||
vcpu: !os_env SLAVE_NODE_CPU, 2
|
||||
memory: !os_env SLAVE_NODE_MEMORY, 3072
|
||||
boot:
|
||||
- network
|
||||
- hd
|
||||
volumes:
|
||||
- name: system
|
||||
capacity: !os_env NODE_VOLUME_SIZE, 55
|
||||
format: qcow2
|
||||
- name: cinder
|
||||
capacity: !os_env NODE_VOLUME_SIZE, 55
|
||||
format: qcow2
|
||||
- name: swift
|
||||
capacity: !os_env NODE_VOLUME_SIZE, 55
|
||||
format: qcow2
|
||||
interfaces: *rack-01-slave-interfaces
|
||||
network_config: *rack-01-slave-network_config
|
||||
|
||||
|
||||
env_name: !os_env ENV_NAME
|
||||
|
||||
address_pools:
|
||||
# Network pools used by the environment
|
||||
fuelweb_admin-pool01:
|
||||
net: *pool_default
|
||||
params:
|
||||
tag: 0
|
||||
public-pool01:
|
||||
net: *pool_default
|
||||
params:
|
||||
tag: 0
|
||||
storage-pool01:
|
||||
net: *pool_default
|
||||
params:
|
||||
tag: 101
|
||||
management-pool01:
|
||||
net: *pool_default
|
||||
params:
|
||||
tag: 102
|
||||
private-pool01:
|
||||
net: *pool_default
|
||||
params:
|
||||
tag: 103
|
||||
|
||||
groups:
|
||||
- name: rack-01
|
||||
driver:
|
||||
name: devops.driver.libvirt.libvirt_driver
|
||||
params:
|
||||
connection_string: !os_env CONNECTION_STRING, qemu:///system
|
||||
storage_pool_name: !os_env STORAGE_POOL_NAME, default
|
||||
stp: True
|
||||
hpet: False
|
||||
use_host_cpu: !os_env DRIVER_USE_HOST_CPU, true
|
||||
|
||||
network_pools: # Address pools for OpenStack networks.
|
||||
# Actual names should be used for keys
|
||||
# (the same as in Nailgun, for example)
|
||||
|
||||
fuelweb_admin: fuelweb_admin-pool01
|
||||
public: public-pool01
|
||||
storage: storage-pool01
|
||||
management: management-pool01
|
||||
private: private-pool01
|
||||
|
||||
l2_network_devices: # Libvirt bridges. It is *NOT* Nailgun networks
|
||||
admin:
|
||||
address_pool: fuelweb_admin-pool01
|
||||
dhcp: false
|
||||
forward:
|
||||
mode: nat
|
||||
|
||||
public:
|
||||
address_pool: public-pool01
|
||||
dhcp: false
|
||||
forward:
|
||||
mode: nat
|
||||
|
||||
storage:
|
||||
address_pool: storage-pool01
|
||||
dhcp: false
|
||||
|
||||
management:
|
||||
address_pool: management-pool01
|
||||
dhcp: false
|
||||
|
||||
private:
|
||||
address_pool: private-pool01
|
||||
dhcp: false
|
||||
|
||||
nodes:
|
||||
- name: admin # Custom name of VM for Fuel admin node
|
||||
role: fuel_master # Fixed role for Fuel master node properties
|
||||
params:
|
||||
vcpu: !os_env ADMIN_NODE_CPU, 2
|
||||
memory: !os_env ADMIN_NODE_MEMORY, 3072
|
||||
boot:
|
||||
- hd
|
||||
- cdrom # for boot from usb - without 'cdrom'
|
||||
volumes:
|
||||
- name: system
|
||||
source_image: !os_env CENTOS_CLOUD_IMAGE_PATH
|
||||
format: qcow2
|
||||
- name: iso
|
||||
capacity: 1
|
||||
format: raw
|
||||
device: cdrom # for boot from usb - 'disk'
|
||||
bus: ide # for boot from usb - 'usb'
|
||||
interfaces:
|
||||
- label: eth0
|
||||
l2_network_device: admin # Libvirt bridge name. It is *NOT* a Nailgun network
|
||||
interface_model: *interface_model
|
||||
network_config:
|
||||
eth0:
|
||||
networks:
|
||||
- fuelweb_admin
|
||||
|
||||
- name: slave-01
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
- name: slave-02
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
- name: slave-03
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
- name: slave-04
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
- name: slave-05
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
- name: slave-06
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
- name: slave-07
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
- name: slave-08
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
- name: slave-09
|
||||
role: fuel_slave
|
||||
params: *rack-01-slave-node-params
|
||||
|
@ -0,0 +1,40 @@
|
||||
---
|
||||
network-config: &network-config
|
||||
provider: neutron
|
||||
segment-type: vlan
|
||||
pubip-to-all: false
|
||||
|
||||
storages-config: &storages-config
|
||||
volume-lvm: false
|
||||
volume-ceph: true
|
||||
image-ceph: true
|
||||
rados-ceph: true
|
||||
ephemeral-ceph: false
|
||||
replica-ceph: 1
|
||||
|
||||
nodes: &nodes
|
||||
- roles:
|
||||
- controller
|
||||
count: 1
|
||||
- roles:
|
||||
- ceph-osd
|
||||
count: 2
|
||||
- roles:
|
||||
- compute
|
||||
count: 1
|
||||
|
||||
template:
|
||||
name: 1 Controller, 1 Compute & 2 Ceph on Neutron/VLAN
|
||||
slaves: 4
|
||||
devops_settings: !include devops_configs/centos_master.yaml
|
||||
cluster_template: &environment-config
|
||||
name: rados
|
||||
release: ubuntu
|
||||
settings:
|
||||
components:
|
||||
sahara: false
|
||||
murano: false
|
||||
ceilometer: false
|
||||
storages: *storages-config
|
||||
network: *network-config
|
||||
nodes: *nodes
|
Loading…
Reference in New Issue
Block a user