'search_opts' unexpected keyword argument for resource manager list()

Bug #1248519 reported by Peter Hamilton
36
This bug affects 6 people
Affects Status Importance Assigned to Milestone
python-cinderclient
Fix Released
Undecided
Chen Xiao
python-cinderclient (Ubuntu)
Fix Released
Undecided
Unassigned
Trusty
Fix Released
Undecided
Unassigned

Bug Description

Location: cinderclient.base.ManagerWithFind
Method: findall
Version: cinder/cinderclient 1.0.7.76, latest master branch as of Nov. 6, 2013

The following three cinder commands yield the following error:

Commands:
type-key
encryption-type-create
encryption-type-show

ERROR: list() got an unexpected keyword argument 'search_opts'

I've traced this error to the findall() method in the cinderclient.base.ManagerWithFind class. A recent commit to python-cinderclient (Change-Id: I4e9957b66c11b7e1081f066d189cedc5a3cb2a6c) modified the list() call to include a 'search_opts' argument for searching across all tenants. The list() method in the VolumeEncryptionTypeManager and the VolumeTypeManager , which support the above commands, do not support a 'search_opts' keyword argument, causing the error.

A temporary work around to get the above commands to work is to use the
resource ID instead of the resource name. The query for the ID uses a
different code path, bypassing the 'search_opts' problem.

Proposed Fix:
Add a 'search_opts' keyword argument to both resource managers and implement the required functionality. The argument should also be added to the list() signature in the cinderclient.base.ManagerWithFind base class to clarify to all current/future subclass developers what the list() implementation requirements are.

Note:
There are several other resource managers that lack the list() 'search_opts' keyword argument. See the VolumeBackupManager, the AvailabilityZoneManager, the VolumeTransferManager, the ServiceManager, and the QoSSpecsManager (v1 and v2 for all), all of which are subclasses of base.ManagerWithFind and all capable of triggering this error if called from ManagerWithFind.findall().

description: updated
description: updated
description: updated
description: updated
Changed in python-cinderclient:
status: New → Confirmed
Revision history for this message
Chen Xiao (chenxiao) wrote :

@Peter, will you fix this bug, This bug affect me too, If you will not, I can fix it.

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

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

Changed in python-cinderclient:
assignee: nobody → Chen Xiao (chenxiao)
status: Confirmed → In Progress
Revision history for this message
Chen Xiao (chenxiao) wrote :

the fix:
 check the list() arguments in subclass can avoid the issue

Revision history for this message
Chen Xiao (chenxiao) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Revision history for this message
James Page (james-page) wrote :

Impacting Ubuntu Trusty:

apt-cache policy python-cinderclient
python-cinderclient:
  Installed: 1:1.0.7-0ubuntu1
  Candidate: 1:1.0.7-0ubuntu1
  Version table:
 *** 1:1.0.7-0ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages
        100 /var/lib/dpkg/status

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

Reviewed: https://review.openstack.org/67780
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=2f0863b7d4d20198f496534d5ffef85e68ff45fc
Submitter: Jenkins
Branch: master

commit 2f0863b7d4d20198f496534d5ffef85e68ff45fc
Author: Xiao Chen <email address hidden>
Date: Mon Jan 20 15:29:55 2014 +0800

    Fix 'search_opts' unexpected keyword argument error

    When executing 'encryption-type-create' command using resource
    name, it will use the findall() in base.py, then error will
    occur because list() in findall() used 'search_opts' argument
    which list() in VolumeEncryptionTypeManager did not have. Some
    other command like 'transfer-delete' met same issue.

    This patch will add 'search_opts' argument in list() function
    in child class to avoid the bug.

    Closes-Bug: #1248519
    Related-Bug: #1252665

    Change-Id: If1cd8b812af21335e5d4351766539a927a8fbdf4

Changed in python-cinderclient:
status: In Progress → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-cinderclient - 1:1.0.7-0ubuntu2

---------------
python-cinderclient (1:1.0.7-0ubuntu2) trusty; urgency=medium

  * debian/patches/fix-search-opts.patch: Fix 'search_opts' unexpected keyword
    argument error (LP: #1248519)
 -- Chuck Short <email address hidden> Thu, 30 Jan 2014 08:52:32 -0500

Changed in python-cinderclient (Ubuntu Trusty):
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to python-cinderclient (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/74880

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to python-cinderclient (master)

Reviewed: https://review.openstack.org/74880
Committed: https://git.openstack.org/cgit/openstack/python-cinderclient/commit/?id=029a77645592093f8b46c2d7472d2536f0db78d3
Submitter: Jenkins
Branch: master

commit 029a77645592093f8b46c2d7472d2536f0db78d3
Author: seungjin <email address hidden>
Date: Thu Feb 20 09:25:32 2014 +0900

    Fix 'search_opts' error with backup delete command

    The following error message is yield when we try to
    backup volume which is not present.

    ERROR: list() got an unexpected keyword argument 'search_opts'

    This is from findall() method in the
    cinderclient.base.ManagerWithFind class.

    When cinderclient get a specific resource, it use the findall() method.

    The error will yields which list() in
    VolumeEncryptionTypeManager did not have.

    Change-Id: Iffe568c6d2de41b8e24658f3a54f2861e2f7db31
    Closes-Bug: #1282324
    Related-Bug: #1248519

Changed in python-cinderclient:
milestone: none → 1.3.1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.