Merge "Make create_inventory() handle name change"
This commit is contained in:
commit
e092ca6716
@ -326,13 +326,8 @@ class ComputeNode(base.NovaPersistentObject, base.NovaObject):
|
||||
except db_exc.DBDuplicateEntry:
|
||||
rp = objects.ResourceProvider.get_by_uuid(self._context, self.uuid)
|
||||
if rp.name != rp_name:
|
||||
# FIXME(danms): We probably need a .save() operation on RP
|
||||
# so that we can update this
|
||||
LOG.warning(_LW('Compute node %(uuid)s changed name '
|
||||
'from %(old)s to %(new)s'),
|
||||
{'uuid': self.uuid,
|
||||
'old': rp.name,
|
||||
'new': rp_name})
|
||||
rp.name = rp_name
|
||||
rp.save()
|
||||
|
||||
return rp
|
||||
|
||||
|
@ -65,3 +65,7 @@ class ComputeNodeTestCase(test.TestCase):
|
||||
rp = self.cn._ensure_resource_provider()
|
||||
self.assertEqual('compute-%s-%s' % ('foo', self.cn.uuid),
|
||||
rp.name)
|
||||
self.cn.host = 'bar'
|
||||
rp = self.cn._ensure_resource_provider()
|
||||
self.assertEqual('compute-%s-%s' % ('bar', self.cn.uuid),
|
||||
rp.name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user