[Openstack] retrieve all instances whatever tenant/user via python	SDK
    Tobias Urdin 
    tobias.urdin at crystone.com
       
    Thu Jun  9 11:37:16 UTC 2016
    
    
  
Hello,
Auth using the admin user then list all instances in all tenants, should be something like:
client.servers.list(search_opts={'all_tenants': 1})
You should search, there is a lot of resources online that could help you out.
For example if you would have searched: https://ask.openstack.org/en/question/50087/list-all-servers-with-python-nova-client/
Best regards
On 06/08/2016 03:29 PM, Jean-Pierre Ribeauville wrote:
Hi all,
By running this piece if code :
.........
def get_nova_credentials_v2():
    d = {}
    d['version'] = '2'
    d['username'] = os.environ['OS_USERNAME']
    d['api_key'] = os.environ['OS_PASSWORD']
    d['auth_url'] = os.environ['OS_AUTH_URL']
    d['project_id'] = os.environ['OS_TENANT_NAME']
    return d
credentials = get_nova_credentials_v2()
nova_client = Client(**credentials)
print(nova_client.servers.list())
......
I'm able to retrieve the instances list when specifying the tenant and username to whom the instances < belong >.
As I want to retrieve all instances , I tried to use admin as tenant and user , then no instance are found ( all my instances are under "demo").
Via Horizon , all instances are retrievable under admin .
Did I miss something  ?
Thx for help.
Regards,
Jean-Pierre RIBEAUVILLE
+33 1 4717 2049
[axway_logo_tagline_87px]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20160609/d11bacfa/attachment.html>
    
    
More information about the Openstack
mailing list