On Sun, Oct 16, 2016 at 9:11 PM, Adrian Turjak <adri...@catalyst.net.nz>
> The problem I'm running into is for some of our custom plugins we
> require the commands to run in all regions. We do this by getting the
> region list from keystone, and then doing the command in each region.
> Is there a way to explicitly reinitialise the client_manager?
> 'client_mananger.reinitialise()' or something as easy? Maybe even a
> clear cache command?
There is not a way to re-init the ClientManager, and really, you don't want
to do that, but you do want a new compute client for each region. OSC sets
up the ClientManager client attributes with descriptors in
common/clientmanager.py get_plugin_modules(). At this point we do not have
any region information, so to do that you would have to do it later, but it
is simple enough to return whatever you want from your plugin's
make_client(). Normally that will be a client object for the desired API,
for your plugin it could be a dict of client objects keyed off
region_name. Then your consuming code would need to deref those with:
for region in regions:
nova_client = self.app.client_manager.compute[region]
> While explicitly initialising clients isn't exactly difficult, it is
> something that would make more sense to simply work in the base
> openstackclient code as multi-region commands can and will be useful for
> a lot of people.
Generalizing this to all of the existing plugins would be an enormous
change, but doable. We would need to think hard about how many of these
things we need to handle, not just region, but cell or whatever else may be
out there that a command would want to iterate on.
> Not to mention adding multi-region support to some commands so you don't
> have to change OS_REGION_NAME or your region in clouds.yaml could be
> very useful. A command to list your instances across all regions could
> be quite useful and easy to do.
It would, and would be near-trivial to do in a plugin with the clients
initialized as I showed above. Note that we currently can not reliably
hook existing commands to extend them, for example to support a 'server
create' that uses --ram, --vcpu and --disk in place of --flavor. That will
be discussed next week in BCN.
OpenStack Development Mailing List (not for usage questions)