Commit 199ad392 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

cyclades: Check volumes' type when creating server

When creating a server and attaching existing volumes, check that the
volume type of all volumes and of the server's flavor match.
parent bc4dd02a
......@@ -107,6 +107,10 @@ def create(userid, name, password, flavor, image_id, metadata={},
uuid = vol_info["source_uuid"]
v = get_volume(userid, uuid, for_update=True,
exception=faults.BadRequest)
if v.volume_type_id != server_vtype.id:
msg = ("Volume '%s' has type '%s' while flavor's volume type"
" is '%s'" % (v.volume_type_id, server_vtype.id))
raise faults.BadRequest(msg)
if v.status != "AVAILABLE":
raise faults.BadRequest("Cannot use volume while it is in %s"
" status" % v.status)
......
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