Skip to content

Commit

Permalink
Option expose IP instead of dnshost in ec2 desc'
Browse files Browse the repository at this point in the history
As documented in bug 901594, previous nova releases, the IP address
was exposed as the DNS hostname, which worked well with euca-tools.
This is unfortunately not always ideal for private clouds.

Whilst it is expected to be able to euca-describe-instances --ipv4
in newer euca2ools releases, this behaviour is not always desired.

This patchset allows the nova admin to set a global flag of:
--ec2_private_dns_show_ip=True, to restore legacy nova behaviour.

This does not change the current default behaviour of nova.

Change-Id: I7c71ffe63929d90d45d9c724ab3409dcdee52b44
  • Loading branch information
Dave Walker (Daviey) authored and Dave Walker (Daviey) committed Feb 29, 2012
1 parent 99233ac commit 42a0d3a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .mailmap
Expand Up @@ -18,6 +18,7 @@
<corywright@gmail.com> <cory.wright@rackspace.com>
<dan@nicira.com> <danwent@dan-xs3-cs>
<dan@nicira.com> <danwent@gmail.com>
<Dave.Walker@canonical.com> <DaveWalker@ubuntu.com>
<derekh@redhat.com> <higginsd@gmail.com>
<devin.carlen@gmail.com> <devcamcar@illian.local>
<dprince@redhat.com> <dan.prince@rackspace.com>
Expand Down
2 changes: 1 addition & 1 deletion Authors
Expand Up @@ -40,7 +40,7 @@ Dan Prince <dprince@redhat.com>
Dan Wendlandt <dan@nicira.com>
Daniel P. Berrange <berrange@redhat.com>
Dave Lapsley <dlapsley@nicira.com>
Dave Walker <DaveWalker@ubuntu.com>
Dave Walker <Dave.Walker@canonical.com>
David Pravec <David.Pravec@danix.org>
David Subiros <david.perez5@hp.com>
Dean Troyer <dtroyer@gmail.com>
Expand Down
4 changes: 4 additions & 0 deletions nova/api/ec2/__init__.py
Expand Up @@ -56,6 +56,10 @@
cfg.StrOpt('keystone_ec2_url',
default='http://localhost:5000/v2.0/ec2tokens',
help='URL to get token from ec2 request.'),
cfg.BoolOpt('ec2_private_dns_show_ip',
default=False,
help='Return the IP address as private dns hostname in '
'describe instances'),
]

FLAGS = flags.FLAGS
Expand Down
5 changes: 4 additions & 1 deletion nova/api/ec2/cloud.py
Expand Up @@ -1148,7 +1148,10 @@ def _format_instances(self, context, instance_id=None, use_v6=False,
floating_ip = ip_info['floating_ips'][0]
if ip_info['fixed_ip6s']:
i['dnsNameV6'] = ip_info['fixed_ip6s'][0]
i['privateDnsName'] = instance['hostname']
if FLAGS.ec2_private_dns_show_ip:
i['privateDnsName'] = fixed_ip
else:
i['privateDnsName'] = instance['hostname']
i['privateIpAddress'] = fixed_ip
i['publicDnsName'] = floating_ip
i['ipAddress'] = floating_ip or fixed_ip
Expand Down

0 comments on commit 42a0d3a

Please sign in to comment.