Commit ee82338a authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Allow snapshots only for ext_ template

Do not allow taking a snapshot from a volume, if the disk template is
not ext_*.
parent a02e30d9
......@@ -177,6 +177,7 @@ def get_image_dict(image_id, user_id):
image["name"] = img["name"]
image["format"] = img["disk_format"]
image["location"] = img["location"]
image["is_snapshot"] = img["is_snapshot"]
size = image["size"] = img["size"]
checksum = img["checksum"]
......
......@@ -20,6 +20,12 @@ def create(user_id, volume, name, description, metadata, force=False):
if volume.machine is None:
raise faults.BadRequest("Can not snapshot detached volume!")
flavor = volume.machine.flavor
if not flavor.disk_template.startswith("ext_"):
msg = ("Snapshots are supported only for volumes of ext_*"
" disk template")
raise faults.BadRequest(msg)
volume.snapshot_counter += 1
volume.save()
transaction.commit()
......
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