Browse Source

Support custom config files in admin utilities

The admin utilities usually run with the default config files:
/etc/neutron/neutron.conf and /etc/neutron/plugins/vmware/nsx.ini

In order to run it with custom files you can use:
nsxadmin --config-file <neutron conf path> --config-file <nsx conf path>

Change-Id: I0c75f0a616d8016a840611edab1e3b3edb53c4ad
changes/56/736956/1
asarfaty 2 weeks ago
committed by Adit Sarfaty
parent
commit
645e66121a
2 changed files with 18 additions and 8 deletions
  1. +4
    -1
      doc/source/admin_util.rst
  2. +14
    -7
      vmware_nsx/shell/nsxadmin.py

+ 4
- 1
doc/source/admin_util.rst View File

@@ -1,9 +1,12 @@
Admin Utility
=============

NSX-V and NSX-T support the nsxadmin utility. This enables and administrator to determine and rectify inconsistencies between the Neutron DB and NSX.
The VMWare NSX plugins support the nsxadmin utility. This enables and administrator to determine and rectify inconsistencies between the Neutron DB and NSX, in addition to performing different configuration changes and migrations.
usage: nsxadmin -r <resources> -o <operation>

In order to specify config files:
usage: nsxadmin --config-file <neutron config path> --config-file <nsx config path > -r <resources> -o <operation>

NSX-V Plugin
------------



+ 14
- 7
vmware_nsx/shell/nsxadmin.py View File

@@ -56,16 +56,23 @@ def _init_cfg():
# register must come after above unregister to avoid duplicates
cfg.CONF.register_cli_opts(resources.cli_opts)

# Init the neutron config
neutron_config.init(args=['--config-file', constants.NEUTRON_CONF,
'--config-file', constants.NSX_INI])

cfg.CONF(args=sys.argv[1:], project='NSX',
# Make sure the default config files are used if not specified in args
default_config_files = [constants.NEUTRON_CONF,
constants.NSX_INI]
config_args = sys.argv[1:]
if '--config-file' not in config_args:
# Add default config files
config_args = []
for file in default_config_files:
config_args.extend(['--config-file', file])

# Init the CONF and neutron config (Used by the core plugin)
neutron_config.init(args=config_args)
cfg.CONF(args=config_args, project='NSX',
prog='Admin Utility',
version=version.__version__,
usage='nsxadmin -r <resources> -o <operation>',
default_config_files=[constants.NEUTRON_CONF,
constants.NSX_INI])
default_config_files=default_config_files)


def _validate_resource_choice(resource, nsx_plugin):


Loading…
Cancel
Save