def _apply_crd(self, crd): """ Apply the CRD Args: crd (str): yaml to apply """ RipSaw.apply_crd(self, crd=crd)
def smallfile_run(self, es): """ Run the smallfiles workload so the elasticsearch server will have some data in it for copy Args: es (Elasticsearch): elastic search object Returns: str: the UUID of the test """ ripsaw = RipSaw() # Loading the main template yaml file for the benchmark and update some # fields with new values sf_data = templating.load_yaml(constants.SMALLFILE_BENCHMARK_YAML) # Setting up the parameters for this test sf_data["spec"]["elasticsearch"]["server"] = es.get_ip() sf_data["spec"]["elasticsearch"]["port"] = es.get_port() sf_data["spec"]["workload"]["args"]["samples"] = 1 sf_data["spec"]["workload"]["args"]["operation"] = ["create"] sf_data["spec"]["workload"]["args"]["file_size"] = 4 sf_data["spec"]["workload"]["args"]["files"] = 500000 sf_data["spec"]["workload"]["args"]["threads"] = 4 sf_data["spec"]["workload"]["args"][ "storageclass"] = constants.DEFAULT_STORAGECLASS_RBD sf_data["spec"]["workload"]["args"]["storagesize"] = "100Gi" # Deploy the ripsaw operator log.info("Apply Operator CRD") ripsaw.apply_crd("resources/crds/ripsaw_v1alpha1_ripsaw_crd.yaml") # deploy the smallfile workload log.info("Running SmallFile bench") sf_obj = OCS(**sf_data) sf_obj.create() # wait for benchmark pods to get created - takes a while for bench_pod in TimeoutSampler( 240, 10, get_pod_name_by_pattern, "smallfile-client", constants.RIPSAW_NAMESPACE, ): try: if bench_pod[0] is not None: small_file_client_pod = bench_pod[0] break except IndexError: log.info("Bench pod not ready yet") bench_pod = OCP(kind="pod", namespace=constants.RIPSAW_NAMESPACE) log.info("Waiting for SmallFile benchmark to Run") bench_pod.wait_for_resource( condition=constants.STATUS_RUNNING, resource_name=small_file_client_pod, sleep=30, timeout=600, ) for item in bench_pod.get()["items"][1]["spec"]["volumes"]: if "persistentVolumeClaim" in item: break uuid = ripsaw.get_uuid(small_file_client_pod) timeout = 600 while timeout >= 0: logs = bench_pod.get_logs(name=small_file_client_pod) if "RUN STATUS DONE" in logs: break timeout -= 30 if timeout == 0: raise TimeoutError( "Timed out waiting for benchmark to complete") time.sleep(30) ripsaw.cleanup() return uuid