yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #53968
[Bug 1595587] Re: Cannot save HostMapping object
Reviewed: https://review.openstack.org/332017
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=daad6c26ecf4e6c32e74d1db0510d40b820d612d
Submitter: Jenkins
Branch: master
commit daad6c26ecf4e6c32e74d1db0510d40b820d612d
Author: Andrey Volkov <avolkov@xxxxxxxxxxxx>
Date: Tue Jun 21 11:47:28 2016 +0300
Fix host mapping saving
Changes return ability to use HostMapping.save method,
it was broken.
It fixes two issues:
- HostMapping._save_in_db got unexpected parameter
(self.host instead of self object from the save call).
It's clear.
- "sqlalchemy.orm.exc.DetachedInstanceError: Parent instance
<HostMapping> is not bound to a Session;"
while trying to get the cell_mapping attribute on saved HostMapping
instance.
As HostMapping cannot be without cell_mapping, solution is to load
cell_mapping attribute just after getting it from DB.
To be consistent I used the code from _create_in_db method.
Closes-bug: 1595587
Change-Id: Ia2e427f5bd4ab43d1c273de72ef7bb8c01d8d1af
** Changed in: nova
Status: In Progress => Fix Released
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1595587
Title:
Cannot save HostMapping object
Status in OpenStack Compute (nova):
Fix Released
Bug description:
https://github.com/openstack/nova/blob/master/nova/objects/host_mapping.py#L111-L129
While I was looking at HostMapping object I found inconsistency in signature and call:
HostMapping._save_in_db(context, obj, updates) uses objects attributes id and host.
But then it is called from HostMapping.save second param is self.host which is not object
but just a string.
Existing test (nova.tests.unit.objects.test_host_mapping.TestHostMappingObject.test_save) doesn't catch this error because _save_in_db is mocked.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1595587/+subscriptions
References