Commit fb4e411e authored by Georgios D. Tsoukalas's avatar Georgios D. Tsoukalas

cyclades: Fix flavor allow_create in change flavor

Check for flavor attribute 'allow_create' both when creating
a server and when changing a server to a new flavor.

Previously, the check was only made when creating a server.
parent b00b708a
......@@ -41,6 +41,7 @@ Cyclades
* Imporove SynnefoExceptionReporterFilter to better cleanse request body.
* Make eventd detect Ganeti Master failovers and allow having multiple eventd
instances running in the Ganeti cluster.
* Fix flavor allow_create not enforced in server resize/change flavor
Admin
-----
......
......@@ -1026,6 +1026,10 @@ def resize(request, vm, args):
if flavor_id is None:
raise faults.BadRequest("Missing 'flavorRef' attribute.")
flavor = util.get_flavor(flavor_id=flavor_id, include_deleted=False)
if not util.can_create_flavor(flavor, request.user):
msg = ("It is not allowed to resize a server to flavor with id '%d',"
" see 'allow_create' flavor attribute")
raise faults.Forbidden(msg % flavor.id)
servers.resize(vm, flavor=flavor)
log.info("User %s resized VM %s to flavor %s",
......
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