image conversion dir creation is racy

Bug #1757521 reported by Eric Harney
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Low
yanpuqing

Bug Description

_create_from_image_cache_or_download does

        if (CONF.image_conversion_dir and not
                os.path.exists(CONF.image_conversion_dir)):
            os.makedirs(CONF.image_conversion_dir)

This can race between multiple threads/processes.

os.makedirs errors resulting from the dir already existing should be ignored.

Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :
Changed in cinder:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Sean McGinnis (sean-mcginnis) wrote :

And mocking of that call should be done in unit tests to make sure unit test runs don't create local filesystem changes.

Changed in cinder:
assignee: nobody → zhuangzejian (zhuangzejian)
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/569001

Changed in cinder:
status: Confirmed → In Progress
Changed in cinder:
assignee: zhuangzejian (zhuangzejian) → yanpuqing (ycx)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.openstack.org/569001
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=60c0b9c0af8c056b952c782dc00ccfa84a8b3e05
Submitter: Zuul
Branch: master

commit 60c0b9c0af8c056b952c782dc00ccfa84a8b3e05
Author: smartu3 <email address hidden>
Date: Thu May 17 11:29:59 2018 +0800

    Replace os.makedirs to avoid process race

    Use oslo_utils.fileutils.ensure_tree(path, mode=_DEFAULT_MODE)
    to replace os.makedir.

    Co-Authored-By: ycx <email address hidden>

    Change-Id: Ia5de63768171aa715da6318e768cce1420fef302
    Closes-Bug: #1757521

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 13.0.0.0b3

This issue was fixed in the openstack/cinder 13.0.0.0b3 development milestone.

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

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/593044

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (stable/queens)

Reviewed: https://review.openstack.org/593044
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=24066d51aad46b0dc11484a3ce43925655f82f24
Submitter: Zuul
Branch: stable/queens

commit 24066d51aad46b0dc11484a3ce43925655f82f24
Author: smartu3 <email address hidden>
Date: Thu May 17 11:29:59 2018 +0800

    Replace os.makedirs to avoid process race

    Use oslo_utils.fileutils.ensure_tree(path, mode=_DEFAULT_MODE)
    to replace os.makedir.

    Co-Authored-By: ycx <email address hidden>

    Change-Id: Ia5de63768171aa715da6318e768cce1420fef302
    Closes-Bug: #1757521
    (cherry picked from commit 60c0b9c0af8c056b952c782dc00ccfa84a8b3e05)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 12.0.4

This issue was fixed in the openstack/cinder 12.0.4 release.

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.