def file_exists(params, filename_path): """ Check if image_filename exists. :param params: Dictionary containing the test parameters. :param filename_path: path to file :type filename_path: str :param root_dir: Base directory for relative filenames. :type root_dir: str :return: True if image file exists else False """ gluster_image = params.get("gluster_brick") if gluster_image: return gluster.file_exists(params, filename_path) if params.get("enable_ceph") == "yes": image_name = params.get("image_name") image_format = params.get("image_format", "qcow2") ceph_monitor = params["ceph_monitor"] rbd_pool_name = params["rbd_pool_name"] rbd_image_name = "%s.%s" % (image_name.split("/")[-1], image_format) return ceph.rbd_image_exist(ceph_monitor, rbd_pool_name, rbd_image_name) return os.path.exists(filename_path)
def file_exists(params, filename_path): """ Check if image_filename exists. :param params: Dictionary containing the test parameters. :param filename_path: path to file :type filename_path: str :param root_dir: Base directory for relative filenames. :type root_dir: str :return: True if image file exists else False """ gluster_image = params.get("gluster_brick") if gluster_image: return gluster.file_exists(params, filename_path) return os.path.exists(filename_path)