def getVMDK(vmdk_path, vol_name, datastore):
"""Checks if the volume exists, and returns error if it does not"""
# Note: will return more Volume info here, when Docker API actually accepts it
logging.debug("getVMDK: vmdk_path=%s vol_name=%s, datastore=%s", vmdk_path, vol_name, datastore)
file_exist = os.path.isfile(vmdk_path)
logging.debug("getVMDK: file_exist=%d", file_exist)
if not os.path.isfile(vmdk_path):
return err("Volume {0} not found (file: {1})".format(vol_name, vmdk_path))
# Return volume info - volume policy, size, allocated capacity, allocation
# type, creat-by, create time.
try:
result = vol_info(kv.getAll(vmdk_path),
kv.get_vol_info(vmdk_path),
datastore)
except Exception as ex:
logging.error("Failed to get disk details for %s (%s)" % (vmdk_path, ex))
return None
return result
评论列表
文章目录