[sdk][ansible][inventory] Server-side filtering capability for nova API
Игорь Тиунов
igortiunov at gmail.com
Mon Apr 8 09:04:11 UTC 2019
Hi.
I saw that there some work regarding filtering in the inventory module. Also, I looked at how it will be used in future versions of ansible (os_server_facts module).
I am worried about client-side nature of this filtering. The large deployments can have thousands of vms in one openstack project and such an environment can be very dynamic (vms are created/deleted frequently). The inventory collection can be done from multiple ansible management nodes and all these facts can lead to significant performance impact not only on the client side but on the server side also - a large amount of data will be requested from nova api servers.
I want to propose the usage of server-side filtering capability for nova API:
https://developer.openstack.org/api-ref/compute/?expanded=list-servers-detail#list-servers
These filters are used at database level and will add a significant performance boost during inventory collection.
I want to propose the usage of filters in ansible openstack inventory plugin but first, such filters should be implemented in openstacksdk level.
I suggest splitting filters into two parts - the api_filters and metadata_filters. The api_filters will be used for server-side filtering and metadata_filters for client-side filtering.
I have created the snippet with prototype code. There a _split_filters method and related changes for list_hosts and search_hosts methods:
https://gist.github.com/ITD27M01/01bc73120bb97b237f53fa418dc83629
What do you think?
More information about the openstack-discuss
mailing list