Revision 207b70d5 logic/backend.py
b/logic/backend.py | ||
---|---|---|
5 | 5 |
# |
6 | 6 |
|
7 | 7 |
from django.conf import settings |
8 |
from django.db import transaction |
|
9 |
|
|
8 | 10 |
from synnefo.db.models import VirtualMachine, Network, NetworkLink |
9 | 11 |
from synnefo.logic import utils |
10 | 12 |
from synnefo.util.rapi import GanetiRapiClient |
... | ... | |
45 | 47 |
vm.save() |
46 | 48 |
|
47 | 49 |
|
50 |
@transaction.commit_on_success |
|
48 | 51 |
def process_net_status(vm, nics): |
49 | 52 |
"""Process a net status notification from the backend |
50 | 53 |
|
... | ... | |
154 | 157 |
return NetworkLink.objects.create(index=index, name=name, available=True) |
155 | 158 |
return None # All link slots are filled |
156 | 159 |
|
160 |
@transaction.commit_on_success |
|
157 | 161 |
def create_network(net): |
158 | 162 |
try: |
159 | 163 |
link = NetworkLink.objects.filter(available=True)[0] |
... | ... | |
166 | 170 |
link.save() |
167 | 171 |
return True |
168 | 172 |
|
173 |
@transaction.commit_on_success |
|
169 | 174 |
def delete_network(net): |
170 | 175 |
link = net.link |
171 | 176 |
link.available = True |
Also available in: Unified diff