summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Prince <dan.prince@rackspace.com>2012-01-23 14:51:24 -0500
committerDan Prince <dan.prince@rackspace.com>2012-01-23 14:54:39 -0500
commit151632ed3a8dfd8da1812e738aca16187dec1175 (patch)
tree4fc54f1cf7a5f7375f80e466be32f7954d3b6cbd
parent152da40a0651bfbdeb748c249e771c10e716c79c (diff)
downloadnova-151632ed3a8dfd8da1812e738aca16187dec1175.tar.gz
nova-151632ed3a8dfd8da1812e738aca16187dec1175.tar.xz
nova-151632ed3a8dfd8da1812e738aca16187dec1175.zip
Fixes nova-manage fixed list.
Updates the nova-manage to use db.instance_get_all for instance information instead of relying on Sqlalchemy model relationships (which no longer exist due to network refactorings). This commit fixes 'nova-manage fixed list' so that it correctly displays hostname, and host. I dropped the MAC address column which would have required an extra VIF's table lookup and wasn't used as much. Fixes LP Bug #920159. Change-Id: I3cec690c5e40631e0f10b2a914f46863601a1734
-rwxr-xr-xbin/nova-manage21
1 files changed, 12 insertions, 9 deletions
diff --git a/bin/nova-manage b/bin/nova-manage
index 9951785ee..30b62b2d8 100755
--- a/bin/nova-manage
+++ b/bin/nova-manage
@@ -637,24 +637,27 @@ class FixedIpCommands(object):
print "error: %s" % ex
sys.exit(2)
- print "%-18s\t%-15s\t%-17s\t%-15s\t%s" % (_('network'),
- _('IP address'),
- _('MAC address'),
- _('hostname'),
- _('host'))
+ instances = db.instance_get_all(context.get_admin_context())
+ instances_by_id = {}
+ for instance in instances:
+ instances_by_id[instance['id']] = instance
+
+ print "%-18s\t%-15s\t%-15s\t%s" % (_('network'),
+ _('IP address'),
+ _('hostname'),
+ _('host'))
for fixed_ip in fixed_ips:
hostname = None
host = None
mac_address = None
if fixed_ip['instance']:
- instance = fixed_ip['instance']
+ instance = instances_by_id[fixed_ip['instance_id']]
hostname = instance['hostname']
host = instance['host']
- mac_address = fixed_ip['virtual_interface']['address']
- print "%-18s\t%-15s\t%-17s\t%-15s\t%s" % (
+ print "%-18s\t%-15s\t%-15s\t%s" % (
fixed_ip['network']['cidr'],
fixed_ip['address'],
- mac_address, hostname, host)
+ hostname, host)
@args('--address', dest="address", metavar='<ip address>',
help='IP address')