Commit fb0e0879 authored by Helga Velroyen's avatar Helga Velroyen

Remove superflous loop in instance queries

This patch fixes a piece of convoluted code in the
implementation of instance queries. There was an
unecessarily nested loop, which in case of ongoing
migrations, could throw a key error. This fixes
issue 875.
Signed-off-by: default avatarHelga Velroyen <helgav@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent fb565c43
......@@ -137,8 +137,8 @@ class InstanceQuery(QueryBase):
if inst_name in insts_by_name:
instance = insts_by_name[inst_name]
if instance.primary_node == node_uuid:
for iname in result.payload:
live_data[insts_by_name[iname].uuid] = result.payload[iname]
live_data[insts_by_name[inst_name].uuid] = \
result.payload[inst_name]
else:
wrongnode_inst_uuids.add(instance.uuid)
else:
......
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