Commit 9acd4c4e authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Copy VM metadata only for root volume

When taking a snapshot of a volume, copy the metadata of the VM into
the image properties only when the volume is the root volume of the VM.
parent b1b4637b
......@@ -77,9 +77,13 @@ def create(user_id, volume, name, description, metadata, force=False):
# the server that the volume is attached
metadata.update({"EXCLUDE_ALL_TASKS": "yes",
"description": description})
if volume.index == 0:
# Copy the metadata of the VM into the image properties only when the
# volume is the root volume of the VM.
vm_metadata = dict(volume.machine.metadata
.filter(meta_key__in=["OS", "users"])
.values_list("meta_key", "meta_value"))
.values_list("meta_key",
"meta_value"))
metadata.update(vm_metadata)
snapshot_properties = PlanktonBackend._prefix_properties(metadata)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment