<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Thanks Valeriy, I filed this defect: <a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.launchpad.net_manila_-26-2343-3Bbug_1450613&d=AwMGaQ&c=DZ-EF4pZfxGSU6MfABwx0g&r=zHvLuN-cA8dJrDKv-7gpbBCgBAKPaAzJfG6sccaIdHHNpjwlcFjsdjPhFr9XPGnV&m=-5mRhr6zsbDKoOY59zZmnU58ZQwyrD4158jdisZVyYk&s=7fUiHM8MifapBKA3-OsgxFWilek6Go2G2dLtKhUHQpE&e=">
https://bugs.launchpad.net/manila/+bug/1450613</a><br>
<br>
Best regards,<br>
Joe<br>
<br>
<div class="moz-cite-prefix">On 04/30/2015 12:22 PM, Valeriy Ponomaryov wrote:<br>
</div>
<blockquote cite="mid:CAPnpNOVJyR-yUuY56VLRebbR1LUOCuGiWravigjNTmgamrtqYg@mail.gmail.com" type="cite">
<div dir="ltr">Hello, Joe
<div><br>
</div>
<div>It is  bug, "<span style="color:rgb(24,54,145);font-family:Consolas,'Liberation
Mono',Menlo,Courier,monospace;font-size:12px;line-height:16.7999992370605px;white-space:pre">region_name"</span> is not used as should be. Feel free to file a bug for it.</div>
<div><br>
</div>
<div>Kind Regards<br>
Valeriy Ponomaryov<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Thu, Apr 30, 2015 at 8:23 PM, Joe Meadows <span dir="ltr">
<<a moz-do-not-send="true" href="mailto:Joe.Meadows@hds.com" target="_blank">Joe.Meadows@hds.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000">Hi,<br>
<br>
I work for Hitachi Data Systems (HDS) and am developing Manila support for our HNAS line of NAS server.  The HNAS server has an internal REST server so I am implementing the Manila API natively on the server.  For various reasons this is a better fit than the
 standard Python driver implementation.<br>
<br>
This implementation means that each HNAS server is its own endpoint so it gets added to Keystone as an endpoint using the Manila service Id.  I am using regions to distinguish between multiple HNAS servers or other Manila endpoints.  Therefore, when I add each
 HNAS endpoint I give that endpoint a unique region name.<br>
<br>
Initially this worked exactly as expected when using a Manila client that I installed from GitHub following the instructions at
<a moz-do-not-send="true" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__netapp.github.io_openstack_2014_08_15_manila-2Ddevstack_&d=AwMGaQ&c=DZ-EF4pZfxGSU6MfABwx0g&r=zHvLuN-cA8dJrDKv-7gpbBCgBAKPaAzJfG6sccaIdHHNpjwlcFjsdjPhFr9XPGnV&m=V37u0qx0ILzWPG7XsUs5_D2uR6KRjHYV2vSQ20UQnEA&s=gagpiobFCwxAaoXUTt9lRA6-g4vNiC_VDR-TQDX8IR0&e=" target="_blank">
http://netapp.github.io/openstack/2014/08/15/manila-devstack/</a>.  <a moz-do-not-send="true" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__netapp.github.io_openstack_2014_08_15_manila-2Ddevstack_&d=AwMGaQ&c=DZ-EF4pZfxGSU6MfABwx0g&r=zHvLuN-cA8dJrDKv-7gpbBCgBAKPaAzJfG6sccaIdHHNpjwlcFjsdjPhFr9XPGnV&m=V37u0qx0ILzWPG7XsUs5_D2uR6KRjHYV2vSQ20UQnEA&s=gagpiobFCwxAaoXUTt9lRA6-g4vNiC_VDR-TQDX8IR0&e=" target="_blank">
</a>For example, I could do 'manila --os-region-name HNAS1 list' and the request would route to the correct endpoint (i.e. HNAS server).  This Manila client shows version 1.0.2.<br>
<br>
Recently I tried this setup on another developer's OpenStack installation and the region name was ignored, though this client also claimed to be version 1.0.2.  Next I used pip to install python-manilaclient onto another machine, version 1.1.0, and again the
 region is ignored.  <br>
