Reviewed: https://review.openstack.org/286828 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=2e2732557a1f8ed38e2ee1b041670cc15ce74377 Submitter: Jenkins Branch: master
commit 2e2732557a1f8ed38e2ee1b041670cc15ce74377 Author: Matt Riedemann <mrie...@us.ibm.com> Date: Tue Mar 1 15:30:40 2016 -0500 libvirt: check for optional LibvirtLiveMigrateData attrs before loading The _live_migration_operation method is accessing the nullable attributes 'serial_listen_addr' and 'target_connect_addr' on the LibvirtLiveMigrateData object which might not be set on the object. Since they aren't lazy-loadable, this results in a NotImplementedError if the attribute aren't set. This is fixed by adding conditional checks in _live_migration_operation for the nullable attributes. Note that bdms is nullable=False in the LiveMigrateDataObject and should be set when the migrate_data object comes to the virt driver, so the test case is updated in this case to fix the bdms attribute access. There was a test hitting this, but because the libvirt driver runs _live_migration_operation in a thread, the error was just being logged and the test would pass. So to fix that, the SpawnIsSynchronous fixture is used in the test class to make the _live_migration_operation synchronous for that test. However, that doesn't fully resolve the gap in the test because of the @catch_notimplemented decorator used on the test case. That is meant for virt drivers which don't implement the live_migration method but it can also allow silent failures in object attribute access from bubbling up as failures. So this change also removes that decorator from the test case. Note that the tests themselves are pretty hacky in this case anyway since while they are meant to be generic per virt driver, the object passed down is LibvirtLiveMigrateData, which won't be correct for xenapi, for example. Closes-Bug: #1551925 Change-Id: I2744e99617d4e4834bb8372fa62dbad7686b1301 ** 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/1551925 Title: NotImplementedError: Cannot load 'serial_listen_addr' in the base class Status in OpenStack Compute (nova): Fix Released Bug description: This is seen in unit test runs: http://logs.openstack.org/59/284959/5/gate/gate-nova- python27/8ab5da7/console.html 2016-03-01 14:54:26.205 | {1} nova.tests.unit.virt.test_virt_drivers.LibvirtConnTestCase.test_live_migration [0.190245s] ... ok 2016-03-01 14:54:26.205 | 2016-03-01 14:54:26.205 | Captured stderr: 2016-03-01 14:54:26.206 | ~~~~~~~~~~~~~~~~ 2016-03-01 14:54:26.206 | Traceback (most recent call last): 2016-03-01 14:54:26.206 | File "/home/jenkins/workspace/gate-nova-python27/.tox/py27/local/lib/python2.7/site-packages/eventlet/hubs/hub.py", line 457, in fire_timers 2016-03-01 14:54:26.206 | timer() 2016-03-01 14:54:26.206 | File "/home/jenkins/workspace/gate-nova-python27/.tox/py27/local/lib/python2.7/site-packages/eventlet/hubs/timer.py", line 58, in __call__ 2016-03-01 14:54:26.206 | cb(*args, **kw) 2016-03-01 14:54:26.206 | File "/home/jenkins/workspace/gate-nova-python27/.tox/py27/local/lib/python2.7/site-packages/eventlet/greenthread.py", line 214, in main 2016-03-01 14:54:26.206 | result = function(*args, **kwargs) 2016-03-01 14:54:26.206 | File "nova/utils.py", line 1160, in context_wrapper 2016-03-01 14:54:26.206 | return func(*args, **kwargs) 2016-03-01 14:54:26.206 | File "nova/virt/libvirt/driver.py", line 6088, in _live_migration_operation 2016-03-01 14:54:26.207 | instance=instance) 2016-03-01 14:54:26.207 | File "/home/jenkins/workspace/gate-nova-python27/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ 2016-03-01 14:54:26.207 | self.force_reraise() 2016-03-01 14:54:26.207 | File "/home/jenkins/workspace/gate-nova-python27/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise 2016-03-01 14:54:26.207 | six.reraise(self.type_, self.value, self.tb) 2016-03-01 14:54:26.207 | File "nova/virt/libvirt/driver.py", line 6014, in _live_migration_operation 2016-03-01 14:54:26.207 | serial_listen_addr = migrate_data.serial_listen_addr 2016-03-01 14:54:26.207 | File "/home/jenkins/workspace/gate-nova-python27/.tox/py27/local/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 67, in getter 2016-03-01 14:54:26.207 | self.obj_load_attr(name) 2016-03-01 14:54:26.207 | File "/home/jenkins/workspace/gate-nova-python27/.tox/py27/local/lib/python2.7/site-packages/oslo_versionedobjects/base.py", line 580, in obj_load_attr 2016-03-01 14:54:26.207 | _("Cannot load '%s' in the base class") % attrname) 2016-03-01 14:54:26.207 | NotImplementedError: Cannot load 'serial_listen_addr' in the base class 2016-03-01 14:54:26.208 | The error is squashed since the nova.tests.unit.virt.test_virt_drivers._VirtDriverTestCase that defines the test ignores NotImplementedError: https://github.com/openstack/nova/blob/9ab6840af64d6af58baf51040afe86a3324221e5/nova/tests/unit/virt/test_virt_drivers.py#L659 The code is unconditionally loading the attribute: https://github.com/openstack/nova/blob/1345d0fe1cad5093d49a58b6f0b7f4cb650f61d8/nova/virt/libvirt/driver.py#L5946 But the attribute is optional: https://github.com/openstack/nova/blob/1345d0fe1cad5093d49a58b6f0b7f4cb650f61d8/nova/objects/migrate_data.py#L124 To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1551925/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp