summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorDan Prince <dprince@redhat.com>2012-03-12 23:52:40 -0400
committerDan Prince <dprince@redhat.com>2012-03-12 23:52:40 -0400
commitda23487487d442cffeb252236428abbda3f45746 (patch)
tree713797f8feb69a4fbe55e05588b7523d710d3509 /bin
parentfd80f1b2e1dc03b77fa51cfa27dedce1c593201d (diff)
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
Diffstat (limited to 'bin')
-rwxr-xr-xbin/nova-manage10
1 files changed, 7 insertions, 3 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index cf296b537..57bb31ae4 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'],