def test_scale_node_and_capacity(self):
        """
        Test for scaling 12 OCS worker nodes to the cluster
        Scale 12*3 = 36 OSDs
        """

        expected_worker_count = 12
        osds_per_node = 3

        try:
            # Gather existing deviceset, OSD and node count in setup
            existing_ocs_worker_list = get_worker_nodes()
            existing_deviceset_count = storage_cluster.get_deviceset_count()
            osd_replication_count = storage_cluster.get_osd_replica_count()
            expected_deviceset_count = (expected_worker_count /
                                        osds_per_node) * osd_replication_count

            # Check existing OCS worker node count and add nodes if required
            if len(existing_ocs_worker_list) < expected_worker_count:
                scale_worker_count = expected_worker_count - len(
                    existing_ocs_worker_list)
                if not scale_lib.scale_ocs_node(node_count=scale_worker_count):
                    raise OCSWorkerScaleFailed(
                        "OCS worker nodes scaling Failed")

            # Check existing OSD count and add OSDs if required
            if existing_deviceset_count < expected_deviceset_count:
                additional_deviceset = int(expected_deviceset_count -
                                           existing_deviceset_count)
                if not scale_lib.scale_capacity_with_deviceset(
                        add_deviceset_count=additional_deviceset, timeout=600):
                    raise OSDScaleFailed("Scaling OSDs Failed")

            # Check ceph health statuss
            utils.ceph_health_check(tries=30)

        except (OCSWorkerScaleFailed, OSDScaleFailed, Exception) as ex:
            TestAddNode.skip_all = True
            logging.warning(
                f"Due to Exception set TestAddNode.skip_all to {TestAddNode.skip_all}"
            )
            logging.error(f"Cluster not in expected state. {ex}")
Ejemplo n.º 2
0
    def test_scale_node_and_capacity(self):
        """
        Test for scaling 12 OCS worker nodes to the cluster
        Scale 12*3 = 36 OSDs
        """

        expected_worker_count = 12
        osds_per_node = 3

        try:
            # Gather existing deviceset, OSD and node count in setup
            existing_ocs_worker_list = get_worker_nodes()
            existing_deviceset_count = storage_cluster.get_deviceset_count()
            osd_replication_count = storage_cluster.get_osd_replica_count()
            expected_deviceset_count = (
                expected_worker_count / osds_per_node
            ) * osd_replication_count

            # Check existing OCS worker node count and add nodes if required
            if len(existing_ocs_worker_list) < expected_worker_count:
                scale_worker_count = expected_worker_count - len(
                    existing_ocs_worker_list
                )
                assert scale_lib.scale_ocs_node(node_count=scale_worker_count)

            # Check existing OSD count and add OSDs if required
            if existing_deviceset_count < expected_deviceset_count:
                add_deviceset_count = (
                    expected_deviceset_count - existing_deviceset_count
                )
                assert scale_lib.scale_capacity_with_deviceset(
                    add_deviceset_count=add_deviceset_count
                )

            # Check ceph health statuss
            utils.ceph_health_check(tries=30)

        except UnexpectedBehaviour:
            TestAddNode.skip_all = True
            logging.info("Cluster is not in expected state, unexpected behaviour")
            raise
Ejemplo n.º 3
0
def ui_add_capacity(osd_size_capacity_requested):
    """
    Add Capacity via UI

    Args:
        osd_size_capacity_requested (int): Requested osd size capacity

    Returns:
        new_storage_devices_sets_count (int) : Returns True if all OSDs are in Running state

    """
    osd_size_existing = get_osd_size()
    device_sets_required = int(osd_size_capacity_requested / osd_size_existing)
    old_storage_devices_sets_count = get_deviceset_count()
    new_storage_devices_sets_count = int(device_sets_required +
                                         old_storage_devices_sets_count)
    logger.info("Add capacity via UI")
    setup_ui = login_ui()
    add_ui_obj = AddReplaceDeviceUI(setup_ui)
    add_ui_obj.add_capacity_ui()
    close_browser(setup_ui)
    return new_storage_devices_sets_count