Enable storage replication for V2 and add backfill tool

Fixes #1501
This commit is contained in:
Joseph Schorr 2016-05-31 16:43:49 -04:00
parent 1ddc73416c
commit 12924784ce
6 changed files with 93 additions and 12 deletions

View file

@ -0,0 +1,14 @@
import features
import json
from data import model
from app import image_replication_queue
def queue_storage_replication(namespace, storage):
""" Queues replication for the given image storage under the given namespace (if enabled). """
if features.STORAGE_REPLICATION:
namespace_user = model.user.get_namespace_user(namespace)
image_replication_queue.put([storage.uuid], json.dumps({
'namespace_user_id': namespace_user.id,
'storage_id': storage.uuid,
}))