Revision 3524241a snf-cyclades-app/synnefo/logic/management/commands/reconcile.py
b/snf-cyclades-app/synnefo/logic/management/commands/reconcile.py | ||
---|---|---|
42 | 42 |
|
43 | 43 |
from django.core.management.base import BaseCommand, CommandError |
44 | 44 |
|
45 |
from synnefo.db.models import VirtualMachine, Network |
|
45 |
from synnefo.db.models import VirtualMachine, Network, pooled_rapi_client
|
|
46 | 46 |
from synnefo.logic import reconciliation, backend, utils |
47 | 47 |
|
48 | 48 |
|
... | ... | |
202 | 202 |
for id in orphans: |
203 | 203 |
try: |
204 | 204 |
vm = VirtualMachine.objects.get(pk=id) |
205 |
vm.client.DeleteInstance(utils.id_to_instance_name(id)) |
|
205 |
with pooled_rapi_client(vm) as client: |
|
206 |
client.DeleteInstance(utils.id_to_instance_name(id)) |
|
206 | 207 |
except VirtualMachine.DoesNotExist: |
207 | 208 |
print >> sys.stderr, "No entry for VM %d in DB !!" % id |
208 | 209 |
print >> sys.stderr, " ...done" |
Also available in: Unified diff