Manila client 1.1.0 ignores region parameter

Bug #1450613 reported by Joe Meadows
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-manilaclient
Fix Released
High
Julia Varlamova
Liberty
Fix Released
High
Julia Varlamova

Bug Description

I asked about this on openstack-dev and was advised that the following is a bug:

I have multiple Manila endpoints, each is assigned to unique region. With an older (v1.0.2) Manila client I am able to choose the endpoint by specifying the region (e.g. manila --os-region-name regionABC list'.

This no longer works in the current (v.1.1.0) client, the region is ignored. Interestingly, I tried this on an other developer's setup and regions were also ignored even though his client says it is version 1.0.2.

The manila client that does work correctly with regions was one that I installed by following the instructions here: http://netapp.github.io/openstack/2014/08/15/manila-devstack/.

I stepped through the client code and found that when v1/client.py::__init__() searches for an endpoint it always takes the first one, never checking the region.

I made a small change which makes the client behave how I think it should. If region is not specified it retains the original behavior of returning the first endpoint. If a region is specified then it will return the first endpoint with a matching region. The patch is below, my changes are between the #JAMJAM comments.

--- a/client.py 2015-04-22 16:05:10.000000000 -0700
+++ b/client.py 2015-04-22 16:00:56.000000000 -0700
@@ -142,10 +142,21 @@
                 service_type)

             if service_type in catalog:
- for e_type, endpoint in catalog.get(service_type)[0].items():
- if str(e_type).lower() == str(endpoint_type).lower():
- service_catalog_url = endpoint
- break
+ # JAMJAM START
+ srvCat=catalog.get(service_type)
+ for catalogEntry in srvCat:
+ if region_name != "":
+ region=catalogEntry.get("region")
+ if region != region_name:
+ continue;
+ #for e_type, endpoint in catalog.get(service_type)[0].items():
+ # JAMJAM END
+ for e_type, endpoint in catalogEntry.items():
+ if str(e_type).lower() == str(endpoint_type).lower():
+ service_catalog_url = endpoint
+ break
+ if service_catalog_url:
+ break

         if not service_catalog_url:
             raise RuntimeError("Could not find Manila endpoint in catalog")

Best regards,
Joe Meadows

affects: manila → python-manilaclient
Changed in python-manilaclient:
importance: Undecided → High
status: New → Triaged
Changed in python-manilaclient:
assignee: nobody → Julia Varlamova (jvarlamova)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-manilaclient (master)

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

Changed in python-manilaclient:
status: Triaged → In Progress
tags: added: liberty-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-manilaclient (master)

Reviewed: https://review.openstack.org/225133
Committed: https://git.openstack.org/cgit/openstack/python-manilaclient/commit/?id=0d257aedce8305f6742bdc49548491578d515965
Submitter: Jenkins
Branch: master

commit 0d257aedce8305f6742bdc49548491578d515965
Author: Julia Varlamova <email address hidden>
Date: Fri Sep 18 08:56:58 2015 -0400

    Change Manilaclient to use --os-region-name param

    Manilaclient ignores --os-region-param now. Change client from
    'manilaclient/v1/client.py' to use first endpoint with a matching region.

    Closes-bug: #1450613

    Change-Id: I7fd76b0d874a91952513c40b4a7bdb0c45241dad

Changed in python-manilaclient:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-manilaclient (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/226359

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-manilaclient (stable/liberty)

Reviewed: https://review.openstack.org/226359
Committed: https://git.openstack.org/cgit/openstack/python-manilaclient/commit/?id=07be7c8ede56b706c5779e41104f5ffeb9c07433
Submitter: Jenkins
Branch: stable/liberty

commit 07be7c8ede56b706c5779e41104f5ffeb9c07433
Author: Julia Varlamova <email address hidden>
Date: Fri Sep 18 08:56:58 2015 -0400

    Change Manilaclient to use --os-region-name param

    Manilaclient ignores --os-region-param now. Change client from
    'manilaclient/v1/client.py' to use first endpoint with a matching region.

    Closes-bug: #1450613

    Change-Id: I7fd76b0d874a91952513c40b4a7bdb0c45241dad
    (cherry picked from commit 0d257aedce8305f6742bdc49548491578d515965)

Changed in python-manilaclient:
milestone: none → 1.5.0
status: Fix Committed → Fix Released
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.