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

Include deleted networks in get_flavor_info

parent e2bdaaa6
......@@ -95,7 +95,7 @@ def get_flavor_details(request, flavor_id):
# overLimit (413)
log.debug('get_flavor_details %s', flavor_id)
flavor = util.get_flavor(flavor_id)
flavor = util.get_flavor(flavor_id, include_deleted=True)
flavordict = flavor_to_dict(flavor, detail=True)
if request.serialization == 'xml':
......
......@@ -242,7 +242,8 @@ def create_server(request):
image['metadata'] = dict((key.upper(), val) \
for key, val in properties.items())
flavor = util.get_flavor(flavor_id)
# Ensure that request if for active flavor
flavor = util.get_flavor(flavor_id, include_deleted=False)
password = util.random_password()
count = VirtualMachine.objects.filter(userid=request.user_uniq,
......
......@@ -191,13 +191,15 @@ def get_image(image_id, user_id):
backend.close()
def get_flavor(flavor_id):
def get_flavor(flavor_id, include_deleted=False):
"""Return a Flavor instance or raise ItemNotFound."""
try:
flavor_id = int(flavor_id)
# Ensure that request if for active flavor
return Flavor.objects.get(id=flavor_id, deleted=False)
if include_deleted:
return Flavor.objects.get(id=flavor_id)
else:
return Flavor.objects.get(id=flavor_id, deleted=include_deleted)
except (ValueError, Flavor.DoesNotExist):
raise ItemNotFound('Flavor not found.')
......
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