conductor saves version in db
For rolling upgrades, we added a 'version' column to all the DB object tables. However, we forgot to save the version value for conductor objects. This patch addresses that. Change-Id: Ic366f771491774f9708c9a81ab76dc13757d852b Partial-Bug: #1526283
This commit is contained in:
parent
bb33d6ed49
commit
8a98228251
@ -110,9 +110,11 @@ class Conductor(base.IronicObject, object_base.VersionedObjectDictCompat):
|
||||
:returns: a :class:`Conductor` object.
|
||||
|
||||
"""
|
||||
db_cond = cls.dbapi.register_conductor({'hostname': hostname,
|
||||
'drivers': drivers},
|
||||
update_existing=update_existing)
|
||||
db_cond = cls.dbapi.register_conductor(
|
||||
{'hostname': hostname,
|
||||
'drivers': drivers,
|
||||
'version': cls.get_target_version()},
|
||||
update_existing=update_existing)
|
||||
return cls._from_db_object(context, cls(), db_cond)
|
||||
|
||||
# NOTE(xek): We don't want to enable RPC on this call just yet. Remotable
|
||||
|
@ -20,6 +20,7 @@ import mock
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from ironic import objects
|
||||
from ironic.objects import base
|
||||
from ironic.objects import fields
|
||||
from ironic.tests.unit.db import base as db_base
|
||||
from ironic.tests.unit.db import utils as db_utils
|
||||
@ -86,7 +87,9 @@ class TestConductorObject(db_base.DbTestCase):
|
||||
self.assertEqual(expected, mock_get_cdr.call_args_list)
|
||||
self.assertEqual(self.context, c._context)
|
||||
|
||||
def _test_register(self, update_existing=False):
|
||||
@mock.patch.object(base.IronicObject, 'get_target_version')
|
||||
def _test_register(self, mock_target_version, update_existing=False):
|
||||
mock_target_version.return_value = '1.5'
|
||||
host = self.fake_conductor['hostname']
|
||||
drivers = self.fake_conductor['drivers']
|
||||
with mock.patch.object(self.dbapi, 'register_conductor',
|
||||
@ -97,7 +100,9 @@ class TestConductorObject(db_base.DbTestCase):
|
||||
|
||||
self.assertIsInstance(c, objects.Conductor)
|
||||
mock_register_cdr.assert_called_once_with(
|
||||
{'drivers': drivers, 'hostname': host},
|
||||
{'drivers': drivers,
|
||||
'hostname': host,
|
||||
'version': '1.5'},
|
||||
update_existing=update_existing)
|
||||
|
||||
def test_register(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user