~ubuntu-branches/ubuntu/oneiric/nova/oneiric-updates

« back to all changes in this revision

Viewing changes to debian/patches/fqdn-in-local-hostname-of-ec2-metadata.patch

  • Committer: Package Import Robot
  • Author(s): Chuck Short, Adam Gandelman, Chuck Short, Scott Moser
  • Date: 2011-09-27 14:56:59 UTC
  • Revision ID: package-import@ubuntu.com-20110927145659-rz5u0ldy09hvwzlg
Tags: 2011.3-0ubuntu3
[Adam Gandelman]
* debian/nova-common.postinst: Create 'nova' group, add user to it
  (LP: #856530)
* debian/nova.conf, debian/nova-compute.upstart.in: Move reference of
  nova-compute.conf from nova.conf to nova-compute's argv. (LP: #839796)

[Chuck Short]
* debian/patches/backport-recreate-gateway-using-dhcp.patch:
  Makes sure to recreate gateway for moved ip. (LP: #859587)
* debian/control: Update Vcs info.

[ Scott Moser ]
* debian/patches/fqdn-in-local-hostname-of-ec2-metadata.patch
  Make the 'local-hostname' in the EC2 Metadata service contain
  the domainname also. (LP: #854614)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Origin: upstream, https://github.com/openstack/nova/commit/6415999523d26f1680265e5ca438020b7d6542c6
 
2
Bug: https://bugs.launchpad.net/nova/+bug/854614
 
3
From 6415999523d26f1680265e5ca438020b7d6542c6 Mon Sep 17 00:00:00 2001
 
4
From: Scott Moser <smoser@ubuntu.com>
 
5
Date: Fri, 23 Sep 2011 16:44:44 -0400
 
6
Subject: [PATCH] put fully qualified domain name in local-hostname
 
7
 
 
8
make metadata service return fully qualified domain name (fqdn) in
 
9
the local-hostname field. (bug 854614)
 
10
 
 
11
Also, move the dhcp_domain flag from being in nova.network.linux_net to be
 
12
in the more common nova.network.manager.  Since it is being used for
 
13
something more generic, it shouldnt be stuck in linux_net.
 
14
 
 
15
 
 
16
Change-Id: Ieab3cb1b7b0b78aff8df25bbc35b96924a8e7e60
 
17
---
 
18
 nova/api/ec2/cloud.py       |    3 ++-
 
19
 nova/network/linux_net.py   |    3 ---
 
20
 nova/network/manager.py     |    3 +++
 
21
 nova/tests/test_metadata.py |    8 ++++++++
 
22
 4 files changed, 13 insertions(+), 4 deletions(-)
 
23
 
 
24
--- a/nova/api/ec2/cloud.py
 
25
+++ b/nova/api/ec2/cloud.py
 
26
@@ -52,6 +52,7 @@ from nova.image import s3
 
27
 
 
28
 
 
29
 FLAGS = flags.FLAGS
 
30
+flags.DECLARE('dhcp_domain', 'nova.network.manager')
 
31
 flags.DECLARE('service_down_time', 'nova.scheduler.driver')
 
32
 
 
33
 LOG = logging.getLogger("nova.api.cloud")
 
34
@@ -326,7 +327,7 @@ class CloudController(object):
 
35
         instance_ref = db.instance_get(ctxt, instance_ref[0]['id'])
 
36
 
 
37
         mpi = self._get_mpi_data(ctxt, instance_ref['project_id'])
 
38
-        hostname = instance_ref['hostname']
 
39
+        hostname = "%s.%s" % (instance_ref['hostname'], FLAGS.dhcp_domain)
 
40
         host = instance_ref['host']
 
41
         availability_zone = self._get_availability_zone_by_host(ctxt, host)
 
42
         floating_ip = db.instance_get_floating_address(ctxt,
 
43
--- a/nova/network/linux_net.py
 
44
+++ b/nova/network/linux_net.py
 
45
@@ -42,9 +42,6 @@ FLAGS = flags.FLAGS
 
46
 flags.DEFINE_string('dhcpbridge_flagfile',
 
47
                     '/etc/nova/nova-dhcpbridge.conf',
 
48
                     'location of flagfile for dhcpbridge')
 
49
-flags.DEFINE_string('dhcp_domain',
 
50
-                    'novalocal',
 
51
-                    'domain to use for building the hostnames')
 
52
 flags.DEFINE_string('networks_path', '$state_path/networks',
 
53
                     'Location to keep network config files')
 
54
 flags.DEFINE_string('public_interface', 'eth0',
 
55
--- a/nova/network/manager.py
 
56
+++ b/nova/network/manager.py
 
57
@@ -112,6 +112,9 @@ flags.DEFINE_bool('fake_call', False,
 
58
                   'If True, skip using the queue and make local calls')
 
59
 flags.DEFINE_bool('force_dhcp_release', False,
 
60
                   'If True, send a dhcp release on instance termination')
 
61
+flags.DEFINE_string('dhcp_domain',
 
62
+                    'novalocal',
 
63
+                    'domain to use for building the hostnames')
 
64
 
 
65
 
 
66
 class AddressAlreadyAllocated(exception.Error):
 
67
--- a/nova/tests/test_metadata.py
 
68
+++ b/nova/tests/test_metadata.py
 
69
@@ -24,12 +24,16 @@ import httplib
 
70
 import webob
 
71
 
 
72
 from nova import exception
 
73
+from nova import flags
 
74
 from nova import test
 
75
 from nova import wsgi
 
76
 from nova.api.ec2 import metadatarequesthandler
 
77
 from nova.db.sqlalchemy import api
 
78
 
 
79
 
 
80
+FLAGS = flags.FLAGS
 
81
+flags.DECLARE('dhcp_domain', 'nova.network.manager')
 
82
+
 
83
 USER_DATA_STRING = ("This is an encoded string")
 
84
 ENCODE_USER_DATA_STRING = base64.b64encode(USER_DATA_STRING)
 
85
 
 
86
@@ -119,3 +123,7 @@ class MetadataTestCase(test.TestCase):
 
87
         response = request.get_response(self.app)
 
88
         self.assertEqual(response.status_int, 200)
 
89
         self.assertEqual(response.body, USER_DATA_STRING)
 
90
+
 
91
+    def test_local_hostname_fqdn(self):
 
92
+        self.assertEqual(self.request('/meta-data/local-hostname'),
 
93
+            "%s.%s" % (self.instance['hostname'], FLAGS.dhcp_domain))