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

pep8 convension

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