Public bug reported:

Running tests on Ubuntu 20.04 fails because ``qemu-image`` packages is
not getting installed

{0} 
glance.tests.unit.common.test_format_inspector.TestFormatInspectors.test_qcow2_safety_checks
 ... SKIPPED: qemu-img not installed
/bin/sh: 1: qemu-img: not found
5+0 records in
5+0 records out
5242880 bytes (5.2 MB, 5.0 MiB) copied, 0.0251411 s, 209 MB/s
/bin/sh: 1: qemu-img: not found
{3} 
glance.tests.unit.common.test_format_inspector.TestFormatInspectors.test_vmdk_bad_descriptor_mem_limit_stream_optimized
 [0.034142s] ... FAILED

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):

      File 
"/home/runner/work/glance/glance/glance/tests/unit/common/test_format_inspector.py",
 line 395, in test_vmdk_bad_descriptor_mem_limit_stream_optimized
    self._test_vmdk_bad_descriptor_mem_limit(subformat='streamOptimized')

      File 
"/home/runner/work/glance/glance/glance/tests/unit/common/test_format_inspector.py",
 line 366, in _test_vmdk_bad_descriptor_mem_limit
    img = self._create_allocated_vmdk(image_size // units.Mi,

      File 
"/home/runner/work/glance/glance/glance/tests/unit/common/test_format_inspector.py",
 line 198, in _create_allocated_vmdk
    subprocess.check_output(

      File 
"/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/subprocess.py", line 
421, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

      File 
"/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/subprocess.py", line 
526, in run
    raise CalledProcessError(retcode, process.args,

    subprocess.CalledProcessError: Command 'qemu-img convert -f raw -O
vmdk -o subformat=streamOptimized -S 0 /tmp/glance-unittest-
formatinspector--streamOptimized-h6nqlk89.raw /tmp/glance-unittest-
formatinspector--streamOptimized-2wxl1cmv.vmdk' returned non-zero exit
status 127.

How to reproduce:
Run tox test on py3 module on Ubuntu 20.04
``tox -e py3``

This looks like to be happening because ``qemu`` packages in ``bindep.txt`` are 
not set to be used with ``test`` profile.
https://opendev.org/openstack/glance/src/branch/master/bindep.txt#L27-L30
But ``tox.ini`` shows that bindep is using ``test`` profile for testing.
https://opendev.org/openstack/glance/src/branch/master/tox.ini#L91

I suggest following fix for not only Ubuntu but other operating systems

bindep.txt
```
-qemu [platform:dpkg devstack build-image-dib]
-qemu-utils [platform:dpkg devstack build-image-dib]
-qemu-img [platform:redhat]
-qemu-tools [platform:suse]  # Provides qemu-img
+qemu [platform:dpkg devstack build-image-dib test]
+qemu-utils [platform:dpkg devstack build-image-dib test]
+qemu-img [platform:redhat test]
+qemu-tools [platform:suse test]  # Provides qemu-img
```

** Affects: glance
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/2097890

Title:
  qemu-img not found when testing on Ubuntu 20.04

Status in Glance:
  New

Bug description:
  Running tests on Ubuntu 20.04 fails because ``qemu-image`` packages is
  not getting installed

  {0} 
glance.tests.unit.common.test_format_inspector.TestFormatInspectors.test_qcow2_safety_checks
 ... SKIPPED: qemu-img not installed
  /bin/sh: 1: qemu-img: not found
  5+0 records in
  5+0 records out
  5242880 bytes (5.2 MB, 5.0 MiB) copied, 0.0251411 s, 209 MB/s
  /bin/sh: 1: qemu-img: not found
  {3} 
glance.tests.unit.common.test_format_inspector.TestFormatInspectors.test_vmdk_bad_descriptor_mem_limit_stream_optimized
 [0.034142s] ... FAILED

  Captured traceback:
  ~~~~~~~~~~~~~~~~~~~
      Traceback (most recent call last):

        File 
"/home/runner/work/glance/glance/glance/tests/unit/common/test_format_inspector.py",
 line 395, in test_vmdk_bad_descriptor_mem_limit_stream_optimized
      self._test_vmdk_bad_descriptor_mem_limit(subformat='streamOptimized')

        File 
"/home/runner/work/glance/glance/glance/tests/unit/common/test_format_inspector.py",
 line 366, in _test_vmdk_bad_descriptor_mem_limit
      img = self._create_allocated_vmdk(image_size // units.Mi,

        File 
"/home/runner/work/glance/glance/glance/tests/unit/common/test_format_inspector.py",
 line 198, in _create_allocated_vmdk
      subprocess.check_output(

        File 
"/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/subprocess.py", line 
421, in check_output
      return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,

        File 
"/opt/hostedtoolcache/Python/3.10.16/x64/lib/python3.10/subprocess.py", line 
526, in run
      raise CalledProcessError(retcode, process.args,

      subprocess.CalledProcessError: Command 'qemu-img convert -f raw -O
  vmdk -o subformat=streamOptimized -S 0 /tmp/glance-unittest-
  formatinspector--streamOptimized-h6nqlk89.raw /tmp/glance-unittest-
  formatinspector--streamOptimized-2wxl1cmv.vmdk' returned non-zero exit
  status 127.

  How to reproduce:
  Run tox test on py3 module on Ubuntu 20.04
  ``tox -e py3``

  This looks like to be happening because ``qemu`` packages in ``bindep.txt`` 
are not set to be used with ``test`` profile.
  https://opendev.org/openstack/glance/src/branch/master/bindep.txt#L27-L30
  But ``tox.ini`` shows that bindep is using ``test`` profile for testing.
  https://opendev.org/openstack/glance/src/branch/master/tox.ini#L91

  I suggest following fix for not only Ubuntu but other operating
  systems

  bindep.txt
  ```
  -qemu [platform:dpkg devstack build-image-dib]
  -qemu-utils [platform:dpkg devstack build-image-dib]
  -qemu-img [platform:redhat]
  -qemu-tools [platform:suse]  # Provides qemu-img
  +qemu [platform:dpkg devstack build-image-dib test]
  +qemu-utils [platform:dpkg devstack build-image-dib test]
  +qemu-img [platform:redhat test]
  +qemu-tools [platform:suse test]  # Provides qemu-img
  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/2097890/+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

Reply via email to