diff options
| author | Cerberus <matt.dietz@rackspace.com> | 2010-09-29 17:36:26 -0500 |
|---|---|---|
| committer | Cerberus <matt.dietz@rackspace.com> | 2010-09-29 17:36:26 -0500 |
| commit | 33f101c309852f358ab30a8af64ef64a848f16ae (patch) | |
| tree | 5f134be9dc013cd91ff6b861d488d9687273664d /nova/api | |
| parent | 0030da605c30bbf3b1424aae86bbdc07ff7c50c2 (diff) | |
Some minor cleanup
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/rackspace/servers.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/nova/api/rackspace/servers.py b/nova/api/rackspace/servers.py index c3d56debd..0d285999b 100644 --- a/nova/api/rackspace/servers.py +++ b/nova/api/rackspace/servers.py @@ -213,14 +213,11 @@ class Controller(wsgi.Controller): user_id = req.environ['nova.context']['user']['id'] - instance_type, flavor = None, None - for k, v in instance_types.INSTANCE_TYPES.iteritems(): - if v['flavorid'] == env['server']['flavorId']: - instance_type, flavor = k, v - break + flavor_id = env['server']['flavorId'] - if not flavor: - raise Exception, "Flavor not found" + instance_type, flavor = [(k, v) for k, v in + instance_types.INSTANCE_TYPES.iteritems() + if v['flavorid'] == flavor_id][0] image_id = env['server']['imageId'] @@ -262,10 +259,10 @@ class Controller(wsgi.Controller): ref = self.db_driver.instance_create(None, inst) inst['id'] = inst_id_trans.to_rs_id(ref.ec2_id) - # TODO(dietz): this isn't explicitly necessary, but the networking - # calls depend on an object with a project_id property + # calls depend on an object with a project_id property, and therefore + # should be cleaned up later api_context = context.APIRequestContext(user_id) inst['mac_address'] = utils.generate_mac() |
