Merge "Delete Centos bootstrap usage"
This commit is contained in:
commit
1c1c39b684
|
@ -292,11 +292,6 @@ Test Ubuntu bootstrap
|
|||
.. automodule:: fuelweb_test.tests.test_ubuntu_bootstrap
|
||||
:members:
|
||||
|
||||
Test CentOS bootstrap
|
||||
---------------------
|
||||
.. automodule:: fuelweb_test.tests.test_centos_bootstrap
|
||||
:members:
|
||||
|
||||
Test Ubuntu Cloud Archive
|
||||
-------------------------
|
||||
.. automodule:: fuelweb_test.tests.test_uca
|
||||
|
|
|
@ -708,8 +708,8 @@ def external_dns_check(ip):
|
|||
|
||||
def verify_bootstrap_on_node(ip, os_type, uuid=None):
|
||||
os_type = os_type.lower()
|
||||
if os_type not in ['ubuntu', 'centos']:
|
||||
raise Exception("Only Ubuntu and CentOS are supported, "
|
||||
if 'ubuntu' not in os_type:
|
||||
raise Exception("Only Ubuntu are supported, "
|
||||
"you have chosen {0}".format(os_type))
|
||||
|
||||
logger.info("Verify bootstrap on slave {0}".format(ip))
|
||||
|
@ -720,8 +720,7 @@ def verify_bootstrap_on_node(ip, os_type, uuid=None):
|
|||
"Slave {0} doesn't use {1} image for bootstrap "
|
||||
"after {1} images were enabled, /etc/release "
|
||||
"content: {2}".format(ip, os_type, output))
|
||||
|
||||
if os_type == 'centos' or uuid is None:
|
||||
if not uuid:
|
||||
return
|
||||
|
||||
cmd = "cat /etc/nailgun-agent/config.yaml"
|
||||
|
|
|
@ -604,8 +604,7 @@ class FuelBootstrapCliActions(AdminActions):
|
|||
ip=self.admin_ip,
|
||||
cmd=command,
|
||||
)['stdout_str']
|
||||
if "centos" in uuid:
|
||||
return "centos"
|
||||
|
||||
return self.parse_uuid(result)[0]
|
||||
|
||||
def build_bootstrap_image(self, **kwargs):
|
||||
|
@ -672,11 +671,10 @@ class FuelBootstrapCliActions(AdminActions):
|
|||
cmd=command)['stdout_str'].split('\n')
|
||||
|
||||
for line in bootstrap_images:
|
||||
if "active" in line and "centos" not in line:
|
||||
if "active" in line:
|
||||
return self.parse_uuid(line)[0]
|
||||
|
||||
logger.warning("No active bootstrap. Possibly centos is active or "
|
||||
"something went wrong. fuel-bootstrap list:\n{0}"
|
||||
logger.warning("No active bootstrap. Fuel-bootstrap list:\n{0}"
|
||||
.format("".join(bootstrap_images)))
|
||||
|
||||
def delete_bootstrap_image(self, uuid):
|
||||
|
|
|
@ -1,265 +0,0 @@
|
|||
# Copyright 2015 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 devops.helpers.helpers import wait
|
||||
from proboscis import SkipTest
|
||||
from proboscis import test
|
||||
from proboscis.asserts import assert_equal
|
||||
|
||||
from fuelweb_test.helpers import checkers
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test import settings
|
||||
from fuelweb_test.settings import NEUTRON_SEGMENT_TYPE
|
||||
from fuelweb_test.tests.base_test_case import SetupEnvironment
|
||||
from fuelweb_test.tests.base_test_case import TestBasic
|
||||
|
||||
|
||||
@test(groups=["bvt_centos_bootstrap"])
|
||||
class CentosBootstrap(TestBasic):
|
||||
@test(depends_on=[SetupEnvironment.prepare_release],
|
||||
groups=["activate_centos_bootstrap"])
|
||||
@log_snapshot_after_test
|
||||
def activate_centos_bootstrap(self):
|
||||
"""Verify than slaves retrieved CentOS bootstrap instead of Ubuntu
|
||||
|
||||
Scenario:
|
||||
1. Revert snapshot ready
|
||||
2. Choose CentOS bootstrap on master node
|
||||
3. Bootstrap slaves
|
||||
4. Verify bootstrap on slaves
|
||||
|
||||
Duration 15m
|
||||
Snapshot: activate_centos_bootstrap
|
||||
"""
|
||||
self.env.revert_snapshot("ready")
|
||||
|
||||
self.env.fuel_bootstrap_actions.activate_bootstrap_image("centos")
|
||||
|
||||
nodes = self.env.d_env.get_nodes(
|
||||
name__in=["slave-01", "slave-02", "slave-03"])
|
||||
|
||||
self.env.bootstrap_nodes(nodes)
|
||||
for node in nodes:
|
||||
_ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip']
|
||||
checkers.verify_bootstrap_on_node(_ip, os_type="centos")
|
||||
|
||||
self.env.make_snapshot("activate_centos_bootstrap",
|
||||
is_make=True)
|
||||
|
||||
@test(depends_on_groups=["activate_centos_bootstrap"],
|
||||
groups=["deploy_stop_on_deploying_centos_bootstrap"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_stop_on_deploying_centos_bootstrap(self):
|
||||
"""Stop reset cluster in HA mode with 1 controller on CentOS Bootstrap
|
||||
|
||||
Scenario:
|
||||
1. Create cluster in Ha mode with 1 controller
|
||||
2. Add 1 node with controller role
|
||||
3. Add 1 node with compute role
|
||||
4. Verify network
|
||||
5. Deploy cluster
|
||||
6. Stop deployment
|
||||
7. Verify bootstrap on slaves
|
||||
8. Add 1 node with cinder role
|
||||
9. Re-deploy cluster
|
||||
10. Verify network
|
||||
11. Run OSTF
|
||||
|
||||
Duration 45m
|
||||
Snapshot: deploy_stop_on_deploying_centos_bootstrap
|
||||
"""
|
||||
|
||||
if not self.env.revert_snapshot('activate_centos_bootstrap'):
|
||||
raise SkipTest()
|
||||
|
||||
cluster_id = self.fuel_web.create_cluster(
|
||||
name=self.__class__.__name__,
|
||||
mode=settings.DEPLOYMENT_MODE,
|
||||
settings={
|
||||
'tenant': 'stop_deploy',
|
||||
'user': 'stop_deploy',
|
||||
'password': 'stop_deploy',
|
||||
"net_provider": 'neutron',
|
||||
"net_segment_type": NEUTRON_SEGMENT_TYPE
|
||||
}
|
||||
)
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-01': ['controller'],
|
||||
'slave-02': ['compute']
|
||||
}
|
||||
)
|
||||
# Network verification
|
||||
self.fuel_web.verify_network(cluster_id)
|
||||
|
||||
# Deploy cluster and stop deployment, then verify bootstrap on slaves
|
||||
self.fuel_web.provisioning_cluster_wait(cluster_id)
|
||||
self.fuel_web.deploy_task_wait(cluster_id=cluster_id, progress=10)
|
||||
self.fuel_web.stop_deployment_wait(cluster_id)
|
||||
self.fuel_web.wait_nodes_get_online_state(
|
||||
self.env.d_env.get_nodes(name__in=['slave-01', 'slave-02']),
|
||||
timeout=10 * 60)
|
||||
|
||||
nodes = self.env.d_env.get_nodes(
|
||||
name__in=['slave-01', 'slave-02', 'slave-03'])
|
||||
for node in nodes:
|
||||
_ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip']
|
||||
checkers.verify_bootstrap_on_node(_ip, os_type="centos")
|
||||
|
||||
# Network verification
|
||||
self.fuel_web.verify_network(cluster_id)
|
||||
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-03': ['cinder']
|
||||
}
|
||||
)
|
||||
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
|
||||
assert_equal(
|
||||
3, len(self.fuel_web.client.list_cluster_nodes(cluster_id)))
|
||||
|
||||
# Run ostf
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id,
|
||||
test_sets=['smoke'])
|
||||
|
||||
self.env.make_snapshot(
|
||||
"deploy_stop_on_deploying_centos_bootstrap",
|
||||
is_make=True)
|
||||
|
||||
@test(depends_on_groups=['deploy_stop_on_deploying_centos_bootstrap'],
|
||||
groups=["deploy_reset_on_ready_centos_bootstrap"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_reset_on_ready_centos_bootstrap(self):
|
||||
"""Stop reset cluster in HA mode with 1 controller on CentOS Bootstrap
|
||||
|
||||
Scenario:
|
||||
1. Reset cluster
|
||||
2. Verify bootstrap on slaves
|
||||
3. Re-deploy cluster
|
||||
4. Verify network
|
||||
5. Run OSTF
|
||||
|
||||
Duration 30m
|
||||
"""
|
||||
|
||||
if not self.env.revert_snapshot(
|
||||
'deploy_stop_on_deploying_centos_bootstrap'):
|
||||
raise SkipTest()
|
||||
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
|
||||
# Reset environment,
|
||||
# then verify bootstrap on slaves and re-deploy cluster
|
||||
self.fuel_web.stop_reset_env_wait(cluster_id)
|
||||
|
||||
nodes = self.env.d_env.get_nodes(
|
||||
name__in=["slave-01", "slave-02", "slave-03"])
|
||||
|
||||
self.fuel_web.wait_nodes_get_online_state(nodes, timeout=10 * 60)
|
||||
for node in nodes:
|
||||
_ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip']
|
||||
checkers.verify_bootstrap_on_node(_ip, os_type="centos")
|
||||
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
|
||||
# Network verification
|
||||
self.fuel_web.verify_network(cluster_id)
|
||||
|
||||
# Run ostf
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id,
|
||||
test_sets=['smoke'])
|
||||
|
||||
@test(depends_on_groups=['deploy_stop_on_deploying_centos_bootstrap'],
|
||||
groups=["delete_on_ready_centos_bootstrap"])
|
||||
@log_snapshot_after_test
|
||||
def delete_on_ready_centos_bootstrap(self):
|
||||
"""Delete cluster cluster in HA mode\
|
||||
with 1 controller on CentOS Bootstrap
|
||||
|
||||
Scenario:
|
||||
1. Delete cluster
|
||||
2. Verify bootstrap on slaves
|
||||
|
||||
Duration 30m
|
||||
Snapshot: delete_on_ready_centos_bootstrap
|
||||
"""
|
||||
if not self.env.revert_snapshot(
|
||||
'deploy_stop_on_deploying_centos_bootstrap'):
|
||||
raise SkipTest()
|
||||
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
|
||||
# Delete cluster, then verify bootstrap on slaves
|
||||
self.fuel_web.client.delete_cluster(cluster_id)
|
||||
|
||||
# wait nodes go to reboot
|
||||
wait(lambda: not self.fuel_web.client.list_nodes(), timeout=10 * 60)
|
||||
|
||||
# wait for nodes to appear after bootstrap
|
||||
wait(lambda: len(self.fuel_web.client.list_nodes()) == 3,
|
||||
timeout=10 * 60)
|
||||
|
||||
nodes = self.env.d_env.get_nodes(
|
||||
name__in=["slave-01", "slave-02", "slave-03"])
|
||||
|
||||
for node in nodes:
|
||||
_ip = self.fuel_web.get_nailgun_node_by_devops_node(node)['ip']
|
||||
checkers.verify_bootstrap_on_node(_ip, os_type="centos")
|
||||
|
||||
self.env.make_snapshot(
|
||||
"delete_on_ready_centos_bootstrap",
|
||||
is_make=True)
|
||||
|
||||
@test(depends_on_groups=['deploy_stop_on_deploying_centos_bootstrap'],
|
||||
groups=["delete_node_on_ready_centos_bootstrap"])
|
||||
@log_snapshot_after_test
|
||||
def delete_node_on_ready_centos_bootstrap(self):
|
||||
"""Delete node from cluster in HA mode\
|
||||
with 1 controller on CentOS Bootstrap
|
||||
|
||||
Scenario:
|
||||
1. Delete node
|
||||
2. Verify bootstrap on slave
|
||||
|
||||
Duration 30m
|
||||
Snapshot: delete_on_ready_centos_bootstrap
|
||||
"""
|
||||
if not self.env.revert_snapshot(
|
||||
'deploy_stop_on_deploying_centos_bootstrap'):
|
||||
raise SkipTest()
|
||||
|
||||
cluster_id = self.fuel_web.get_last_created_cluster()
|
||||
|
||||
# Delete cluster, then verify bootstrap on slaves
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-03': ['cinder']
|
||||
},
|
||||
pending_addition=False,
|
||||
pending_deletion=True
|
||||
)
|
||||
|
||||
self.fuel_web.run_network_verify(cluster_id)
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id, check_services=False)
|
||||
|
||||
# wait for nodes to appear after bootstrap
|
||||
wait(lambda: len(self.fuel_web.client.list_nodes()) == 3,
|
||||
timeout=10 * 60)
|
||||
|
||||
node = self.fuel_web.get_nailgun_node_by_name(node_name="slave-03")
|
||||
checkers.verify_bootstrap_on_node(node['ip'], os_type="centos")
|
|
@ -72,53 +72,6 @@ def replace_fuel_agent_rpm():
|
|||
raise
|
||||
|
||||
|
||||
def patch_centos_bootstrap():
|
||||
"""Replaced initramfs.img in /var/www/nailgun/
|
||||
with newly_builded from review
|
||||
environment - Environment Model object - self.env
|
||||
"""
|
||||
logger.info("Update fuel-agent code and assemble new bootstrap")
|
||||
ssh = SSHManager()
|
||||
if not settings.UPDATE_FUEL:
|
||||
raise Exception("{} variable don't exist"
|
||||
.format(settings.UPDATE_FUEL))
|
||||
try:
|
||||
pack_path = '/var/www/nailgun/fuel-agent-review/'
|
||||
ssh.upload_to_remote(
|
||||
ip=ssh.admin_ip,
|
||||
source=settings.FUEL_AGENT_REPO_PATH.rstrip('/'),
|
||||
target=pack_path)
|
||||
# Step 1 - unpack bootstrap
|
||||
bootstrap_var = "/var/initramfs"
|
||||
bootstrap = "/var/www/nailgun/bootstrap"
|
||||
cmd = ("mkdir {0}; cp /{1}/initramfs.img {0}/; cd {0}; "
|
||||
"cat initramfs.img | gunzip | cpio -imudv;").format(
|
||||
bootstrap_var, bootstrap)
|
||||
result = ssh.execute_on_remote(
|
||||
ip=ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
logger.debug("Patching bootsrap finishes with {0}".format(result))
|
||||
|
||||
# Step 2 - replace fuel-agent code in unpacked bootstrap
|
||||
agent_path = "/usr/lib/python2.7/site-packages/fuel_agent"
|
||||
image_rebuild = "{} | {} | {}".format(
|
||||
"find . -xdev",
|
||||
"cpio --create --format='newc'",
|
||||
"gzip -9 > /var/initramfs.img.updated")
|
||||
|
||||
cmd = ("rm -rf {0}/initramfs.img; "
|
||||
"rsync -r {2}fuel_agent/* {0}{1}/;"
|
||||
"cd {0}/;"
|
||||
"{3};").format(bootstrap_var, agent_path, pack_path,
|
||||
image_rebuild)
|
||||
result = ssh.execute_on_remote(
|
||||
ip=ssh.admin_ip, cmd=cmd)['stdout_str']
|
||||
logger.debug("Failed to rebuild image with {0}".format(result))
|
||||
|
||||
except Exception as e:
|
||||
logger.error("Could not upload package {e}".format(e=e))
|
||||
raise
|
||||
|
||||
|
||||
def patch_and_assemble_ubuntu_bootstrap(environment):
|
||||
"""Replaced initramfs.img in /var/www/nailgun/
|
||||
with newly_builded from review
|
||||
|
@ -174,30 +127,6 @@ def patch_and_assemble_ubuntu_bootstrap(environment):
|
|||
raise
|
||||
|
||||
|
||||
def replace_centos_bootstrap(environment):
|
||||
"""Replaced initramfs.img in /var/www/nailgun/
|
||||
with re-builded with review code
|
||||
environment - Environment Model object - self.env
|
||||
"""
|
||||
logger.info("Updating bootstrap")
|
||||
ssh = SSHManager()
|
||||
if not settings.UPDATE_FUEL:
|
||||
raise Exception("{} variable don't exist"
|
||||
.format(settings.UPDATE_FUEL))
|
||||
rebuilded_bootstrap = '/var/initramfs.img.updated'
|
||||
checkers.check_file_exists(
|
||||
ssh.admin_ip,
|
||||
'{0}'.format(rebuilded_bootstrap))
|
||||
logger.info("Assigning new bootstrap from {}".format(rebuilded_bootstrap))
|
||||
bootstrap = "/var/www/nailgun/bootstrap"
|
||||
cmd = ("mv {0}/initramfs.img /var/initramfs.img;"
|
||||
"cp /var/initramfs.img.updated {0}/initramfs.img;"
|
||||
"chmod +r {0}/initramfs.img;").format(bootstrap)
|
||||
ssh.execute_on_remote(ip=ssh.admin_ip, cmd=cmd)
|
||||
cmd = "cobbler sync"
|
||||
ssh.execute_on_remote(ip=ssh.admin_ip, cmd=cmd)
|
||||
|
||||
|
||||
def update_ostf():
|
||||
logger.info("Uploading new package from {0}".format(
|
||||
settings.UPDATE_FUEL_PATH))
|
||||
|
|
Loading…
Reference in New Issue