Commit 1f466955 authored by Christos Stavrakakis's avatar Christos Stavrakakis

pep8 convension

parent 51927bd7
......@@ -121,8 +121,9 @@ def unsynced_operstate(D, G):
idG = set(G.keys())
for i in idD & idG:
if (G[i] and D[i] != 'STARTED' or
not G[i] and D[i] not in ('BUILD', 'ERROR', 'STOPPED')):
vm_unsynced = (G[i] and D[i] != "STARTED") or\
(not G[i] and D[i] not in ('BUILD', 'ERROR', 'STOPPED'))
if vm_unsynced:
unsynced.add((i, D[i], G[i]))
if not G[i] and D[i] == 'BUILD':
vm = VirtualMachine.objects.get(id=i)
......@@ -281,9 +282,10 @@ def unsynced_nics(DBNics, GNics):
for index in nicsG.keys():
nicD = nicsD[index]
nicG = nicsG[index]
if (nicD['ipv4'] != nicG['ipv4'] or
nicD['mac'] != nicG['mac'] or
nicD['network'] != nicG['network']):
diff = (nicD['ipv4'] != nicG['ipv4'] or
nicD['mac'] != nicG['mac'] or
nicD['network'] != nicG['network'])
if diff:
unsynced[i] = (nicsD, nicsG)
......@@ -102,8 +102,10 @@ def get_rsapi_state(vm):
if vm.deleted:
return "DELETED"
# A machine is in REBOOT if an OP_INSTANCE_REBOOT request is in progress
if r == 'ACTIVE' and vm.backendopcode == 'OP_INSTANCE_REBOOT' and \
vm.backendjobstatus in ('queued', 'waiting', 'running'):
in_reboot = (r == 'ACTIVE') and\
(vm.backendopcode == "OP_INSTANCE_REBOOT") and\
(vm.backendjobstatus in ('queued', 'waiting', 'running'))
if in_reboot:
return "REBOOT"
return r
......@@ -36,6 +36,7 @@ from django.db.models import Sum, Count
from synnefo.db.models import VirtualMachine, Network
from synnefo.quotas import get_quota_holder, NoEntityError
def get_db_holdings(users=None):
"""Get holdings from Cyclades DB."""
holdings = {}
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