yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #60766
[Bug 1640502] Re: Empty /etc/machine-id causes failure in unit tests
Reviewed: https://review.openstack.org/420176
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=e0a8582c8dfe6894bdf9efe9e7c6eda4f637440f
Submitter: Jenkins
Branch: master
commit e0a8582c8dfe6894bdf9efe9e7c6eda4f637440f
Author: Sławek Kapłoński <slawek@xxxxxxxxxxxx>
Date: Fri Jan 13 20:38:20 2017 +0000
Set sysinfo_serial="none" in LibvirtDriverTestCase
Some tests, like test_rescue was failing when on host was
empty file /etc/machine-id
Setting config option sysinfo_serial to "none" in those tests
disable code which is trying to get host sysinfo serial which
which is not needed in tests and makes unit tests passing in
case when /etc/machine-id is empty.
Change-Id: I5877b313649d9ba52cd28ff4deb849eead0b770f
Closes-Bug: #1640502
** 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/1640502
Title:
Empty /etc/machine-id causes failure in unit tests
Status in OpenStack Compute (nova):
Fix Released
Bug description:
Description
===========
When the /etc/machine-id file is empty on host, unit tests rescue in
Libvirt driver case are failing with NovaException. It seems that this
file shall be generated by systemd
(https://www.freedesktop.org/software/systemd/man/machine-id.html),
but it is not present/set on all platforms by default (like
'ubuntu:xenial' container). It may be potentially problematic on some
CI/dev-environments that are testing if unit-tests are passing.
Steps to reproduce
==================
* Launch Docker container 'ubuntu:xenial'
* Setup repository and install build-dep for Nova
* Clone Nova from Github
* Run: tox -e py27 'nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase'
Expected result
===============
The unit tests shall be platform-independent, right?
Therefore in nova/tests/unit/virt/libvirt/test_driver.py there should be a mock for /etc/machine-id file.
Actual result
=============
The tests
nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase.test_rescue_config_drive
and
nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase.test_rescue
are failing due to '**nova.exception.NovaException: Unable to get host
UUID: /etc/machine-id is empty**'.
Environment
===========
Clean 'ubuntu:xenial' Docker container with just build-deps for Nova
from cloud-archive.
Logs & Configs
==============
For nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase.test_rescue:
```
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "nova/tests/unit/virt/libvirt/test_driver.py", line 16387, in test_rescue
backend, doc = self._test_rescue(instance)
File "/TEST/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
return func(*args, **keywargs)
File "nova/tests/unit/virt/libvirt/test_driver.py", line 16379, in _test_rescue
network_info, image_meta, rescue_password)
File "nova/virt/libvirt/driver.py", line 2527, in rescue
unrescue_xml = self._get_existing_domain_xml(instance, network_info)
File "nova/virt/libvirt/driver.py", line 1270, in _get_existing_domain_xml
block_device_info=block_device_info)
File "nova/virt/libvirt/driver.py", line 4677, in _get_guest_xml
context)
File "nova/virt/libvirt/driver.py", line 4494, in _get_guest_config
root_device_name)
File "nova/virt/libvirt/driver.py", line 4299, in _configure_guest_by_virt_type
guest.sysinfo = self._get_guest_config_sysinfo(instance)
File "nova/virt/libvirt/driver.py", line 3596, in _get_guest_config_sysinfo
sysinfo.system_serial = self._sysinfo_serial_func()
File "nova/virt/libvirt/driver.py", line 3585, in _get_host_sysinfo_serial_auto
return self._get_host_sysinfo_serial_os()
File "nova/virt/libvirt/driver.py", line 3579, in _get_host_sysinfo_serial_os
raise exception.NovaException(msg)
nova.exception.NovaException: Unable to get host UUID: /etc/machine-id is empty
```
For nova.tests.unit.virt.libvirt.test_driver.LibvirtDriverTestCase.test_rescue_config_drive:
```
Captured traceback:
~~~~~~~~~~~~~~~~~~~
Traceback (most recent call last):
File "/TEST/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
return func(*args, **keywargs)
File "nova/tests/unit/virt/libvirt/test_driver.py", line 16426, in test_rescue_config_drive
instance, exists=lambda name: name != 'disk.config.rescue')
File "/TEST/nova/.tox/py27/local/lib/python2.7/site-packages/mock/mock.py", line 1305, in patched
return func(*args, **keywargs)
File "nova/tests/unit/virt/libvirt/test_driver.py", line 16379, in _test_rescue
network_info, image_meta, rescue_password)
File "nova/virt/libvirt/driver.py", line 2527, in rescue
unrescue_xml = self._get_existing_domain_xml(instance, network_info)
File "nova/virt/libvirt/driver.py", line 1270, in _get_existing_domain_xml
block_device_info=block_device_info)
File "nova/virt/libvirt/driver.py", line 4677, in _get_guest_xml
context)
File "nova/virt/libvirt/driver.py", line 4494, in _get_guest_config
root_device_name)
File "nova/virt/libvirt/driver.py", line 4299, in _configure_guest_by_virt_type
guest.sysinfo = self._get_guest_config_sysinfo(instance)
File "nova/virt/libvirt/driver.py", line 3596, in _get_guest_config_sysinfo
sysinfo.system_serial = self._sysinfo_serial_func()
File "nova/virt/libvirt/driver.py", line 3585, in _get_host_sysinfo_serial_auto
return self._get_host_sysinfo_serial_os()
File "nova/virt/libvirt/driver.py", line 3579, in _get_host_sysinfo_serial_os
raise exception.NovaException(msg)
nova.exception.NovaException: Unable to get host UUID: /etc/machine-id is empty
```
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1640502/+subscriptions
References