need handle DevicePathInUse in attach_volume

Bug #1621452 reported by jichenjc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
jichenjc
Mitaka
Fix Released
Medium
Tony Breeds
Newton
Fix Committed
Medium
Matt Riedemann

Bug Description

Attach a volume with used name will got error, the root cause is we didn't handle DevicePathInUse

2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions instance, bdms, new_bdm)
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1667, in _get_device_name_for_instance
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions instance, bdms, block_device_obj.get("device_name"))
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/compute/utils.py", line 104, in get_device_name_for_instance
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions mappings['root'], device)
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions File "/usr/lib/python2.7/site-packages/nova/compute/utils.py", line 185, in get_next_device_name
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions raise exception.DevicePathInUse(path=device)
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions DevicePathInUse: The supplied device path (/dev/sda) is in use.
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions
2016-09-06 08:34:17.148 5177 ERROR nova.api.openstack.extensions
2016-09-06 08:34:17.223 5177 INFO nova.api.openstack.wsgi [req-665260fe-9434-4259-a658-f1eb30948522 6a1f271818af46f3ae3c99d09a1efdff 134b4b70bc464c0db32624ad256a6563 - - -] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.

jichenjc (jichenjc)
Changed in nova:
assignee: nobody → jichenjc (jichenjc)
Revision history for this message
Matt Riedemann (mriedem) wrote :

Please provide recreate steps.

Changed in nova:
status: New → Incomplete
Revision history for this message
jichenjc (jichenjc) wrote :

[root@t1 nova] # nova volume-attach 765d0088-17de-4357-9cfe-92eea1f692ab b27f526c-64d6-4a35-8a01-b6afa602d7d5 /dev/vdb
+----------+--------------------------------------+
| Property | Value |
+----------+--------------------------------------+
| device | /dev/sdb |
| id | b27f526c-64d6-4a35-8a01-b6afa602d7d5 |
| serverId | 765d0088-17de-4357-9cfe-92eea1f692ab |
| volumeId | b27f526c-64d6-4a35-8a01-b6afa602d7d5 |
+----------+--------------------------------------+

[root@t1 nova] # nova volume-attach 765d0088-17de-4357-9cfe-92eea1f692ab b27f526c-64d6-4a35-8a01-b6afa602d7d5 /dev/vdb

next time, when I attach with name same DevicePathInUse will be raised

I am in liberty branch but I checked the code and seems we didn't catch DevicePathInUse in master

Revision history for this message
jichenjc (jichenjc) wrote :
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/367358

Changed in nova:
status: Incomplete → In Progress
Changed in nova:
assignee: jichenjc (jichenjc) → Matt Riedemann (mriedem)
Matt Riedemann (mriedem)
Changed in nova:
assignee: Matt Riedemann (mriedem) → jichenjc (jichenjc)
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/newton)

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/383467

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

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/383474

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

Reviewed: https://review.openstack.org/367358
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=6051499a856659290c381e1a80328e48fe8a2199
Submitter: Jenkins
Branch: master

commit 6051499a856659290c381e1a80328e48fe8a2199
Author: jichenjc <email address hidden>
Date: Wed Sep 7 04:41:06 2016 +0800

    Catch DevicePathInUse in attach_volume

    DevicePathInUse might be raised in attach action,
    we didn't catch it so a 500 error might be returned
    to end user.

    Change-Id: Ic9f0979b5adef28bb47756e7fc2ce5a3d6493298
    Closes-Bug: 1621452

Changed in nova:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (stable/newton)

Reviewed: https://review.openstack.org/383467
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=1ef4b725f1df54bc45f6d50a02d9aa65d3bff338
Submitter: Jenkins
Branch: stable/newton

commit 1ef4b725f1df54bc45f6d50a02d9aa65d3bff338
Author: jichenjc <email address hidden>
Date: Wed Sep 7 04:41:06 2016 +0800

    Catch DevicePathInUse in attach_volume

    DevicePathInUse might be raised in attach action,
    we didn't catch it so a 500 error might be returned
    to end user.

    Change-Id: Ic9f0979b5adef28bb47756e7fc2ce5a3d6493298
    Closes-Bug: 1621452
    (cherry picked from commit 6051499a856659290c381e1a80328e48fe8a2199)

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

Reviewed: https://review.openstack.org/383474
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=fdc5a04962bac95724124c247d527316ed8ccd17
Submitter: Jenkins
Branch: stable/mitaka

commit fdc5a04962bac95724124c247d527316ed8ccd17
Author: jichenjc <email address hidden>
Date: Wed Sep 7 04:41:06 2016 +0800

    Catch DevicePathInUse in attach_volume

    DevicePathInUse might be raised in attach action,
    we didn't catch it so a 500 error might be returned
    to end user.

    NOTE: mitaka also includes the legacy_v2 API so this needs to
    be patched there to.

    Change-Id: Ic9f0979b5adef28bb47756e7fc2ce5a3d6493298
    Closes-Bug: 1621452
    (cherry picked from commit 6051499a856659290c381e1a80328e48fe8a2199)
    (cherry picked from commit 1ef4b725f1df54bc45f6d50a02d9aa65d3bff338)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.2

This issue was fixed in the openstack/nova 14.0.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.0.0.0b1

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.2

This issue was fixed in the openstack/nova 14.0.2 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 13.1.3

This issue was fixed in the openstack/nova 13.1.3 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.