Merge lp:~rackspace-titan/nova/fix_ec2_metadata_instance_type into lp:~hudson-openstack/nova/trunk

Proposed by Dan Prince
Status: Merged
Approved by: Brian Lamar
Approved revision: 1411
Merged at revision: 1443
Proposed branch: lp:~rackspace-titan/nova/fix_ec2_metadata_instance_type
Merge into: lp:~hudson-openstack/nova/trunk
Diff against target: 67 lines (+17/-6)
3 files modified
nova/api/ec2/cloud.py (+1/-1)
nova/tests/test_metadata.py (+1/-1)
smoketests/test_netadmin.py (+15/-4)
To merge this branch: bzr merge lp:~rackspace-titan/nova/fix_ec2_metadata_instance_type
Reviewer Review Type Date Requested Status
Brian Lamar (community) Approve
Jesse Andrews (community) Approve
William Wolf (community) Approve
Devin Carlen (community) Approve
Review via email: mp+70952@code.launchpad.net

Description of the change

Updated the EC2 metadata controller so that it returns the correct value for instance-type metadata.

To post a comment you must log in.
Revision history for this message
Devin Carlen (devcamcar) wrote :

lgtm

review: Approve
Revision history for this message
William Wolf (throughnothing) wrote :

lgtm

review: Approve
Revision history for this message
Jesse Andrews (anotherjesse) wrote :

lgtm

review: Approve
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :
Download full text (100.1 KiB)

The attempt to merge lp:~rackspace-titan/nova/fix_ec2_metadata_instance_type into lp:nova failed. Below is the output from the failed tests.

FloatingIpTest
    test_floating_ip_allocate OK 0.17
    test_floating_ip_associate OK 0.09
    test_floating_ip_disassociate OK 0.09
    test_floating_ip_release OK 0.09
    test_floating_ip_show OK 0.09
    test_floating_ips_list OK 0.22
    test_translate_floating_ip_view OK 0.04
    test_translate_floating_ip_view_dict OK 0.02
KeypairsTest
    test_keypair_create OK 0.24
    test_keypair_delete OK 0.09
    test_keypair_import OK 0.13
    test_keypair_list OK 0.08
FixedIpTest
    test_add_fixed_ip OK 0.08
    test_add_fixed_ip_no_network OK 0.08
    test_remove_fixed_ip OK 0.07
    test_remove_fixed_ip_no_address OK 0.27
TestSecurityGroupRules
    test_create_add_existing_rules_json OK 0.34
    test_create_by_cidr_json OK 0.34
    test_create_by_group_id_json OK 0.52
    test_create_rule_with_same_group_parent_id_json OK 0.32
    test_create_with_empty_group_id_json OK 0.48
    test_create_with_invalid_cidr_json OK 0.32
    test_create_with_invalid_from_port_json OK 0.48
    test_create_with_invalid_group_id_json OK 0.34
    test_create_with_invalid_parent_group_id_json OK 0.32
    test_create_with_invalid_protocol_json OK 0.48
    test_create_with_invalid_to_port_json OK 0.33
    test_create_with_no_body_json OK 0.45
    test_create_with_no_cidr_group_json OK 0.34
    test_create_with_no_protocol_json OK 0.47
    test_create_with_no_security_group_rule_in_body_json OK 0.29
    test_create_with_no_to_port_json OK 0.50
    test_create_with_non_existing_parent_group_id_json OK 0.33
    test_create_with_non_numerical_from_port_json OK 0.33
    test_create_with_non_numerical_to_port_json OK 0.49
    test_delete OK 0.46
    test_delete_invalid_rule_id OK 0.48
    test_delete_non_existing_rule_id OK 0.35
TestSecurityGroupRulesXMLDeserializer
    test_create_no_protocol_request OK 0.00
    test_create_request OK 0.00
TestSecurityGroupXMLDeserializer
    ...

