Beispiel #1
0
 def delete_pvc_pod(self):
     """
     Function to delete pvc and pod based on the delete pod count.
     """
     log.info(f"Delete {self.delete_pod_count} pods and respective pvcs")
     temp_pod_list = random.choices(self.all_pod_obj,
                                    k=self.delete_pod_count)
     temp_pvc_list = []
     for pod_obj in temp_pod_list:
         list_counter_for_pvc = 0
         for pvc_obj in self.all_pvc_obj:
             if pvc_obj is not None:
                 if type(pvc_obj) is list:
                     for pvc_ in pvc_obj:
                         if pod.get_pvc_name(pod_obj) == pvc_.name:
                             temp_pvc_list.append(pvc_)
                             log.info(f"Deleting pvc {pvc_.name}")
                             self.all_pvc_obj[list_counter_for_pvc].remove(
                                 pvc_)
                 else:
                     if pod.get_pvc_name(pod_obj) == pvc_obj.name:
                         temp_pvc_list.append(pvc_obj)
                         log.info(f"Deleting pvc {pvc_obj.name}")
                         self.all_pvc_obj.remove(pvc_obj)
             list_counter_for_pvc += 1
         log.info(f"Deleting pod {pod_obj.name}")
         if pod_obj in self.all_pod_obj:
             self.all_pod_obj.remove(pod_obj)
     helpers.delete_objs_parallel(temp_pod_list)
     helpers.delete_objs_parallel(temp_pvc_list)
 def cleanup(self):
     """
     Function to cleanup the SC, PVC and POD objects parallel.
     """
     helpers.delete_objs_parallel(pod.get_all_pods(namespace=self.namespace))
     helpers.delete_objs_parallel(self.all_pvc_obj)
     self.rbd_sc_obj.delete()
     self.cephfs_sc_obj.delete()