Merge "Test cluster upscaling and downscaling with Ironic" into stable/mitaka
This commit is contained in:
commit
5eabf395ce
|
@ -105,6 +105,11 @@ class IronicActions(os_actions.OpenStackActions):
|
|||
wait(lambda: tcp_ping(srv.networks['baremetal'][0], 22),
|
||||
timeout=60 * 10, timeout_msg='Failed to connect to port 22')
|
||||
|
||||
def delete_servers(self, ironic_conn):
|
||||
srv_list = ironic_conn.get_servers()
|
||||
for srv in srv_list:
|
||||
self.nova.servers.delete(srv)
|
||||
|
||||
def create_ironic_node(self, **kwargs):
|
||||
return self.ironic.node.create(**kwargs)
|
||||
|
||||
|
|
|
@ -12,9 +12,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import random
|
||||
|
||||
from proboscis import test
|
||||
|
||||
from fuelweb_test.helpers.decorators import log_snapshot_after_test
|
||||
from fuelweb_test.helpers.common import Common
|
||||
from fuelweb_test.helpers import ironic_actions
|
||||
from fuelweb_test.settings import DEPLOYMENT_MODE
|
||||
from fuelweb_test.settings import IRONIC_USER_IMAGE_URL
|
||||
|
@ -86,7 +89,7 @@ class TestIronicBase(TestBasic):
|
|||
|
||||
@test(groups=["ironic_deploy", "ironic"])
|
||||
class TestIronicDeploy(TestBasic):
|
||||
"""Test ironic provisioning on VM"""
|
||||
"""Test ironic provisioning on VM."""
|
||||
|
||||
def _deploy_ironic_cluster(self, **kwargs):
|
||||
default_settings = {
|
||||
|
@ -114,6 +117,7 @@ class TestIronicDeploy(TestBasic):
|
|||
)
|
||||
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
||||
|
||||
return cluster_id
|
||||
|
||||
|
@ -135,11 +139,18 @@ class TestIronicDeploy(TestBasic):
|
|||
|
||||
ironic_conn.wait_for_ironic_hypervisors(ironic_conn, ironic_slaves)
|
||||
|
||||
@staticmethod
|
||||
def _rand_name(name):
|
||||
"""Randomize the given name."""
|
||||
return name + str(random.randint(1, 0x7fffffff))
|
||||
|
||||
def _boot_nova_instances(self, ironic_conn):
|
||||
ironic_slaves = self.env.d_env.nodes().ironics
|
||||
user_image = ironic_conn.get_image_by_name('virtual_trusty_ext4')
|
||||
network = ironic_conn.nova.networks.find(label='baremetal')
|
||||
flavor = ironic_conn.create_flavor('baremetal_flavor', 1024, 1, 50)
|
||||
# Randomize name to avoid conflict on repetitive flavor creation.
|
||||
flavor_name = self._rand_name('baremetal_flavor')
|
||||
flavor = ironic_conn.create_flavor(flavor_name, 1024, 1, 50)
|
||||
nics = [{'net-id': network.id}]
|
||||
|
||||
for ironic_slave in ironic_slaves:
|
||||
|
@ -149,6 +160,13 @@ class TestIronicDeploy(TestBasic):
|
|||
flavor=flavor.id,
|
||||
nics=nics)
|
||||
|
||||
def _boot_check_delete_vm(self, ironic_conn):
|
||||
"""Boot instance, verify connection, then delete instance."""
|
||||
self._boot_nova_instances(ironic_conn)
|
||||
ironic_conn.wait_for_vms(ironic_conn)
|
||||
ironic_conn.verify_vms_connection(ironic_conn)
|
||||
ironic_conn.delete_servers(ironic_conn)
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||
groups=["ironic_deploy_swift"])
|
||||
@log_snapshot_after_test
|
||||
|
@ -379,3 +397,114 @@ class TestIronicDeploy(TestBasic):
|
|||
ironic_conn.verify_vms_connection(ironic_conn)
|
||||
|
||||
self.env.make_snapshot("ironic_deploy_ceilometer")
|
||||
|
||||
@test(depends_on=[SetupEnvironment.prepare_slaves_5],
|
||||
groups=["deploy_scale_controller_ironic"])
|
||||
@log_snapshot_after_test
|
||||
def deploy_scale_controller_ironic(self):
|
||||
"""Test cluster scaling with Controller and Ironic
|
||||
|
||||
Scenario:
|
||||
1. Create cluster with 5 slave nodes
|
||||
2. Bootstrap 1 additional slave node
|
||||
3. Add 2 Controller nodes
|
||||
4. Add 1 Compute node
|
||||
5. Add 1 Controller+Ironic node
|
||||
6. Deploy the cluster
|
||||
7. Run OSTF tests
|
||||
8. Boot, check connectivity, delete Ironic VM
|
||||
9. Rebalance Swift rings
|
||||
10. Add 1 Controller node
|
||||
11. Add 1 Controller+Ironic node
|
||||
12. Redeploy the cluster
|
||||
13. Run OSTF tests
|
||||
14. Boot, check connectivity, delete Ironic VM
|
||||
15. Rebalance Swift rings
|
||||
16. Remove 1 Controller node
|
||||
17. Remove 1 Controller+Ironic node
|
||||
18. Redeploy the cluster
|
||||
19. Run OSTF tests
|
||||
20. Boot, check connectivity, delete Ironic VM
|
||||
|
||||
Duration 90m
|
||||
Snapshot deploy_scale_controller_ironic
|
||||
"""
|
||||
|
||||
self.env.revert_snapshot("ready_with_5_slaves")
|
||||
# Deploy 1st part
|
||||
data = {
|
||||
'net_segment_type': NEUTRON_SEGMENT['vlan'],
|
||||
'ironic': True}
|
||||
|
||||
nodes = {
|
||||
'slave-01': ['controller'],
|
||||
'slave-02': ['controller'],
|
||||
'slave-03': ['controller', 'ironic'],
|
||||
'slave-04': ['compute']}
|
||||
|
||||
self.show_step(1)
|
||||
self.show_step(2)
|
||||
self.env.bootstrap_nodes(self.env.d_env.nodes().slaves[5:6])
|
||||
self.show_step(3)
|
||||
self.show_step(4)
|
||||
self.show_step(5)
|
||||
self.show_step(6)
|
||||
self.show_step(7)
|
||||
cluster_id = self._deploy_ironic_cluster(settings=data, nodes=nodes)
|
||||
ironic_conn = ironic_actions.IronicActions(
|
||||
self.fuel_web.get_public_vip(cluster_id))
|
||||
self._create_os_resources(ironic_conn)
|
||||
self.show_step(8)
|
||||
self._boot_check_delete_vm(ironic_conn)
|
||||
|
||||
# Rebalance swift rings, add nodes and redeploy
|
||||
self.show_step(9)
|
||||
primary_node = self.fuel_web.get_nailgun_primary_node(
|
||||
self.env.d_env.nodes().slaves[0])
|
||||
ip = self.fuel_web.get_nailgun_node_by_name(primary_node.name)['ip']
|
||||
Common.rebalance_swift_ring(ip)
|
||||
self.show_step(10)
|
||||
self.show_step(11)
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-05': ['controller'],
|
||||
'slave-06': ['controller', 'ironic']
|
||||
}
|
||||
)
|
||||
self.show_step(12)
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
self.show_step(13)
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
||||
self.show_step(14)
|
||||
ironic_conn = ironic_actions.IronicActions(
|
||||
self.fuel_web.get_public_vip(cluster_id))
|
||||
self._boot_check_delete_vm(ironic_conn)
|
||||
|
||||
# Rebalance swift rings, remove nodes and redeploy
|
||||
self.show_step(15)
|
||||
primary_node = self.fuel_web.get_nailgun_primary_node(
|
||||
self.env.d_env.nodes().slaves[0])
|
||||
ip = self.fuel_web.get_nailgun_node_by_name(primary_node.name)['ip']
|
||||
Common.rebalance_swift_ring(ip)
|
||||
self.show_step(16)
|
||||
self.show_step(17)
|
||||
self.fuel_web.update_nodes(
|
||||
cluster_id,
|
||||
{
|
||||
'slave-05': ['controller'],
|
||||
'slave-06': ['controller', 'ironic']
|
||||
},
|
||||
pending_addition=False,
|
||||
pending_deletion=True
|
||||
)
|
||||
self.show_step(18)
|
||||
self.fuel_web.deploy_cluster_wait(cluster_id)
|
||||
self.show_step(19)
|
||||
self.fuel_web.run_ostf(cluster_id=cluster_id)
|
||||
self.show_step(20)
|
||||
ironic_conn = ironic_actions.IronicActions(
|
||||
self.fuel_web.get_public_vip(cluster_id))
|
||||
self._boot_check_delete_vm(ironic_conn)
|
||||
|
||||
self.env.make_snapshot("deploy_scale_controller_ironic")
|
||||
|
|
Loading…
Reference in New Issue