def test_nodereplacement_proactive(self, pvc_factory, pod_factory, dc_pod_factory): """ Knip-894 Node Replacement proactive """ # Get worker nodes worker_node_list = get_worker_nodes() log.info(f"Current available worker nodes are {worker_node_list}") osd_pods_obj = pod.get_osd_pods() osd_node_name = pod.get_pod_node(random.choice(osd_pods_obj)).name log.info(f"Selected OSD is {osd_node_name}") log.info("Creating dc pod backed with rbd pvc and running io in bg") for worker_node in worker_node_list: if worker_node != osd_node_name: rbd_dc_pod = dc_pod_factory(interface=constants.CEPHBLOCKPOOL, node_name=worker_node, size=20) pod.run_io_in_bg(rbd_dc_pod, expect_to_fail=False, fedora_dc=True) log.info("Creating dc pod backed with cephfs pvc and running io in bg") for worker_node in worker_node_list: if worker_node != osd_node_name: cephfs_dc_pod = dc_pod_factory(interface=constants.CEPHFILESYSTEM, node_name=worker_node, size=20) pod.run_io_in_bg(cephfs_dc_pod, expect_to_fail=False, fedora_dc=True) if config.ENV_DATA['platform'].lower() == constants.AWS_PLATFORM: if config.ENV_DATA['deployment_type'] == 'ipi': node.delete_and_create_osd_node_aws_ipi(osd_node_name) elif config.ENV_DATA['deployment_type'] == 'upi': node.delete_and_create_osd_node_aws_upi(osd_node_name) else: pytest.fail( f"ocs-ci config 'deployment_type' value '{config.ENV_DATA['deployment_type']}' is not valid, " f"results of this test run are all invalid.") elif config.ENV_DATA['platform'].lower() == constants.VSPHERE_PLATFORM: pytest.skip("Skipping add node in Vmware platform due to " "https://bugzilla.redhat.com/show_bug.cgi?id=1844521" ) # Creating Resources log.info("Creating Resources using sanity helpers") self.sanity_helpers.create_resources(pvc_factory, pod_factory) # Deleting Resources self.sanity_helpers.delete_resources() # Verify everything running fine log.info("Verifying All resources are Running and matches expected result") self.sanity_helpers.health_check(tries=30)
def delete_and_create_osd_node(osd_node_name): """ Delete an osd node, and create a new one to replace it Args: osd_node_name (str): The osd node name to delete """ # error message for invalid deployment configuration msg_invalid = ( "ocs-ci config 'deployment_type' value " f"'{config.ENV_DATA['deployment_type']}' is not valid, " f"results of this test run are all invalid." ) # TODO: refactor this so that AWS is not a "special" platform if config.ENV_DATA['platform'].lower() == constants.AWS_PLATFORM: if config.ENV_DATA['deployment_type'] == 'ipi': node.delete_and_create_osd_node_ipi(osd_node_name) elif config.ENV_DATA['deployment_type'] == 'upi': node.delete_and_create_osd_node_aws_upi(osd_node_name) else: log.error(msg_invalid) pytest.fail(msg_invalid) elif config.ENV_DATA['platform'].lower() in constants.CLOUD_PLATFORMS: if config.ENV_DATA['deployment_type'] == 'ipi': node.delete_and_create_osd_node_ipi(osd_node_name) else: log.error(msg_invalid) pytest.fail(msg_invalid) elif config.ENV_DATA['platform'].lower() == constants.VSPHERE_PLATFORM: worker_nodes_not_in_ocs = node.get_worker_nodes_not_in_ocs() if not worker_nodes_not_in_ocs: pytest.skip( "Skipping the test because we don't have an " "extra worker node that not in ocs" ) else: log.info( "Perform delete and create ocs node in Vmware using one " "of the existing extra worker nodes that not in ocs" ) node.delete_and_create_osd_node_vsphere_upi( osd_node_name, use_existing_node=True )
def delete_and_create_osd_node(osd_node_name): """ Delete an osd node, and create a new one to replace it Args: osd_node_name (str): The osd node name to delete """ new_node_name = None osd_pod = node.get_node_pods(osd_node_name, pods_to_search=pod.get_osd_pods())[0] old_osd_id = pod.get_osd_pod_id(osd_pod) old_osd_node_names = node.get_osd_running_nodes() # error message for invalid deployment configuration msg_invalid = ("ocs-ci config 'deployment_type' value " f"'{config.ENV_DATA['deployment_type']}' is not valid, " f"results of this test run are all invalid.") # TODO: refactor this so that AWS is not a "special" platform if config.ENV_DATA["platform"].lower() == constants.AWS_PLATFORM: if config.ENV_DATA["deployment_type"] == "ipi": new_node_name = node.delete_and_create_osd_node_ipi(osd_node_name) elif config.ENV_DATA["deployment_type"] == "upi": new_node_name = node.delete_and_create_osd_node_aws_upi( osd_node_name) else: log.error(msg_invalid) pytest.fail(msg_invalid) elif config.ENV_DATA["platform"].lower() in constants.CLOUD_PLATFORMS: if config.ENV_DATA["deployment_type"] == "ipi": new_node_name = node.delete_and_create_osd_node_ipi(osd_node_name) else: log.error(msg_invalid) pytest.fail(msg_invalid) elif config.ENV_DATA["platform"].lower() == constants.VSPHERE_PLATFORM: if is_lso_cluster(): new_node_name = node.delete_and_create_osd_node_vsphere_upi_lso( osd_node_name, use_existing_node=False) else: new_node_name = node.delete_and_create_osd_node_vsphere_upi( osd_node_name, use_existing_node=False) log.info("Start node replacement verification steps...") check_node_replacement_verification_steps(osd_node_name, new_node_name, old_osd_node_names, old_osd_id)
def delete_and_create_osd_node(osd_node_name): """ Delete an osd node, and create a new one to replace it Args: osd_node_name (str): The osd node name to delete """ new_node_name = None old_osd_ids = node.get_node_osd_ids(osd_node_name) old_osd_node_names = node.get_osd_running_nodes() # error message for invalid deployment configuration msg_invalid = ("ocs-ci config 'deployment_type' value " f"'{config.ENV_DATA['deployment_type']}' is not valid, " f"results of this test run are all invalid.") if config.ENV_DATA["deployment_type"] == "ipi": if is_lso_cluster(): # TODO: Implement functionality for Internal-Attached devices mode # once ocs-ci issue #4545 is resolved # https://github.com/red-hat-storage/ocs-ci/issues/4545 pytest.skip( "Functionality not implemented for this deployment mode") else: new_node_name = node.delete_and_create_osd_node_ipi(osd_node_name) elif config.ENV_DATA["deployment_type"] == "upi": if config.ENV_DATA["platform"].lower() == constants.AWS_PLATFORM: new_node_name = node.delete_and_create_osd_node_aws_upi( osd_node_name) elif config.ENV_DATA["platform"].lower() == constants.VSPHERE_PLATFORM: if is_lso_cluster(): new_node_name = node.delete_and_create_osd_node_vsphere_upi_lso( osd_node_name, use_existing_node=False) else: new_node_name = node.delete_and_create_osd_node_vsphere_upi( osd_node_name, use_existing_node=False) else: log.error(msg_invalid) pytest.fail(msg_invalid) log.info("Start node replacement verification steps...") check_node_replacement_verification_steps(osd_node_name, new_node_name, old_osd_node_names, old_osd_ids)