diff --git a/doc/source/admin_util.rst b/doc/source/admin_util.rst index 64c17e5580..d82cfc8402 100644 --- a/doc/source/admin_util.rst +++ b/doc/source/admin_util.rst @@ -544,6 +544,12 @@ Rate Limit nsxadmin -r rate-limit -o nsx-update --property value=<> +Cluster +~~~~~~~ + +- Show the NSX cluster managers ips: + + nsxadmin -r cluster -o show Config ~~~~~~ diff --git a/vmware_nsx/shell/admin/plugins/common/constants.py b/vmware_nsx/shell/admin/plugins/common/constants.py index f8f224cb0f..20423c673e 100644 --- a/vmware_nsx/shell/admin/plugins/common/constants.py +++ b/vmware_nsx/shell/admin/plugins/common/constants.py @@ -45,6 +45,7 @@ LB_VIRTUAL_SERVERS = 'lb-virtual-servers' LB_POOLS = 'lb-pools' LB_MONITORS = 'lb-monitors' RATE_LIMIT = 'rate-limit' +CLUSTER = 'cluster' ORPHANED_FIREWALL_SECTIONS = 'orphaned-firewall-sections' # NSXV only Resource Constants diff --git a/vmware_nsx/shell/admin/plugins/nsxv3/resources/cluster.py b/vmware_nsx/shell/admin/plugins/nsxv3/resources/cluster.py new file mode 100644 index 0000000000..e1081b1b40 --- /dev/null +++ b/vmware_nsx/shell/admin/plugins/nsxv3/resources/cluster.py @@ -0,0 +1,39 @@ +# Copyright 2018 VMware, Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from neutron_lib.callbacks import registry +from oslo_log import log as logging + +from vmware_nsx.shell.admin.plugins.common import constants +from vmware_nsx.shell.admin.plugins.common import utils as admin_utils +from vmware_nsx.shell.admin.plugins.nsxv3.resources import utils +from vmware_nsx.shell import resources as shell + +LOG = logging.getLogger(__name__) + + +@admin_utils.output_header +def find_cluster_managers_ips(resource, event, trigger, **kwargs): + """Show the current NSX rate limit.""" + + nsxlib = utils.get_connected_nsxlib() + manager_ips = nsxlib.cluster_nodes.get_managers_ips() + LOG.info("NSX Cluster has %s manager nodes:", len(manager_ips)) + for ip in manager_ips: + LOG.info("%s", str(ip)) + + +registry.subscribe(find_cluster_managers_ips, + constants.CLUSTER, + shell.Operations.SHOW.value) diff --git a/vmware_nsx/shell/resources.py b/vmware_nsx/shell/resources.py index efefb1adde..26c38d245d 100644 --- a/vmware_nsx/shell/resources.py +++ b/vmware_nsx/shell/resources.py @@ -141,7 +141,9 @@ nsxv3_resources = { [Operations.LIST.value]), constants.RATE_LIMIT: Resource(constants.RATE_LIMIT, [Operations.SHOW.value, - Operations.NSX_UPDATE.value]) + Operations.NSX_UPDATE.value]), + constants.CLUSTER: Resource(constants.CLUSTER, + [Operations.SHOW.value]) } # Add supported NSX-V resources in this dictionary