def set_kv(vol_path, key, val): vol_meta = kvESX.load(vol_path) if not vol_meta: return False vol_meta[key] = val return kvESX.save(vol_path, vol_meta)
def get_kv(vol_path, key): """ Return a string value for the given key, or None if the key is not present. """ vol_meta = kvESX.load(vol_path) if not vol_meta: return None if key in vol_meta: return vol_meta[key] else: return None
def remove(vol_path, key): """ Remove a key/value pair from the store. Return true on success, false on error. """ vol_meta = kvESX.load(vol_path) if not vol_meta: return False if key in vol_meta: del vol_meta[key] return kvESX.save(vol_path, vol_meta)
def getAll(vol_path): """ Return the entire meta-data for the given vol_path. Return true if successful, false otherwise """ return kvESX.load(vol_path)