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

Remove transaction from 'backend-add' command

Do not run 'backend-add' command inside transaction, because if
'snf-dispatcher' is running, it will receive messages that will arrive
from a Ganeti backend that does not exist in the DB and will not be able
to process them.
parent 141f8f9b
......@@ -31,7 +31,6 @@
from optparse import make_option
from django.core.management.base import BaseCommand, CommandError
from django.db import transaction
from synnefo.db.models import Backend, Network
from django.db.utils import IntegrityError
from synnefo.logic.backend import (get_physical_resources,
......@@ -46,8 +45,6 @@ class Command(BaseCommand):
can_import_settings = True
help = 'Create a new backend.'
output_transaction = True # The management command runs inside
# an SQL transaction
option_list = BaseCommand.option_list + (
make_option('--clustername', dest='clustername'),
make_option('--port', dest='port', default=5080),
......@@ -63,8 +60,10 @@ class Command(BaseCommand):
help="Do not perform initialization of the Backend Model")
)
@transaction.commit_on_success
def handle(self, **options):
def handle(self, *args, **options):
if len(args) > 0:
raise CommandError("Command takes no arguments")
clustername = options['clustername']
port = options['port']
username = options['username']
......
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