Unit test test_upload_volume* in test_image_utils.py fail without /dev/loop1

Bug #1357521 reported by Tomoki Sekiyama
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Tomoki Sekiyama

Bug Description

If there is not /dev/loop1 in the test environment, python27 unit test fails by the exception below.

    test_upload_volume FAIL
    test_upload_volume_on_error FAIL
    test_upload_volume_with_bps_limit FAIL

======================================================================
FAIL: cinder.tests.test_image_utils.TestUtils.test_upload_volume
----------------------------------------------------------------------
Traceback (most recent call last):
_StringException: Empty attachments:
  stderr
  stdout

Traceback (most recent call last):
  File "/opt/stack/cinder/cinder/tests/test_image_utils.py", line 474, in test_upload_volume
    image_meta, '/dev/loop1')
  File "/opt/stack/cinder/cinder/image/image_utils.py", line 294, in upload_volume
    bps_limit=CONF.volume_copy_bps_limit)
  File "/opt/stack/cinder/cinder/image/image_utils.py", line 80, in convert_image
    fsz_mb = os.stat(source).st_size / units.Mi
OSError: [Errno 2] No such file or directory: '/dev/loop1'

This is because os.stat is not mocked in the unit tests, and reading real file.

Revision history for this message
Tomoki Sekiyama (tsekiyama) wrote :

This bug was introduced by:

commit 202ebc2d987c86984ba9cf8e8e36c32899baaa3b

    "Add timer info for copy operations"

Revision history for this message
Tomoki Sekiyama (tsekiyama) wrote :

This also occurs even with loop device support, if loop device dynamically created.
( For example, in Fedora 20, there is no /dev/loop1 at first, but if "mount -o loop /tmp/disk.img /mnt/test" is executed, /dev/loop? is automatically created. )
For this reason, this bug is not the same as bug #1357010.

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

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

Changed in cinder:
assignee: nobody → Tomoki Sekiyama (tsekiyama)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cinder (master)

Change abandoned by Tomoki Sekiyama (<email address hidden>) on branch: master
Review: https://review.openstack.org/114650
Reason: This bug was fixed by https://review.openstack.org/#/c/114709/

Revision history for this message
Tomoki Sekiyama (tsekiyama) wrote :

This bug was fixed by patch at https://review.openstack.org/#/c/114709/

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in cinder:
milestone: none → juno-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in cinder:
milestone: juno-3 → 2014.2
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.