Skip to content

Commit

Permalink
Bugfix agregated infrastructure state
Browse files Browse the repository at this point in the history
  • Loading branch information
micafer committed Dec 14, 2015
1 parent 32bc135 commit f082422
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions IM/InfrastructureManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,16 +798,19 @@ def GetInfrastructureState(inf_id, auth):

sel_inf = InfrastructureManager.get_infrastructure(inf_id, auth)

state = None
vm_states = {}
for vm in sel_inf.get_vm_list():
# First try to update the status of the VM
vm.update_status(auth)
vm_states[str(vm.im_id)] = vm.state

state = None
for vm in sel_inf.get_vm_list():
# First try to update the status of the VM
if vm.state == VirtualMachine.FAILED:
state = VirtualMachine.FAILED
break
if vm.state == VirtualMachine.UNKNOWN:
elif vm.state == VirtualMachine.UNKNOWN:
state = VirtualMachine.UNKNOWN
break
elif vm.state == VirtualMachine.PENDING:
Expand All @@ -825,7 +828,7 @@ def GetInfrastructureState(inf_id, auth):
if state is None:
state = VirtualMachine.CONFIGURED
elif vm.state == VirtualMachine.UNCONFIGURED:
if state is None:
if state is None or state == VirtualMachine.CONFIGURED:
state = VirtualMachine.UNCONFIGURED

if state is None:
Expand Down

0 comments on commit f082422

Please sign in to comment.