From da23487487d442cffeb252236428abbda3f45746 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 12 Mar 2012 23:52:40 -0400 Subject: [PATCH] fixed list warn when ip allocated to missing inst. Update 'nova-manage fixed list' so it prints a warning if an IP is allocated to a deleted/missing instance. Fixes LP Bug #953685. Change-Id: I72b7ad2cb01e31cf9bb6cab904ab10d8769a3526 --- bin/nova-manage | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bin/nova-manage b/bin/nova-manage index cf296b5370c4..57bb31ae4744 100755 --- a/bin/nova-manage +++ b/bin/nova-manage @@ -584,9 +584,13 @@ class FixedIpCommands(object): network = db.network_get(context.get_admin_context(), fixed_ip['network_id']) if fixed_ip['instance_id']: - instance = instances_by_id[fixed_ip['instance_id']] - hostname = instance['hostname'] - host = instance['host'] + instance = instances_by_id.get(fixed_ip['instance_id']) + if instance: + hostname = instance['hostname'] + host = instance['host'] + else: + print 'WARNING: fixed ip %s allocated to missing' \ + ' instance' % str(fixed_ip['address']) print "%-18s\t%-15s\t%-15s\t%s" % ( network['cidr'], fixed_ip['address'],