<div dir="ltr"><div>Hi!<br><br>>didn't work for me in this particular case because of a bug in novaclient<br></div><br>Can you tell more about bug in novaclient or share a bug report?<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 24, 2016 at 8:42 AM, Xav Paice <span dir="ltr"><<a href="mailto:xavpaice@gmail.com" target="_blank">xavpaice@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">fwiw, the second part of Monty's message is in the docs, sans region - it would be a fairly swift change to add that and I'll probably submit a gerrit for it soon.<div><br></div><div>Regards os_client_config, <a href="http://docs.openstack.org/developer/os-client-config/" target="_blank">http://docs.openstack.org/developer/os-client-config/</a> is great.  Unfortunately it didn't work for me in this particular case because of a bug in novaclient, but that's beside the point - os_client_config is doing exactly the right thing and I'm really happy with that approach in most cases (and am changing some of our tooling to reflect that).</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 24 February 2016 at 05:05, Matt Riedemann <span dir="ltr"><<a href="mailto:mriedem@linux.vnet.ibm.com" target="_blank">mriedem@linux.vnet.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><br>
<br>
On 2/22/2016 8:02 AM, Monty Taylor wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 02/21/2016 11:40 PM, Andrey Kurilin wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi!<br>
`novaclient.client.Client` entry-point supports almost the same<br>
arguments as `novaclient.v2.client.Client`. The difference is only in<br>
api_version, so you can set up region via `novaclient.client.Client` in<br>
the same way as `novaclient.v2.client.Client`.<br>
</blockquote>
<br>
The easiest way to get a properly constructed nova Client is with<br>
os-client-config:<br>
<br>
import os_client_config<br>
<br>
OS_PROJECT_NAME="d8af8a8f-a573-48e6-898a-af333b970a2d"<br>
OS_USERNAME="0b8c435b-cc4d-4e05-8a47-a2ada0539af1"<br>
OS_PASSWORD="REDACTED"<br>
OS_AUTH_URL="<a href="http://auth.vexxhost.net" rel="noreferrer" target="_blank">http://auth.vexxhost.net</a>"<br>
OS_REGION_NAME="ca-ymq-1"<br>
<br>
client = os_client_config.make_client(<br>
     'compute',<br>
     auth_url=OS_AUTH_URL, username=OS_USERNAME,<br>
     password=OS_PASSWORD, project_name=OS_PROJECT_NAME,<br>
     region_name=OS_REGION_NAME)<br>