Revision history for this message
Dan Prince (dan-prince) wrote :

Fixed the test_metadata tests. Should be good to go again.

Revision history for this message
Brian Lamar (blamar) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'nova/api/ec2/cloud.py'
--- nova/api/ec2/cloud.py 2011-07-07 12:56:15 +0000
+++ nova/api/ec2/cloud.py 2011-08-16 14:50:32 +0000
@@ -305,7 +305,7 @@
305 'hostname': hostname,305 'hostname': hostname,
306 'instance-action': 'none',306 'instance-action': 'none',
307 'instance-id': ec2_id,307 'instance-id': ec2_id,
308 'instance-type': instance_ref['instance_type'],308 'instance-type': instance_ref['instance_type']['name'],
309 'local-hostname': hostname,309 'local-hostname': hostname,
310 'local-ipv4': address,310 'local-ipv4': address,
311 'placement': {'availability-zone': availability_zone},311 'placement': {'availability-zone': availability_zone},
312312
=== modified file 'nova/tests/test_metadata.py'
--- nova/tests/test_metadata.py 2011-07-07 12:56:15 +0000
+++ nova/tests/test_metadata.py 2011-08-16 14:50:32 +0000
@@ -39,7 +39,7 @@
39 'key_name': None,39 'key_name': None,
40 'host': 'test',40 'host': 'test',
41 'launch_index': 1,41 'launch_index': 1,
42 'instance_type': 'm1.tiny',42 'instance_type': {'name': 'm1.tiny'},
43 'reservation_id': 'r-xxxxxxxx',43 'reservation_id': 'r-xxxxxxxx',
44 'user_data': '',44 'user_data': '',
45 'image_ref': 7,45 'image_ref': 7,
4646
=== modified file 'smoketests/test_netadmin.py'
--- smoketests/test_netadmin.py 2011-08-07 02:59:09 +0000
+++ smoketests/test_netadmin.py 2011-08-16 14:50:32 +0000
@@ -107,14 +107,18 @@
107107
108class SecurityGroupTests(base.UserSmokeTestCase):108class SecurityGroupTests(base.UserSmokeTestCase):
109109
110 def __public_instance_is_accessible(self):110 def __get_metadata_item(self, category):
111 id_url = "latest/meta-data/instance-id"111 id_url = "latest/meta-data/%s" % category
112 options = "-f -s --max-time 1"112 options = "-f -s --max-time 1"
113 command = "curl %s %s/%s" % (options, self.data['public_ip'], id_url)113 command = "curl %s %s/%s" % (options, self.data['public_ip'], id_url)
114 status, output = commands.getstatusoutput(command)114 status, output = commands.getstatusoutput(command)
115 instance_id = output.strip()115 value = output.strip()
116 if status > 0:116 if status > 0:
117 return False117 return False
118 return value
119
120 def __public_instance_is_accessible(self):
121 instance_id = self.__get_metadata_item('instance-id')
118 if not instance_id:122 if not instance_id:
119 return False123 return False
120 if instance_id != self.data['instance'].id:124 if instance_id != self.data['instance'].id:
@@ -166,7 +170,14 @@
166 finally:170 finally:
167 result = self.conn.disassociate_address(self.data['public_ip'])171 result = self.conn.disassociate_address(self.data['public_ip'])
168172
169 def test_005_can_revoke_security_group_ingress(self):173 def test_005_validate_metadata(self):
174
175 instance = self.data['instance']
176 self.assertTrue(instance.instance_type,
177 self.__get_metadata_item("instance-type"))
178 #FIXME(dprince): validate more metadata here
179
180 def test_006_can_revoke_security_group_ingress(self):
170 self.assertTrue(self.conn.revoke_security_group(TEST_GROUP,181 self.assertTrue(self.conn.revoke_security_group(TEST_GROUP,
171 ip_protocol='tcp',182 ip_protocol='tcp',
172 from_port=80,183 from_port=80,