def create_nodes_and_wait_till_registered(inventory_client, cluster, image_path, storage_path, master_count, nodes_details): nodes_count = master_count + nodes_details["worker_count"] create_nodes( image_path, storage_path=storage_path, master_count=master_count, nodes_details=nodes_details, ) # TODO: Check for only new nodes utils.wait_till_nodes_are_ready( nodes_count=nodes_count, network_name=nodes_details["libvirt_network_name"]) if not inventory_client: log.info("No inventory url, will not wait till nodes registration") return log.info("Wait till nodes will be registered") waiting.wait( lambda: utils.are_all_libvirt_nodes_in_cluster_hosts( inventory_client, cluster.id, nodes_details["libvirt_network_name"] ), timeout_seconds=consts.NODES_REGISTERED_TIMEOUT, sleep_seconds=10, waiting_for="Nodes to be registered in inventory service", ) log.info("Registered nodes are:") pprint.pprint(inventory_client.get_cluster_hosts(cluster.id))
def day2_nodes_flow(client, cluster_name, cluster, image_path, num_worker_nodes, api_vip_ip, api_vip_dnsname, namespace, install_cluster_flag): tf_network_name, total_num_nodes = apply_day2_tf_configuration( cluster_name, num_worker_nodes, api_vip_ip, api_vip_dnsname, namespace) with utils.file_lock_context(): utils.run_command(f'make _apply_terraform CLUSTER_NAME={cluster_name}') time.sleep(5) utils.wait_till_nodes_are_ready(nodes_count=total_num_nodes, network_name=tf_network_name) waiting.wait( lambda: utils.are_libvirt_nodes_in_cluster_hosts( client, cluster.id, num_worker_nodes), timeout_seconds=consts.NODES_REGISTERED_TIMEOUT, sleep_seconds=10, waiting_for="Nodes to be registered in inventory service", ) utils.wait_till_all_hosts_are_in_status( client=client, cluster_id=cluster.id, nodes_count=num_worker_nodes, statuses=[consts.NodesStatus.KNOWN], interval=30, ) if install_cluster_flag: log.info("Start installing all known nodes in the cluster %s", cluster.id) config_etc_hosts(api_vip_ip, api_vip_dnsname) ocp_orig_ready_nodes = get_ocp_cluster_ready_nodes_num() client.install_day2_cluster(cluster.id) log.info( "Start waiting until all nodes of cluster %s have been installed( reached added-to-existing-clustertate)", cluster.id) utils.wait_till_all_hosts_are_in_status( client=client, cluster_id=cluster.id, nodes_count=num_worker_nodes, statuses=[consts.NodesStatus.DAY2_INSTALLED], interval=30, ) log.info( "Start waiting until installed nodes has actually been added to the OCP cluster" ) waiting.wait( lambda: wait_nodes_join_ocp_cluster(ocp_orig_ready_nodes, num_worker_nodes), timeout_seconds=consts.NODES_REGISTERED_TIMEOUT, sleep_seconds=30, waiting_for="Day2 nodes to be added to OCP cluster", ) log.info("%d worker nodes were successfully added to OCP cluster", num_worker_nodes)
def create_nodes_and_wait_till_registered(inventory_client, cluster, image_path, storage_path, master_count, nodes_details): nodes_count = master_count + nodes_details["worker_count"] create_nodes(image_path, storage_path=storage_path, master_count=master_count, nodes_details=nodes_details) utils.wait_till_nodes_are_ready(nodes_count=nodes_count, cluster_name=nodes_details["cluster_name"]) if not inventory_client: log.info("No inventory url, will not wait till nodes registration") return log.info("Wait till nodes will be registered") waiting.wait(lambda: len(inventory_client.get_cluster_hosts(cluster.id)) >= nodes_count, timeout_seconds=consts.NODES_REGISTERED_TIMEOUT, sleep_seconds=5, waiting_for="Nodes to be registered in inventory service") log.info("Registered nodes are:") pprint.pprint(inventory_client.get_cluster_hosts(cluster.id)) utils.wait_till_all_hosts_are_in_status(client=inventory_client, cluster_id=cluster.id, nodes_count=nodes_count, status=consts.NodesStatus.KNOWN)
def day2_nodes_flow(client, cluster_name, cluster, image_path, num_worker_nodes, api_vip_ip, api_vip_dnsname, namespace, install_cluster_flag): tf_network_name, total_num_nodes = apply_day2_tf_configuration( cluster_name, num_worker_nodes, api_vip_ip, api_vip_dnsname, namespace) with utils.file_lock_context(): utils.run_command(f'make _apply_terraform CLUSTER_NAME={cluster_name}') time.sleep(5) utils.wait_till_nodes_are_ready(nodes_count=total_num_nodes, network_name=tf_network_name) waiting.wait( lambda: utils.are_libvirt_nodes_in_cluster_hosts( client, cluster.id, num_worker_nodes), timeout_seconds=consts.NODES_REGISTERED_TIMEOUT, sleep_seconds=10, waiting_for="Nodes to be registered in inventory service", ) utils.wait_till_all_hosts_are_in_status( client=client, cluster_id=cluster.id, nodes_count=num_worker_nodes, statuses=[consts.NodesStatus.KNOWN], interval=30, ) if install_cluster_flag: client.install_day2_cluster(cluster.id) utils.wait_till_all_hosts_are_in_status( client=client, cluster_id=cluster.id, nodes_count=num_worker_nodes, statuses=[consts.NodesStatus.DAY2_INSTALLED], interval=30, )