Code review comment for lp:~justin-fathomdb/nova/justinsb-metadata3

Revision history for this message
Todd Willey (xtoddx) wrote :

I like this:

=== modified file 'nova/api/ec2/cloud.py'
--- nova/api/ec2/cloud.py 2011-02-21 22:47:33 +0000
+++ nova/api/ec2/cloud.py 2011-02-23 06:02:39 +0000
@@ -783,9 +783,6 @@

     def run_instances(self, context, **kwargs):
         max_count = int(kwargs.get('max_count', 1))
- # NOTE(justinsb): the EC2 API doesn't support metadata here, but this
- # is needed for the unit tests. Maybe the unit tests shouldn't be
- # calling the EC2 code
         instances = self.compute_api.create(context,
             instance_type=instance_types.get_by_type(
                 kwargs.get('instance_type', None)),
@@ -800,8 +797,7 @@
             user_data=kwargs.get('user_data'),
             security_group=kwargs.get('security_group'),
             availability_zone=kwargs.get('placement', {}).get(
- 'AvailabilityZone'),
- metadata=kwargs.get('metadata', []))
+ 'AvailabilityZone'))
         return self._format_run_instances(context,
                                           instances[0]['reservation_id'])

=== modified file 'nova/tests/test_quota.py'
--- nova/tests/test_quota.py 2011-02-17 23:00:18 +0000
+++ nova/tests/test_quota.py 2011-02-23 06:18:24 +0000
@@ -16,6 +16,7 @@
 # License for the specific language governing permissions and limitations
 # under the License.

+from nova import compute
 from nova import context
 from nova import db
 from nova import flags
@@ -168,7 +169,7 @@
         metadata = {}
         for i in range(FLAGS.quota_metadata_items + 1):
             metadata['key%s' % i] = 'value%s' % i
- self.assertRaises(quota.QuotaError, self.cloud.run_instances,
+ self.assertRaises(quota.QuotaError, compute.API().create,
                                             self.context,
                                             min_count=1,
                                             max_count=1,

review: Needs Fixing

« Back to merge proposal