Address feedback on cell-aggregate-api-db patches

This fixes up just a few minor things pointed out in the
review of the prevous set of patches.

Change-Id: If19f36c3bdf1393e07a74c627d4b7054d16fbcbb
This commit is contained in:
Dan Smith 2016-08-01 11:46:59 -07:00
parent d55ffba391
commit 3b8bd654ff
3 changed files with 3 additions and 5 deletions

View File

@ -386,7 +386,6 @@ class Aggregate(base.NovaPersistentObject, base.NovaObject):
"updateprop.start",
payload)
updates.pop('id', None)
db_aggregate = None
try:
db_aggregate = _aggregate_update_to_db(self._context,
self.id, updates)

View File

@ -270,7 +270,7 @@ class AggregateObjectDbTestCase(test.NoDBTestCase):
metadata={'availability_zone': 'fake_avail_zone'})
result = aggregate_obj._aggregate_get_from_db(self.context,
created['id'])
self.assertEqual(result['availability_zone'], 'fake_avail_zone')
self.assertEqual('fake_avail_zone', result['availability_zone'])
new_values = deepcopy(_get_fake_aggregate(1, result=False))
new_values['availability_zone'] = 'different_avail_zone'
updated = aggregate_obj._aggregate_update_to_db(self.context,

View File

@ -167,7 +167,7 @@ class _TestAggregateObject(object):
@mock.patch('nova.objects.aggregate._aggregate_update_to_db')
@mock.patch('nova.db.aggregate_update')
def test_save(self, update_mock, api_update_mock):
def test_save_to_cell(self, update_mock, api_update_mock):
api_update_mock.side_effect = exception.AggregateNotFound(
aggregate_id='foo')
update_mock.return_value = fake_aggregate
@ -181,10 +181,9 @@ class _TestAggregateObject(object):
{'name': 'fake-aggregate'})
self.assertTrue(api_update_mock.called)
@mock.patch('nova.objects.Aggregate.in_api', return_value=True)
@mock.patch('nova.objects.aggregate._aggregate_update_to_db')
@mock.patch('nova.db.aggregate_update')
def test_save_to_api(self, update_mock, api_update_mock, in_api_mock):
def test_save_to_api(self, update_mock, api_update_mock):
api_update_mock.return_value = fake_aggregate
agg = aggregate.Aggregate(context=self.context)
agg.id = 123