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,
I like this:
=== modified file 'nova/api/ ec2/cloud. py' ec2/cloud. py 2011-02-21 22:47:33 +0000 ec2/cloud. py 2011-02-23 06:02:39 +0000
--- nova/api/
+++ nova/api/
@@ -783,9 +783,6 @@
def run_instances(self, context, **kwargs): get('max_ count', 1)) api.create( context,
instance_ type=instance_ types.get_ by_type(
kwargs. get('instance_ type', None)),
user_ data=kwargs. get('user_ data'),
security_ group=kwargs. get('security_ group') ,
availabil ity_zone= kwargs. get('placement' , {}).get( ne'), kwargs. get('metadata' , [])) ne')) run_instances( context,
instances[ 0]['reservation _id'])
max_count = int(kwargs.
- # 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_
@@ -800,8 +797,7 @@
- 'AvailabilityZo
- metadata=
+ 'AvailabilityZo
return self._format_
=== modified file 'nova/tests/ test_quota. py' test_quota. py 2011-02-17 23:00:18 +0000 test_quota. py 2011-02-23 06:18:24 +0000
--- nova/tests/
+++ nova/tests/
@@ -16,6 +16,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+from nova import compute quota_metadata_ items + 1):
metadata[ 'key%s' % i] = 'value%s' % i es(quota. QuotaError, self.cloud. run_instances, es(quota. QuotaError, compute. API().create,
self. context,
min_ count=1,
max_ count=1,
from nova import context
from nova import db
from nova import flags
@@ -168,7 +169,7 @@
metadata = {}
for i in range(FLAGS.
- self.assertRais
+ self.assertRais