From 151632ed3a8dfd8da1812e738aca16187dec1175 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Mon, 23 Jan 2012 14:51:24 -0500 Subject: 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 --- bin/nova-manage | 21 ++++++++++++--------- 1 file 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='', help='IP address') -- cgit