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
1=== modified file 'nova/api/ec2/cloud.py'
2--- nova/api/ec2/cloud.py 2011-07-07 12:56:15 +0000
3+++ nova/api/ec2/cloud.py 2011-08-16 14:50:32 +0000
4@@ -305,7 +305,7 @@
5 'hostname': hostname,
6 'instance-action': 'none',
7 'instance-id': ec2_id,
8- 'instance-type': instance_ref['instance_type'],
9+ 'instance-type': instance_ref['instance_type']['name'],
10 'local-hostname': hostname,
11 'local-ipv4': address,
12 'placement': {'availability-zone': availability_zone},
13
14=== modified file 'nova/tests/test_metadata.py'
15--- nova/tests/test_metadata.py 2011-07-07 12:56:15 +0000
16+++ nova/tests/test_metadata.py 2011-08-16 14:50:32 +0000
17@@ -39,7 +39,7 @@
18 'key_name': None,
19 'host': 'test',
20 'launch_index': 1,
21- 'instance_type': 'm1.tiny',
22+ 'instance_type': {'name': 'm1.tiny'},
23 'reservation_id': 'r-xxxxxxxx',
24 'user_data': '',
25 'image_ref': 7,
26
27=== modified file 'smoketests/test_netadmin.py'
28--- smoketests/test_netadmin.py 2011-08-07 02:59:09 +0000
29+++ smoketests/test_netadmin.py 2011-08-16 14:50:32 +0000
30@@ -107,14 +107,18 @@
31
32 class SecurityGroupTests(base.UserSmokeTestCase):
33
34- def __public_instance_is_accessible(self):
35- id_url = "latest/meta-data/instance-id"
36+ def __get_metadata_item(self, category):
37+ id_url = "latest/meta-data/%s" % category
38 options = "-f -s --max-time 1"
39 command = "curl %s %s/%s" % (options, self.data['public_ip'], id_url)
40 status, output = commands.getstatusoutput(command)
41- instance_id = output.strip()
42+ value = output.strip()
43 if status > 0:
44 return False
45+ return value
46+
47+ def __public_instance_is_accessible(self):
48+ instance_id = self.__get_metadata_item('instance-id')
49 if not instance_id:
50 return False
51 if instance_id != self.data['instance'].id:
52@@ -166,7 +170,14 @@
53 finally:
54 result = self.conn.disassociate_address(self.data['public_ip'])
55
56- def test_005_can_revoke_security_group_ingress(self):
57+ def test_005_validate_metadata(self):
58+
59+ instance = self.data['instance']
60+ self.assertTrue(instance.instance_type,
61+ self.__get_metadata_item("instance-type"))
62+ #FIXME(dprince): validate more metadata here
63+
64+ def test_006_can_revoke_security_group_ingress(self):
65 self.assertTrue(self.conn.revoke_security_group(TEST_GROUP,
66 ip_protocol='tcp',
67 from_port=80,