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()
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: for pvc_obj in self.all_pvc_obj: 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) 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)