diff --git a/configutilities/configutilities/configutilities/common/configobjects.py b/configutilities/configutilities/configutilities/common/configobjects.py index 223cda887e..7f9a0d99f7 100755 --- a/configutilities/configutilities/configutilities/common/configobjects.py +++ b/configutilities/configutilities/configutilities/common/configobjects.py @@ -123,6 +123,7 @@ class Network(object): self.multicast_cidr = None self.start_address = None self.end_address = None + self.start_end_in_config = False self.floating_address = None self.address_0 = None self.address_1 = None @@ -312,6 +313,7 @@ class Network(object): raise ConfigFail("Address range for %s must contain at " "least %d addresses." % (network_name, min_addresses)) + self.start_end_in_config = True if floating_address_str or address_0_str or address_1_str: if not floating_address_str: diff --git a/configutilities/configutilities/configutilities/common/validator.py b/configutilities/configutilities/configutilities/common/validator.py index e38b44f5a1..4536b8d455 100755 --- a/configutilities/configutilities/configutilities/common/validator.py +++ b/configutilities/configutilities/configutilities/common/validator.py @@ -4,10 +4,10 @@ Copyright (c) 2015-2017 Wind River Systems, Inc. SPDX-License-Identifier: Apache-2.0 """ - from configobjects import DEFAULT_NAMES, NETWORK_PREFIX_NAMES, OAM_TYPE, \ MGMT_TYPE, Network, REGION_CONFIG, VALID_LINK_SPEED, INFRA_TYPE, \ DEFAULT_DOMAIN_NAME, HP_NAMES, SUBCLOUD_CONFIG +from netaddr import IPRange from utils import lag_mode_to_str, validate_network_str, \ check_network_overlap, is_mtu_valid, is_speed_valid, get_service, \ get_optional @@ -382,6 +382,33 @@ class ConfigValidator(object): "network" % (mgmt_prefix, str(self.mgmt_network.cidr))) + if (self.system_dc_role == + DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER): + # For Distributed Cloud SystemController, we require the setting + # of the IP_START_ADDRESS/IP_END_ADDRESS config settings so as to + # raise awareness that some space in MGMT subnet must be set aside + # for gateways to reach subclouds. + + if not self.mgmt_network.start_end_in_config: + raise ConfigFail("IP_START_ADDRESS and IP_END_ADDRESS required" + " for %s network as this configuration " + "requires address space left for gateway " + "address(es)" % mgmt_prefix) + else: + # Warn user that some space in the management subnet must + # be reserved for the system controller gateway address(es) + # used to communicate with the subclouds. - 2 because of + # subnet and broadcast addresses. + address_range = \ + IPRange(str(self.mgmt_network.start_address), + str(self.mgmt_network.end_address)).size + + if address_range >= (self.mgmt_network.cidr.size - 2): + raise ConfigFail( + "Address range for %s network too large, no addresses" + " left for gateway(s), required in this " + "configuration." % mgmt_prefix) + if self.mgmt_network.logical_interface.lag_interface: supported_lag_mode = [1, 4] if (self.mgmt_network.logical_interface.lag_mode not in diff --git a/controllerconfig/controllerconfig/controllerconfig/configassistant.py b/controllerconfig/controllerconfig/controllerconfig/configassistant.py index 2bd5d27058..728afcf777 100644 --- a/controllerconfig/controllerconfig/controllerconfig/configassistant.py +++ b/controllerconfig/controllerconfig/controllerconfig/configassistant.py @@ -1116,22 +1116,31 @@ class ConfigAssistant(): except ValidateFail as e: print "{}".format(e) - while True: - user_input = raw_input( - "Use entire management subnet [Y/n]: ") - if user_input.lower() == 'q': - raise UserQuit - elif user_input.lower() == 'y': - self.use_entire_mgmt_subnet = True - break - elif user_input.lower() == 'n': - self.use_entire_mgmt_subnet = False - break - elif user_input == "": - break - else: - print "Invalid choice" - continue + if (self.system_dc_role != + sysinv_constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER): + while True: + user_input = raw_input( + "Use entire management subnet [Y/n]: ") + if user_input.lower() == 'q': + raise UserQuit + elif user_input.lower() == 'y': + self.use_entire_mgmt_subnet = True + break + elif user_input.lower() == 'n': + self.use_entire_mgmt_subnet = False + break + elif user_input == "": + break + else: + print "Invalid choice" + continue + else: + self.use_entire_mgmt_subnet = False + print textwrap.fill( + "Configured as Distributed Cloud System Controller," + " disallowing use of entire management subnet. " + "Ensure management ip range does not include System" + " Controller gateway address(es)", 80) if not self.use_entire_mgmt_subnet: while True: @@ -1183,8 +1192,19 @@ class ConfigAssistant(): "Address range must contain at least %d addresses. " % min_addresses) continue - break + sc = sysinv_constants.DISTRIBUTED_CLOUD_ROLE_SYSTEMCONTROLLER + if (self.system_dc_role == sc): + # Warn user that some space in the management subnet must + # be reserved for the system controller gateway address(es) + # used to communicate with the subclouds. - 2 because of + # subnet and broadcast addresses. + if address_range.size >= (self.management_subnet.size - 2): + print textwrap.fill( + "Address range too large, no addresses left " + "for System Controller gateway(s). ", 80) + continue + break while True: print print textwrap.fill(