Пример #1
0
    def _get_systemcontroller_config(self):
        config = {}
        if self._distributed_cloud_role() == \
                constants.DISTRIBUTED_CLOUD_ROLE_SUBCLOUD:
            # For regular DC, central-cloud's local registry is exposed on the OAM
            # interface (to provide the ability to push images externally to central
            # registry), so "registry.central" domain in dnsmasq.conf is set to system
            # controller's OAM IP on subcloud to allow subcloud to pull images from
            # central registry via the OAM interface.
            sc_network = self.dbapi.network_get_by_type(
                constants.NETWORK_TYPE_SYSTEM_CONTROLLER_OAM)
            sc_network_addr_pool = self.dbapi.address_pool_get(
                sc_network.pool_uuid)
            sc_addr = sc_network_addr_pool.floating_address
            config.update(
                {'platform::params::system_controller_addr': sc_addr})

            # For virtual subcloud (StarlingX running in Openstack Nova VM - QEMU/KVM),
            # there is no physical OAM interface (no external network access) to connect
            # to central-cloud's local registry, so central registry is exposed on the
            # MGMT interface and "registry.central" domain needs to be set to system
            # controller's MGMT IP to allow subcloud to pull images from central registry
            # via the MGMT interface.
            if utils.is_virtual_system_config(self.dbapi):
                sc_mgmt_network = self.dbapi.network_get_by_type(
                    constants.NETWORK_TYPE_SYSTEM_CONTROLLER)
                sc_mgmt_network_addr_pool = self.dbapi.address_pool_get(
                    sc_mgmt_network.pool_uuid)
                sc_mgmt_addr = sc_mgmt_network_addr_pool.floating_address
                config.update({
                    'platform::params::system_controller_mgmt_addr':
                    sc_mgmt_addr
                })
        return config
Пример #2
0
    def _get_host_platform_config(self, host, config_uuid):
        if not config_uuid:
            config_uuid = host.config_target

        # required parameters
        config = {
            'platform::params::hostname':
            host.hostname,
            'platform::params::software_version':
            self.quoted_str(host.software_load),
        }

        # optional parameters
        if config_uuid:
            config.update(
                {'platform::config::params::config_uuid': config_uuid})

        if host.personality == constants.CONTROLLER:

            controller0_address = self._get_address_by_name(
                constants.CONTROLLER_0_HOSTNAME, constants.NETWORK_TYPE_MGMT)

            controller1_address = self._get_address_by_name(
                constants.CONTROLLER_1_HOSTNAME, constants.NETWORK_TYPE_MGMT)

            if host.hostname == constants.CONTROLLER_0_HOSTNAME:
                mate_hostname = constants.CONTROLLER_1_HOSTNAME
                mate_address = controller1_address
            else:
                mate_hostname = constants.CONTROLLER_0_HOSTNAME
                mate_address = controller0_address

            config.update({
                'platform::params::controller_0_ipaddress':
                controller0_address.address,
                'platform::params::controller_1_ipaddress':
                controller1_address.address,
                'platform::params::controller_0_hostname':
                constants.CONTROLLER_0_HOSTNAME,
                'platform::params::controller_1_hostname':
                constants.CONTROLLER_1_HOSTNAME,
                'platform::params::mate_hostname':
                mate_hostname,
                'platform::params::mate_ipaddress':
                mate_address.address,
            })

        system = self._get_system()
        config.update({
            'platform::params::system_name': system.name,
            'platform::params::system_mode': system.system_mode,
            'platform::params::system_type': system.system_type,
        })

        virtual_system = utils.is_virtual_system_config(self.dbapi)
        config.update({'platform::params::virtual_system': virtual_system})

        cpu_count = self._get_platform_cpu_count(host)
        config.update({
            'platform::params::platform_cpu_count': cpu_count,
        })

        return config