<br>
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. 
<br>
<br>
I made a small change which makes the client behave how I'd like it to.  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.<br>
<br>
--- a/client.py    2015-04-22 16:05:10.000000000 -0700<br>
+++ b/client.py    2015-04-22 16:00:56.000000000 -0700<br>
@@ -142,10 +142,21 @@<br>
                 service_type)<br>
 <br>
             if service_type in catalog:<br>
-                for e_type, endpoint in catalog.get(service_type)[0].items():<br>
-                    if str(e_type).lower() == str(endpoint_type).lower():<br>
-                        service_catalog_url = endpoint<br>
-                        break<br>
+                # JAMJAM START<br>
+                srvCat=catalog.get(service_type)<br>
+                for catalogEntry in srvCat:<br>
+                    if region_name != "":<br>
+                        region=catalogEntry.get("region")<br>
+                        if region != region_name:<br>
+                            continue;<br>
+                    #for e_type, endpoint in catalog.get(service_type)[0].items():<br>
+                # JAMJAM END<br>
+                    for e_type, endpoint in catalogEntry.items():<br>
+                        if str(e_type).lower() == str(endpoint_type).lower():<br>
+                            service_catalog_url = endpoint<br>
+                            break<br>
+                        if service_catalog_url:<br>
+                            break<br>
 <br>
         if not service_catalog_url:<br>
             raise RuntimeError("Could not find Manila endpoint in catalog")<br>
<br>
So now, the obvious questions are; Is there already a way to specify a region that the Manila client will honor?  Is this patch fixing something?  Is this not a valid use of regions for Manila?<br>
<br>
Many thanks in advance   <br>
<span class=""><font color="#888888"> Joe Meadows<br>
 HNAS Engineering<br>
 Hitachi Data Systems<br>
<br>
</font></span></div>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a moz-do-not-send="true" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__OpenStack-2Ddev-2Drequest-40lists.openstack.org-3Fsubject-3Aunsubscribe&d=AwMFaQ&c=DZ-EF4pZfxGSU6MfABwx0g&r=0QqRyIoT53GhjHkZDWbMxyH_29KM3Q-d8YapXFCH24M&m=8aXP1uCUzGcVLYzRkPOLsO3sq40TwMGIbCfRnXimnUw&s=yf2Mj7dGlxaipK3HjaNq7gvBaCZrvqEb8EcpoEj29LU&e=" target="_blank">
OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a moz-do-not-send="true" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openstack.org_cgi-2Dbin_mailman_listinfo_openstack-2Ddev&d=AwMFaQ&c=DZ-EF4pZfxGSU6MfABwx0g&r=0QqRyIoT53GhjHkZDWbMxyH_29KM3Q-d8YapXFCH24M&m=8aXP1uCUzGcVLYzRkPOLsO3sq40TwMGIbCfRnXimnUw&s=jfRogBLF4mtmfUsW-DSCX4s09HJJFQ6HuwLRmgqMCWw&e=" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</blockquote>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset> <br>
<pre wrap="">__________________________________________________________________________
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: <a class="moz-txt-link-abbreviated" href="mailto:OpenStack-dev-request@lists.openstack.org?subject:unsubscribe">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a>
<a class="moz-txt-link-freetext" href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openstack.org_cgi-2Dbin_mailman_listinfo_openstack-2Ddev&d=AwICAg&c=DZ-EF4pZfxGSU6MfABwx0g&r=0QqRyIoT53GhjHkZDWbMxyH_29KM3Q-d8YapXFCH24M&m=8aXP1uCUzGcVLYzRkPOLsO3sq40TwMGIbCfRnXimnUw&s=jfRogBLF4mtmfUsW-DSCX4s09HJJFQ6HuwLRmgqMCWw&e=">https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.openstack.org_cgi-2Dbin_mailman_listinfo_openstack-2Ddev&d=AwICAg&c=DZ-EF4pZfxGSU6MfABwx0g&r=0QqRyIoT53GhjHkZDWbMxyH_29KM3Q-d8YapXFCH24M&m=8aXP1uCUzGcVLYzRkPOLsO3sq40TwMGIbCfRnXimnUw&s=jfRogBLF4mtmfUsW-DSCX4s09HJJFQ6HuwLRmgqMCWw&e=</a> 
</pre>
</blockquote>
<br>
</body>
</html>