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 setAll(vol_path, vol_meta): """ Store the meta-data for a given vol-path Return true if successful, false otherwise """ if vol_meta: return kvESX.save(vol_path, vol_meta) # No data to save return True
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)