Merge "TVD|AdminUtils: Add all nsxv/v3 utils to tvd"
This commit is contained in:
commit
ea075df213
@ -485,7 +485,12 @@ nsxadmin -r rate-limit -o nsx-update --property value=<>
|
|||||||
NSXtvd
|
NSXtvd
|
||||||
------
|
------
|
||||||
|
|
||||||
|
- All the nsx-v/v3 utilities can be used by calling
|
||||||
|
|
||||||
|
nsxadmin --plugin nsxv/v3 -r <> -o <>
|
||||||
|
|
||||||
- Add mapping between projects and plugin before starting to use the tvd plugin:
|
- Add mapping between projects and plugin before starting to use the tvd plugin:
|
||||||
|
|
||||||
nsxadmin -r projects -o import --property plugin=nsx-v --property project=<>
|
nsxadmin -r projects -o import --property plugin=nsx-v --property project=<>
|
||||||
|
|
||||||
Config
|
Config
|
||||||
|
@ -110,16 +110,41 @@ def _validate_op_choice(choice, nsx_plugin):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
def _validate_plugin_choice(selected_plugin, nsx_plugin):
|
||||||
|
if nsx_plugin == 'nsxtvd':
|
||||||
|
if selected_plugin:
|
||||||
|
if selected_plugin != 'nsxv' and selected_plugin != 'nsxv3':
|
||||||
|
LOG.error('Illegal plugin %s. please select nsxv or nsxv3',
|
||||||
|
selected_plugin)
|
||||||
|
sys.exit(1)
|
||||||
|
# use nsxv or nsxv3 plugins
|
||||||
|
return selected_plugin
|
||||||
|
else:
|
||||||
|
# use the TVD pluging
|
||||||
|
return nsx_plugin
|
||||||
|
else:
|
||||||
|
if selected_plugin:
|
||||||
|
LOG.error('Cannot select plugin. The current plugin is %s',
|
||||||
|
nsx_plugin)
|
||||||
|
sys.exit(1)
|
||||||
|
return nsx_plugin
|
||||||
|
|
||||||
|
|
||||||
def main(argv=sys.argv[1:]):
|
def main(argv=sys.argv[1:]):
|
||||||
_init_cfg()
|
_init_cfg()
|
||||||
nsx_plugin_in_use = resources.get_plugin()
|
nsx_plugin_in_use = resources.get_plugin()
|
||||||
resources.init_resource_plugin(
|
|
||||||
nsx_plugin_in_use,
|
|
||||||
resources.get_plugin_dir(nsx_plugin_in_use))
|
|
||||||
LOG.info('NSX Plugin in use: %s', nsx_plugin_in_use)
|
LOG.info('NSX Plugin in use: %s', nsx_plugin_in_use)
|
||||||
|
|
||||||
_validate_resource_choice(cfg.CONF.resource, nsx_plugin_in_use)
|
# the user can select the specific plugin
|
||||||
_validate_op_choice(cfg.CONF.operation, nsx_plugin_in_use)
|
selected_plugin = _validate_plugin_choice(cfg.CONF.plugin,
|
||||||
|
nsx_plugin_in_use)
|
||||||
|
|
||||||
|
resources.init_resource_plugin(
|
||||||
|
selected_plugin,
|
||||||
|
resources.get_plugin_dir(selected_plugin))
|
||||||
|
|
||||||
|
_validate_resource_choice(cfg.CONF.resource, selected_plugin)
|
||||||
|
_validate_op_choice(cfg.CONF.operation, selected_plugin)
|
||||||
|
|
||||||
registry.notify(cfg.CONF.resource, cfg.CONF.operation, 'nsxadmin',
|
registry.notify(cfg.CONF.resource, cfg.CONF.operation, 'nsxadmin',
|
||||||
force=cfg.CONF.force, property=cfg.CONF.property,
|
force=cfg.CONF.force, property=cfg.CONF.property,
|
||||||
|
@ -274,6 +274,8 @@ cli_opts = [cfg.StrOpt('fmt',
|
|||||||
short='o',
|
short='o',
|
||||||
help='Supported list of operations: {}'
|
help='Supported list of operations: {}'
|
||||||
.format(', '.join(ops))),
|
.format(', '.join(ops))),
|
||||||
|
cfg.StrOpt('plugin',
|
||||||
|
help='nsxv or nsxv3 if the tvd plugin is used'),
|
||||||
cfg.BoolOpt('force',
|
cfg.BoolOpt('force',
|
||||||
default=False,
|
default=False,
|
||||||
help='Enables \'force\' mode. No confirmations will '
|
help='Enables \'force\' mode. No confirmations will '
|
||||||
|
Loading…
Reference in New Issue
Block a user