Exemplo n.º 1
0
 def test_pod_start_time(self, pod):
     """
     Test to log pod start time
     """
     start_time_dict = pod_start_time(pod)
     start_time = start_time_dict["web-server"]
     logging.info(f"pod start time: {start_time} seconds")
     if start_time > 30:
         raise ex.PerformanceException(f"pod start time is {start_time},"
                                       f"which is greater than 30 seconds")
Exemplo n.º 2
0
    def test_pod_start_time(self, pod):
        """
        Test to log pod start time
        """
        # Getting the test start time
        self.start_time = self.get_time()

        # The actual test
        start_time_dict = pod_start_time(pod)

        # Getting the full path for the test logs
        self.full_log_path = get_full_test_logs_path(cname=self)
        if self.interface == constants.CEPHBLOCKPOOL:
            self.sc = "RBD"
        elif self.interface == constants.CEPHFILESYSTEM:
            self.sc = "CephFS"
        elif self.interface == constants.CEPHBLOCKPOOL_THICK:
            self.sc = "RBD-Thick"
        self.full_log_path += f"-{self.sc}"
        log.info(f"Logs file path name is : {self.full_log_path}")

        # Collecting environment information
        self.get_env_info()

        # Initialize the results doc file.
        self.full_results = self.init_full_results(
            ResultsAnalyse(self.uuid, self.crd_data, self.full_log_path))

        start_time = start_time_dict["web-server"]
        logging.info(f"pod start time: {start_time} seconds")
        if start_time > 30:
            raise ex.PerformanceException(f"pod start time is {start_time},"
                                          f"which is greater than 30 seconds")
        self.full_results.add_key("storageclass", self.sc)
        self.full_results.add_key("attach_time", start_time)

        # Getting the test end time
        self.end_time = self.get_time()

        # Add the test time to the ES report
        self.full_results.add_key("test_time", {
            "start": self.start_time,
            "end": self.end_time
        })

        # Write the test results into the ES server
        self.full_results.es_write()

        # write the ES link to the test results in the test log.
        log.info(
            f"The Result can be found at : {self.full_results.results_link()}")
Exemplo n.º 3
0
    def run(self):
        """
        Running the test
        """
        for i in range(self.samples_num):

            # Creating PVC to attache POD to it
            csi_start_time = self.get_time("csi")
            log.info(f"{self.msg_prefix} Start creating PVC number {i + 1}.")
            pvc_obj = helpers.create_pvc(sc_name=self.sc_obj.name,
                                         size=self.pvc_size,
                                         namespace=self.namespace)
            helpers.wait_for_resource_state(pvc_obj, constants.STATUS_BOUND)
            pvc_obj.reload()
            self.pvc_list.append(pvc_obj)
            log.info(
                f"{self.msg_prefix} PVC number {i + 1} was successfully created ."
            )

            # Create a POD and attache it the the PVC
            try:
                pod_obj = helpers.create_pod(
                    interface_type=self.interface,
                    pvc_name=pvc_obj.name,
                    namespace=self.namespace,
                    pod_dict_path=constants.PERF_POD_YAML,
                )
                helpers.wait_for_resource_state(pod_obj,
                                                constants.STATUS_RUNNING)
                pod_obj.reload()
            except Exception as e:
                log.error(
                    f"Pod on PVC {pvc_obj.name} was not created, exception {str(e)}"
                )
                raise ex.PodNotCreated("Pod on PVC was not created.")
            self.pod_result_list.append(pod_obj)

            # Get the POD start time including the attache time
            self.start_time_dict_list.append(helpers.pod_start_time(pod_obj))
            self.csi_time_dict_list.append(
                performance_lib.pod_attach_csi_time(self.interface,
                                                    pvc_obj.backed_pv,
                                                    csi_start_time,
                                                    self.namespace)[0])
