NSX|P: Add control over realization interval
Admin util can set realization and purge cycle interval on policy appliance Depends-on: Ie60e3a04980ae9d6a747f80497168e923f119824 Change-Id: I91be76d8cd2741ec36f5f80529cd295a3ee6addb
This commit is contained in:
parent
d37be7b5c2
commit
e7914520ba
@ -619,6 +619,10 @@ NSX Policy Plugin
|
||||
|
||||
nsxadmin -r routers -o list
|
||||
|
||||
- Set intent realization and purge cycle interval (in minutes) on policy manager::
|
||||
|
||||
nsxadmin -r system -o set -p realization_interval=1
|
||||
|
||||
|
||||
Client Certificate
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
|
@ -36,6 +36,7 @@ SECURITY_GROUPS = 'security-groups'
|
||||
CONFIG = 'config'
|
||||
ORPHANED_NETWORKS = 'orphaned-networks'
|
||||
ORPHANED_ROUTERS = 'orphaned-routers'
|
||||
SYSTEM = 'system'
|
||||
|
||||
# NSXV3 only Resource Constants
|
||||
PORTS = 'ports'
|
||||
|
60
vmware_nsx/shell/admin/plugins/nsxp/resources/system.py
Normal file
60
vmware_nsx/shell/admin/plugins/nsxp/resources/system.py
Normal file
@ -0,0 +1,60 @@
|
||||
# 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 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.nsxp.resources import utils as p_utils
|
||||
from vmware_nsx.shell import resources as shell
|
||||
|
||||
from neutron_lib.callbacks import registry
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
MIN_REALIZATION_INTERVAL = 1
|
||||
MAX_REALIZATION_INTERVAL = 10
|
||||
|
||||
|
||||
def set_system_parameters(resource, event, trigger, **kwargs):
|
||||
"""Set interval that controls realization and purge frequency
|
||||
|
||||
This setting is affecting NSX Policy Manager appliance.
|
||||
"""
|
||||
if kwargs.get('property'):
|
||||
properties = admin_utils.parse_multi_keyval_opt(kwargs['property'])
|
||||
interval = properties.get('realization_interval')
|
||||
|
||||
if interval:
|
||||
int_interval = int(interval)
|
||||
if int_interval not in range(MIN_REALIZATION_INTERVAL,
|
||||
MAX_REALIZATION_INTERVAL + 1):
|
||||
LOG.info("Realization interval should be in range %d-%d",
|
||||
MIN_REALIZATION_INTERVAL, MAX_REALIZATION_INTERVAL)
|
||||
return
|
||||
|
||||
nsxpolicy = p_utils.get_connected_nsxpolicy()
|
||||
try:
|
||||
nsxpolicy.set_realization_interval(int_interval)
|
||||
except Exception as ex:
|
||||
LOG.error("Failed to apply intent realization interval to "
|
||||
"policy appliance - %s", ex)
|
||||
|
||||
LOG.info("Intent realization interval set to %s min" % interval)
|
||||
|
||||
|
||||
registry.subscribe(set_system_parameters,
|
||||
constants.SYSTEM,
|
||||
shell.Operations.SET.value)
|
@ -32,6 +32,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
class Operations(enum.Enum):
|
||||
LIST = 'list'
|
||||
SET = 'set'
|
||||
CLEAN = 'clean'
|
||||
CLEAN_ALL = 'clean-all'
|
||||
CREATE = 'create'
|
||||
@ -263,6 +264,8 @@ nsxp_resources = {
|
||||
Operations.CLEAN.value,
|
||||
Operations.IMPORT.value,
|
||||
Operations.NSX_LIST.value]),
|
||||
constants.SYSTEM: Resource(constants.SYSTEM,
|
||||
[Operations.SET.value]),
|
||||
}
|
||||
|
||||
nsxv3_resources_names = list(nsxv3_resources.keys())
|
||||
|
Loading…
Reference in New Issue
Block a user