cinder volume driver's detach() causes TypeError exception on v1 cinder client

Bug #1561056 reported by Corey Wright
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Corey Wright
nova (Ubuntu)
Fix Released
Medium
Corey Wright

Bug Description

Nova version: git master branch's HEAD (as of today)
Expected behavior: cinderclient v1 detach() called with accepted argument
Actual behavior: cinderclient v1 detach() called with too many arguments

Change I3cdc4992 indiscriminately passes both volume_id and attachment_id to the Cinder client regardless of its version even though Cinder client v2 supports passing volume_id and optionally attachment_id to its volume manager's detach() method, but v1 does not, only accepting volume_id.

Calling Cinder client v1 detach() with both volume_id and attachment_id results in "TypeError: detach() takes exactly 2 arguments (3 given)"

Full traceback and proposed bug fix to follow.

Tags: volumes
Revision history for this message
Corey Wright (coreywright) wrote :

  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/compute/manager.py", line 379, in decorated_function
    return function(self, context, *args, **kwargs)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/compute/manager.py", line 2525, in terminate_instance
    do_terminate_instance(instance, bdms)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/oslo_concurrency/lockutils.py", line 271, in inner
    return f(*args, **kwargs)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/compute/manager.py", line 2523, in do_terminate_instance
    self._set_instance_obj_error_state(context, instance)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/compute/manager.py", line 2513, in do_terminate_instance
    self._delete_instance(context, instance, bdms, quotas)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/hooks.py", line 149, in inner
    rv = f(*args, **kwargs)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/compute/manager.py", line 2476, in _delete_instance
    quotas.rollback()
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/compute/manager.py", line 2451, in _delete_instance
    self._shutdown_instance(context, instance, bdms)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/compute/manager.py", line 2367, in _shutdown_instance
    self.volume_api.detach(context, bdm.volume_id, instance.uuid)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/volume/cinder.py", line 249, in wrapper
    res = method(self, ctx, volume_id, *args, **kwargs)
  File "/opt/rackstack/rackstack.532.4/nova/lib/python2.7/site-packages/nova/volume/cinder.py", line 411, in detach
    cinderclient(context).volumes.detach(volume_id, attachment_id)
TypeError: detach() takes exactly 2 arguments (3 given)

Changed in nova (Ubuntu):
assignee: nobody → Corey Wright (coreywright)
Revision history for this message
melanie witt (melwitt) wrote :
Changed in nova:
assignee: nobody → Corey Wright (coreywright)
assignee: Corey Wright (coreywright) → nobody
importance: Undecided → Medium
status: New → In Progress
tags: added: volumes
Changed in nova:
assignee: nobody → Corey Wright (coreywright)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

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

commit a45f5dd7021a15064ae50d07755be9e2bfc22ae9
Author: Corey Wright <email address hidden>
Date: Wed Mar 23 10:07:59 2016 -0500

    cinder: accommodate v1 cinder client in detach call

    Call Cinder client's detach() with attachment_uuid only if the client
    is v2.

    Cinder client v2 supports passing volume_id and optionally
    attachment_id to its volume manager's detach() method, but v1 does
    not, only accepting volume_id. Change I3cdc4992 indiscriminately
    passes both volume_id and attachment_id to the Cinder client
    regardless of its version, prompting with v1:

        TypeError: detach() takes exactly 2 arguments (3 given)

    Change-Id: I2e8b5947521d659e930141b0b8e6a6353e9163bd
    Closes-Bug: 1561056

Changed in nova:
status: In Progress → Fix Released
Changed in nova (Ubuntu):
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/nova 14.0.0.0b2

This issue was fixed in the openstack/nova 14.0.0.0b2 development milestone.

Chuck Short (zulcss)
Changed in nova (Ubuntu):
status: Triaged → Fix Released
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/418401

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/mitaka)

Change abandoned by Matt Riedemann (<email address hidden>) on branch: stable/mitaka
Review: https://review.openstack.org/418401

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.