python - Openstack - Nova client - Retrieve servers for particular tenant -
i need list of servers available particular tenant.
that consider tenant_id of tenant follows:
ee13ef5e10644f3782179bbfac1cdab5
now need server available particular tenant.
i have tried code follows:
i unable result.
it showing me empty list when tried same.
from novaclient import client import json kwargs = { "tenant_name":'admin', "auth_url":'http://127.0.0.1:5000/v2.0', "username":'admin', "password":'password', } # establish connection keystone keystone = client.client('2', 'admin', 'sop52maw', 'admin', 'http://127.0.0.1:5000/v2.0') server_list = keystone.servers.list(search_opts={'tenant_id':'ee13ef5e10644f3782179bbfac1cdab5'}) print server_list
someone have , guide me sort 1 out.
by default nova returns instances associated tenant makes call, , in case admin
tenant. inform nova return instances tenants can add search_opts
:
nova = client.client('2', 'admin', 'sop52maw', 'admin', 'http://127.0.0.1:5000/v2.0') search_opts = {'tenant_id':'ee13ef5e10644f3782179bbfac1cdab5', 'all_tenants': 1} server_list = nova.servers.list(search_opts=search_opts)
note: not sure why called nova client keystone
confused hell out of me. keystone identity service , talking compute service (nova).
Comments
Post a Comment