diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-02-07 23:09:10 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-02-07 23:09:10 +0000 |
| commit | 408c6b1dfd8fd76db50b89226ed006f75b0b0c5e (patch) | |
| tree | f1c177a2feabd215b71e075fee3eb741440c9e93 /nova | |
| parent | 4c8fc34d736d6575da86d5c32d0d9c2f25e16c8b (diff) | |
| parent | daddc54befea4414776368b0ae8f689872b21e27 (diff) | |
| download | nova-408c6b1dfd8fd76db50b89226ed006f75b0b0c5e.tar.gz nova-408c6b1dfd8fd76db50b89226ed006f75b0b0c5e.tar.xz nova-408c6b1dfd8fd76db50b89226ed006f75b0b0c5e.zip | |
Merge "Access DB as dict not as attributes part 5"
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/network/manager.py | 6 | ||||
| -rw-r--r-- | nova/tests/api/ec2/test_cloud.py | 10 | ||||
| -rw-r--r-- | nova/tests/test_db_api.py | 14 | ||||
| -rw-r--r-- | nova/tests/test_libvirt.py | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/nova/network/manager.py b/nova/network/manager.py index 60aa01494..a0bd3c807 100644 --- a/nova/network/manager.py +++ b/nova/network/manager.py @@ -1155,10 +1155,10 @@ class NetworkManager(manager.SchedulerDependentManager): elif fixed_range: network = self.db.network_get_by_cidr(elevated, fixed_range) - if require_disassociated and network.project_id is not None: + if require_disassociated and network['project_id'] is not None: raise ValueError(_('Network must be disassociated from project %s' - ' before delete') % network.project_id) - self.db.network_delete_safe(context, network.id) + ' before delete') % network['project_id']) + self.db.network_delete_safe(context, network['id']) @property def _bottom_reserved_ips(self): # pylint: disable=R0201 diff --git a/nova/tests/api/ec2/test_cloud.py b/nova/tests/api/ec2/test_cloud.py index ec0bd3743..f8219e7a0 100644 --- a/nova/tests/api/ec2/test_cloud.py +++ b/nova/tests/api/ec2/test_cloud.py @@ -713,10 +713,10 @@ class CloudTestCase(test.TestCase): # Aggregate based zones agg = db.aggregate_create(self.context, {'name': 'agg1'}, {'availability_zone': 'zone1'}) - db.aggregate_host_add(self.context, agg.id, 'host1_zones') + db.aggregate_host_add(self.context, agg['id'], 'host1_zones') agg = db.aggregate_create(self.context, {'name': 'agg2'}, {'availability_zone': 'zone2'}) - db.aggregate_host_add(self.context, agg.id, 'host2_zones') + db.aggregate_host_add(self.context, agg['id'], 'host2_zones') result = self.cloud.describe_availability_zones(self.context) self.assertEqual(len(result['availabilityZoneInfo']), 3) admin_ctxt = context.get_admin_context(read_deleted="no") @@ -738,7 +738,7 @@ class CloudTestCase(test.TestCase): 'report_count': 0}) agg = db.aggregate_create(self.context, {'name': 'agg1'}, {'availability_zone': 'second_zone'}) - db.aggregate_host_add(self.context, agg.id, 'host2_zones') + db.aggregate_host_add(self.context, agg['id'], 'host2_zones') admin_ctxt = context.get_admin_context(read_deleted="no") result = self.cloud.describe_availability_zones(admin_ctxt, @@ -772,13 +772,13 @@ class CloudTestCase(test.TestCase): 'topic': "compute"}) agg = db.aggregate_create(self.context, {'name': 'agg1'}, {'availability_zone': 'zone1'}) - db.aggregate_host_add(self.context, agg.id, 'host1') + db.aggregate_host_add(self.context, agg['id'], 'host1') comp2 = db.service_create(self.context, {'host': 'host2', 'topic': "compute"}) agg2 = db.aggregate_create(self.context, {'name': 'agg2'}, {'availability_zone': 'zone2'}) - db.aggregate_host_add(self.context, agg2.id, 'host2') + db.aggregate_host_add(self.context, agg2['id'], 'host2') result = self.cloud.describe_instances(self.context) result = result['reservationSet'][0] diff --git a/nova/tests/test_db_api.py b/nova/tests/test_db_api.py index 5581e81ac..c6bf2941e 100644 --- a/nova/tests/test_db_api.py +++ b/nova/tests/test_db_api.py @@ -1238,7 +1238,7 @@ class AggregateDBApiTestCase(test.TestCase): ctxt = context.get_admin_context() result = _create_aggregate(context=ctxt, metadata={'availability_zone': 'fake_avail_zone'}) - self.assertEqual(result.availability_zone, 'fake_avail_zone') + self.assertEqual(result['availability_zone'], 'fake_avail_zone') new_values = _get_fake_aggr_values() new_values['availability_zone'] = 'different_avail_zone' updated = db.aggregate_update(ctxt, 1, new_values) @@ -1256,8 +1256,8 @@ class AggregateDBApiTestCase(test.TestCase): updated = db.aggregate_get(ctxt, result['id']) self.assertThat(values['metadata'], matchers.DictMatches(expected)) - self.assertNotEqual(result.availability_zone, - updated.availability_zone) + self.assertNotEqual(result['availability_zone'], + updated['availability_zone']) def test_aggregate_update_with_existing_metadata(self): ctxt = context.get_admin_context() @@ -1335,10 +1335,10 @@ class AggregateDBApiTestCase(test.TestCase): ctxt = context.get_admin_context() result = _create_aggregate(context=ctxt, metadata={'availability_zone': 'fake_avail_zone'}) - db.aggregate_metadata_delete(ctxt, result.id, 'availability_zone') - expected = db.aggregate_metadata_get(ctxt, result.id) - aggregate = db.aggregate_get(ctxt, result.id) - self.assertEquals(aggregate.availability_zone, None) + db.aggregate_metadata_delete(ctxt, result['id'], 'availability_zone') + expected = db.aggregate_metadata_get(ctxt, result['id']) + aggregate = db.aggregate_get(ctxt, result['id']) + self.assertEquals(aggregate['availability_zone'], None) self.assertThat({}, matchers.DictMatches(expected)) def test_aggregate_metadata_delete_raise_not_found(self): diff --git a/nova/tests/test_libvirt.py b/nova/tests/test_libvirt.py index 52e308b85..cef9252c5 100644 --- a/nova/tests/test_libvirt.py +++ b/nova/tests/test_libvirt.py @@ -2330,7 +2330,7 @@ class LibvirtConnTestCase(test.TestCase): migrate_data) self.assertEqual(ret, None) self.assertTrue(os.path.exists('%s/%s/' % - (tmpdir, inst_ref.name))) + (tmpdir, inst_ref['name']))) db.instance_destroy(self.context, inst_ref['uuid']) def test_pre_block_migration_works_correctly(self): |