Exemplo n.º 4
0
def measure_pod_to_pvc_attach_time(pod_objs):
    """
    Measures and Logs Attach Time of all PODs.

    Args:
        pod_objs (list) : List of POD objects for which we have to measure the time.

    Logs:
        Attach time of all PODs, as well as the average time.

    """
    pod_start_time_dict_list = []
    for pod_obj in pod_objs:
        pod_start_time_dict_list.append(helpers.pod_start_time(pod_obj))
    log.info(str(pod_start_time_dict_list))
    time_measures = []
    for attach_time in pod_start_time_dict_list:
        if "my-container" in attach_time:
            time_measures.append(attach_time["my-container"])
        elif "web-server" in attach_time:
            time_measures.append(attach_time["web-server"])
        else:
            time_measures.append(attach_time["performance"])
    for index, start_time in enumerate(time_measures):
        if start_time <= 30:
            log.info(
                f"POD {pod_objs[index].name} attach time: {start_time} seconds"
            )
        else:
            log.error(
                f"POD {pod_objs[index].name} attach time is {start_time},"
                f"which is greater than 30 seconds")
    if time_measures:
        average = statistics.mean(time_measures)
        log.info(
            f"The average attach time for the sampled {len(time_measures)} pods is {average} seconds."
        )
Exemplo n.º 5
0
    def test_pod_start_time(self, pod_obj_list):
        """
        Test to log pod start times for all the sampled pods
        """
        # Getting the test start time
        self.test_start_time = PASTest.get_time()

        # Start of the actual test
        start_time_dict_list = []
        for pod in pod_obj_list:
            start_time_dict_list.append(pod_start_time(pod))

        # Getting the full path for the test logs
        self.full_log_path = get_full_test_logs_path(cname=self)
        if self.interface == constants.CEPHBLOCKPOOL:
            self.sc = "RBD"
        elif self.interface == constants.CEPHFILESYSTEM:
            self.sc = "CephFS"
        elif self.interface == constants.CEPHBLOCKPOOL_THICK:
            self.sc = "RBD-Thick"
        self.full_log_path += f"-{self.sc}"
        log.info(f"Logs file path name is : {self.full_log_path}")

        # Collecting environment information
        self.get_env_info()

        # Initialize the results doc file.
        self.full_results = self.init_full_results(
            ResultsAnalyse(self.uuid, self.crd_data, self.full_log_path)
        )
        self.full_results.add_key("storageclass", self.sc)

        time_measures = [t["web-server"] for t in start_time_dict_list]
        for index, start_time in enumerate(time_measures):
            logging.info(
                f"{self.msg_prefix} pod number {index} start time: {start_time} seconds"
            )
            if start_time > 30:
                raise ex.PerformanceException(
                    f"{self.msg_prefix} Pod number {index} start time is {start_time},"
                    f"which is greater than 30 seconds"
                )
        self.full_results.add_key("attach_time", time_measures)

        average = statistics.mean(time_measures)
        logging.info(
            f"{self.msg_prefix} The average time for the sampled {len(time_measures)} pods is {average} seconds."
        )
        self.full_results.add_key("attach_time_average", average)

        st_deviation = statistics.stdev(time_measures)
        st_deviation_percent = st_deviation / average * 100.0
        logging.info(
            f"{self.msg_prefix} The standard deviation percent for the sampled {len(time_measures)} pods"
            f" is {st_deviation_percent}"
        )
        self.full_results.add_key("attach_time_stdev_percent", st_deviation_percent)

        # Getting the test end time
        self.test_end_time = PASTest.get_time()

        # Add the test time to the ES report
        self.full_results.add_key(
            "test_time", {"start": self.test_start_time, "end": self.test_end_time}
        )

        self.full_results.add_key("samples_number", self.samples_num)
        self.full_results.add_key("pvc_size", self.pvc_size)

        # Write the test results into the ES server
        self.full_results.es_write()

        # write the ES link to the test results in the test log.
        log.info(
            f"{self.msg_prefix} The Result can be found at : {self.full_results.results_link()}"
        )