yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #43034
[Bug 1524035] [NEW] nova.virt.block_device.DriverBlockDevice cannot save to DB if bdm passed in was not already an object
Public bug reported:
This code doesn't work:
https://github.com/openstack/nova/blob/master/nova/virt/block_device.py#L128-L131
That will create a BlockDeviceMapping object to be wrapped in the
DriverBlockDevice object (if a BDM object was not passed in). The
problem is on self._bdm_obj.save() will fail with something like this:
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "nova/tests/unit/virt/test_block_device.py", line 909, in test_blank_attach_volume_cinder_cross_az_attach_false
self.virt_driver)
File "nova/virt/block_device.py", line 456, in attach
self.save()
File "nova/virt/block_device.py", line 363, in save
super(DriverVolumeBlockDevice, self).save()
File "nova/virt/block_device.py", line 176, in save
self._bdm_obj.save()
File "/home/mriedem/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 203, in wrapper
objtype=self.obj_name())
oslo_versionedobjects.exception.OrphanedObjectError: Cannot call save on orphaned BlockDeviceMapping object
That's because the BDM object that was created doesn't have a context
set on it.
And we can't pass context to self._bdm_obj.save() because we removed
that here: https://review.openstack.org/#/c/164268/
We've apparently never had a problem with this in runtime because we
must always be constructing the DriverBlockDevice with a real BDM object
in the compute code, we just weren't doing it properly in the tests -
and the tests mock out nova.objects.BlockDeviceMapping.save() so we
never knew it was a problem.
** Affects: nova
Importance: Medium
Assignee: Matt Riedemann (mriedem)
Status: Triaged
** Changed in: nova
Status: New => Triaged
** Changed in: nova
Importance: Undecided => Medium
** Changed in: nova
Assignee: (unassigned) => Matt Riedemann (mriedem)
--
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/1524035
Title:
nova.virt.block_device.DriverBlockDevice cannot save to DB if bdm
passed in was not already an object
Status in OpenStack Compute (nova):
Triaged
Bug description:
This code doesn't work:
https://github.com/openstack/nova/blob/master/nova/virt/block_device.py#L128-L131
That will create a BlockDeviceMapping object to be wrapped in the
DriverBlockDevice object (if a BDM object was not passed in). The
problem is on self._bdm_obj.save() will fail with something like this:
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "nova/tests/unit/virt/test_block_device.py", line 909, in test_blank_attach_volume_cinder_cross_az_attach_false
self.virt_driver)
File "nova/virt/block_device.py", line 456, in attach
self.save()
File "nova/virt/block_device.py", line 363, in save
super(DriverVolumeBlockDevice, self).save()
File "nova/virt/block_device.py", line 176, in save
self._bdm_obj.save()
File "/home/mriedem/git/nova/.tox/py27/local/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 203, in wrapper
objtype=self.obj_name())
oslo_versionedobjects.exception.OrphanedObjectError: Cannot call save on orphaned BlockDeviceMapping object
That's because the BDM object that was created doesn't have a context
set on it.
And we can't pass context to self._bdm_obj.save() because we removed
that here: https://review.openstack.org/#/c/164268/
We've apparently never had a problem with this in runtime because we
must always be constructing the DriverBlockDevice with a real BDM
object in the compute code, we just weren't doing it properly in the
tests - and the tests mock out nova.objects.BlockDeviceMapping.save()
so we never knew it was a problem.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1524035/+subscriptions
Follow ups