Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Dan Prince committed Jan 23, 2012
1 parent 152da40 commit 151632e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions bin/nova-manage
Expand Up @@ -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')
Expand Down

0 comments on commit 151632e

Please sign in to comment.