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

cyclades: add commissioning to create/remove cmds

Update create/remove management commands to issue commission when
needed.
parent a4f94279
......@@ -37,6 +37,7 @@ from django.core.management.base import BaseCommand, CommandError
from synnefo.management.common import validate_network_info, get_backend
from synnefo.webproject.management.utils import pprint_table
from synnefo import quotas
from synnefo.db.models import Network
from synnefo.logic.backend import create_network
from synnefo.api.util import values_from_flavor
......@@ -200,6 +201,8 @@ class Command(BaseCommand):
return
network = Network.objects.create(**netinfo)
if userid:
quotas.issue_and_accept_commission(network)
if public:
# Create BackendNetwork only to the specified Backend
......
......@@ -31,6 +31,7 @@
from django.core.management.base import BaseCommand, CommandError
from synnefo.logic.backend import delete_network
from synnefo.management.common import get_network
from synnefo import quotas
class Command(BaseCommand):
......@@ -54,6 +55,7 @@ class Command(BaseCommand):
network.action = 'DESTROY'
network.save()
quotas.issue_and_accept_commission(network, delete=True)
delete_network(network)
self.stdout.write('Successfully removed network.\n')
......@@ -43,6 +43,7 @@ from synnefo.logic.backend import create_instance
from synnefo.logic.backend_allocator import BackendAllocator
from synnefo.api import util
from synnefo.api.servers import server_created
from synnefo import quotas
HELP_MSG = """
......@@ -156,6 +157,8 @@ class Command(BaseCommand):
'img_personality': '[]',
'img_properties': json.dumps(image['metadata']),
})
quotas.issue_and_accept_commission(vm)
except:
transaction.rollback()
raise
......
......@@ -41,6 +41,7 @@ from synnefo.logic.utils import id_from_network_name, id_from_instance_name
from synnefo.logic.backend import wait_for_job
from synnefo.logic.rapi import GanetiApiError
from synnefo.api.util import allocate_public_address
from synnefo import quotas
import sys
......@@ -165,6 +166,7 @@ def import_server(instance_name, backend_id, flavor_id, image_id, user_id,
imageid=image_id,
flavor=flavor)
quotas.issue_and_accept_commission(vm)
# Rename instance
rename_instance(instance_name, vm.backend_vm_id, backend_client,
stream)
......
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