Merge pull request #1633 from coreos-inc/duplicate-replication
Don't raise an error on duplicate placements
This commit is contained in:
commit
2ba1f5435a
2 changed files with 4 additions and 2 deletions
|
@ -39,7 +39,10 @@ def get_image_location_for_id(location_id):
|
||||||
def add_storage_placement(storage, location_name):
|
def add_storage_placement(storage, location_name):
|
||||||
""" Adds a storage placement for the given storage at the given location. """
|
""" Adds a storage placement for the given storage at the given location. """
|
||||||
location = get_image_location_for_name(location_name)
|
location = get_image_location_for_name(location_name)
|
||||||
ImageStoragePlacement.create(location=location.id, storage=storage)
|
try:
|
||||||
|
ImageStoragePlacement.create(location=location.id, storage=storage)
|
||||||
|
except IntegrityError:
|
||||||
|
# Placement already exists. Nothing to do.
|
||||||
|
|
||||||
|
|
||||||
def garbage_collect_storage(storage_id_whitelist):
|
def garbage_collect_storage(storage_id_whitelist):
|
||||||
|
|
|
@ -46,7 +46,6 @@ class StorageReplicationWorker(QueueWorker):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# For any missing storage locations, initiate a copy.
|
# For any missing storage locations, initiate a copy.
|
||||||
storage_paths = StoragePaths()
|
|
||||||
existing_location = list(partial_storage.locations)[0]
|
existing_location = list(partial_storage.locations)[0]
|
||||||
|
|
||||||
for location in locations_missing:
|
for location in locations_missing:
|
||||||
|
|
Reference in a new issue