nova xenapi unit tests fail with os-xenapi 0.3.0

Bug #1715217 reported by Matt Riedemann
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Matt Riedemann
OpenStack Global Requirements
Fix Released
Undecided
Unassigned

Bug Description

Noticed here: https://review.openstack.org/#/c/500770/

Failures are here: http://logs.openstack.org/70/500770/3/check/gate-cross-nova-python27-ubuntu-xenial/1305547/testr_results.html.gz

For example:

nova.tests.unit.compute.test_compute_xen.ComputeXenTestCase.test_sync_power_states_instance_not_found_StringException: pythonlogging:'': {{{2017-09-05 17:33:49,276 INFO [nova.virt.driver] Loading compute driver 'xenapi.XenAPIDriver'}}}

Traceback (most recent call last):
  File "nova/tests/unit/compute/test_compute_xen.py", line 40, in setUp
    self.compute = manager.ComputeManager()
  File "nova/compute/manager.py", line 541, in __init__
    self.driver = driver.load_compute_driver(self.virtapi, compute_driver)
  File "nova/virt/driver.py", line 1609, in load_compute_driver
    virtapi)
  File "/home/jenkins/workspace/gate-cross-nova-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/oslo_utils/importutils.py", line 44, in import_object
    return import_class(import_str)(*args, **kwargs)
  File "nova/virt/xenapi/driver.py", line 90, in __init__
    originator="nova")
  File "/home/jenkins/workspace/gate-cross-nova-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/os_xenapi/client/session.py", line 90, in __init__
    self.ip = self._get_ip_from_url(url)
  File "/home/jenkins/workspace/gate-cross-nova-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/os_xenapi/client/session.py", line 137, in _get_ip_from_url
    return socket.gethostbyname(url_parts.netloc)
  File "/home/jenkins/workspace/gate-cross-nova-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/eventlet/support/greendns.py", line 477, in gethostbyname
    rrset = resolve(hostname)
  File "/home/jenkins/workspace/gate-cross-nova-python27-ubuntu-xenial/.tox/py27/local/lib/python2.7/site-packages/eventlet/support/greendns.py", line 364, in resolve
    raise EAI_NODATA_ERROR
socket.gaierror: [Errno -5] No address associated with hostname

It looks like this is due to this change that went into os-xenapi 0.3.0:

https://review.openstack.org/#/c/485933/

I don't know if this is an issue in os-xenapi (regression) or if nova needs to now start stubbing out the XenAPISession init code.

It looks like the unit tests within os-xenapi are mocking out the call to the socket module:

https://github.com/openstack/os-xenapi/blob/0.3.0/os_xenapi/tests/client/test_session.py#L32

It would be nice if there were a fixture class in the os-xenapi library that nova's xenapi unit tests could load and that would perform the proper stubs like this.

Matt Riedemann (mriedem)
Changed in nova:
status: New → Confirmed
tags: added: test xenserver
tags: added: testing
removed: test
Changed in openstack-requirements:
status: New → Confirmed
Revision history for this message
Matt Riedemann (mriedem) wrote :

I think the other possible reason this could be failing the unit tests is that the url being passed in is None, since it comes from CONF.xenserver.connection_url and that's not set globally in tests.

Revision history for this message
Matt Riedemann (mriedem) wrote :

Yeah this used to cause a 500 in the placement API but that was changed to a 400:

https://review.openstack.org/#/c/499270/

Good spot on where we're doing this incorrectly though during evacuation.

Revision history for this message
Matt Riedemann (mriedem) wrote :

Ignore comment 2, that was for another bug.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/500968

Changed in nova:
assignee: nobody → Matt Riedemann (mriedem)
status: Confirmed → In Progress
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
Revision history for this message
Bob Ball (bob-ball) wrote :

We didn't realise this would be picked up here - this is fixed in https://review.openstack.org/#/c/499573/3 which is a dependency of the global-requirements change at https://review.openstack.org/#/c/500554/

Generally I really don't like that Nova understands the internals of os-xenapi, hence my more comprehensive change to mock out the right things.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/500968
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=81b99caae021593ba65f2fe6a2dbc0f9532d1c70
Submitter: Jenkins
Branch: master

commit 81b99caae021593ba65f2fe6a2dbc0f9532d1c70
Author: Matt Riedemann <email address hidden>
Date: Tue Sep 5 16:06:31 2017 -0400

    Make xen unit tests work with os-xenapi>=0.3.0

    Change Ie1b49a206b57219083059871f326926cc4628142 in os-xenapi
    0.3.0 requires that the URL passed into the XenAPISession is
    an actual URL, which means we need to fix a bunch of unit tests.

    Change-Id: Ida4b8c33e8b3bbd03548648f8e57d923b255f35c
    Closes-Bug: #1715217

Changed in nova:
status: In Progress → Fix Released
Changed in openstack-requirements:
status: Confirmed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 17.0.0.0b1

This issue was fixed in the openstack/nova 17.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.