<br>
The upside is that the constructor interface is the same for all of the<br>
rest of the client libs too (just change the first argument) - and it<br>
will also read in OS_ env vars or named clouds from clouds.yaml if you<br>
have them set.<br>
<br>
(The 'simplest' way is to put your auth and region information into a<br>
clouds.yaml file like this:<br>
<br>
<a href="http://docs.openstack.org/developer/os-client-config/#site-specific-file-locations" rel="noreferrer" target="_blank">http://docs.openstack.org/developer/os-client-config/#site-specific-file-locations</a><br>
<br>
<br>
Such as:<br>
<br>
# ~/.config/openstack/clouds.yaml<br>
clouds:<br>
   vexxhost:<br>
      profile: vexxhost<br>
      auth:<br>
        project_name: d8af8a8f-a573-48e6-898a-af333b970a2d<br>
        username: 0b8c435b-cc4d-4e05-8a47-a2ada0539af1<br>
        password: REDACTED<br>
      region_name: ca-ymq-1<br>
<br>
<br>
And do:<br>
<br>
client = os_client_config.make_client('compute', cloud='vexxhost')<br>
<br>
<br>
If you don't want to do that for some reason but you'd like to construct<br>
a novaclient Client object by hand:<br>
<br>
<br>
from keystoneauth1 import loading<br>
from keystoneauth1 import session as ksa_session<br>
from novaclient import client as nova_client<br>
<br>
OS_PROJECT_NAME="d8af8a8f-a573-48e6-898a-af333b970a2d"<br>
OS_USERNAME="0b8c435b-cc4d-4e05-8a47-a2ada0539af1"<br>
OS_PASSWORD="REDACTED"<br>
OS_AUTH_URL="<a href="http://auth.vexxhost.net" rel="noreferrer" target="_blank">http://auth.vexxhost.net</a>"<br>
OS_REGION_NAME="ca-ymq-1"<br>
<br>
# Get the auth loader for the password auth plugin<br>
loader = loading.get_plugin_loader('password')<br>
# Construct the auth plugin<br>
auth_plugin = loader.load_from_options(<br>
     auth_url=OS_AUTH_URL, username=OS_USERNAME, password=OS_PASSWORD,<br>
     project_name=OS_PROJECT_NAME)<br>
<br>
# Construct a keystone session<br>
# Other arguments that are potentially useful here are:<br>
#  verify - bool, whether or not to verify SSL connection validity<br>
#  cert - SSL cert information<br>
#  timout - time in seconds to use for connection level TCP timeouts<br>
session = ksa_session.Session(auth_plugin)<br>
<br>
# Now make the client<br>
# Other arguments you may be interested in:<br>
#  service_name - if you need to specify a service name for finding the<br>
#                 right service in the catalog<br>
#  service_type - if the cloud in question has given a different<br>
#                 service type (should be 'compute' for nova - but<br>
#                 novaclient sets it, so it's safe to omit in most cases<br>
#  endpoint_override - if you want to tell it to use a different URL<br>
#                      than what the keystone catalog returns<br>
#  endpoint_type - if you need to specify admin or internal<br>
#                  endpoints rather than the default 'public'<br>
#                  Note that in glance and barbican, this key is called<br>
#                  'interface'<br>
client = nova_client.Client(<br>
     version='2.0', # or set the specific microversion you want<br>
     session=session, region_name=OS_REGION_NAME)<br>
<br>
It might be clear why I prefer the os_client_config factory function<br>
instead - but what I prefer and what you prefer might not be the same<br>
thing. :)<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Mon, Feb 22, 2016 at 6:11 AM, Xav Paice <<a href="mailto:xavpaice@gmail.com" target="_blank">xavpaice@gmail.com</a><br>
<mailto:<a href="mailto:xavpaice@gmail.com" target="_blank">xavpaice@gmail.com</a>>> wrote:<br>
<br>
    Hi,<br>
<br>
    In <a href="http://docs.openstack.org/developer/python-novaclient/api.html" rel="noreferrer" target="_blank">http://docs.openstack.org/developer/python-novaclient/api.html</a><br>
    it's got some pretty clear instructions not to<br>
    use novaclient.v2.client.Client but I can't see another way to<br>
    specify the region - there's more than one in my installation, and<br>
    no param for region in novaclient.client.Client<br>
<br>
    Shall I hunt down/write a blueprint for that?<br>
<br>
<br>
__________________________________________________________________________<br>
<br>
    OpenStack Development Mailing List (not for usage questions)<br>
    Unsubscribe:<br>
    <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<br>
<<a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a>><br>
    <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br>
<br>
<br>
<br>
--<br>
Best regards,<br>
Andrey Kurilin.<br>
<br>
<br>
__________________________________________________________________________<br>
<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe:<br>
<a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br>
</blockquote>
<br>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br>
</blockquote>
<br></div></div>
<cough> would be good to capture this in the docs for novaclient so we could just link to it </cough><br>
<br>
:)<span><font color="#888888"><br>
<br>
-- <br>
<br>
Thanks,<br>
<br>
Matt Riedemann</font></span><div><div><br>
<br>
<br>
__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
</div></div></blockquote></div><br></div>
</div></div><br>__________________________________________________________________________<br>
OpenStack Development Mailing List (not for usage questions)<br>
Unsubscribe: <a href="http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe" rel="noreferrer" target="_blank">OpenStack-dev-request@lists.openstack.org?subject:unsubscribe</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">Best regards,<br>Andrey Kurilin.<br></div></div>
</div>