Пример #1
0
    def get_overrides(self, namespace=None):
        overrides = {
            common.HELM_NS_OPENSTACK: {
                'pod': {
                    'replicas': {
                        'server': self._num_server_replicas(),
                        'ingress': self._num_controllers()
                    }
                },
                'endpoints': self._get_endpoints_overrides(),
                'manifests': {
                    'config_ipv6': self._is_ipv6_cluster_service()
                }
            }
        }

        if not cutils.is_std_system(self.dbapi):
            config_override = {'conf': {'database': {'config_override': ''}}}
            overrides[common.HELM_NS_OPENSTACK].update(config_override)

        if namespace in self.SUPPORTED_NAMESPACES:
            return overrides[namespace]
        elif namespace:
            raise exception.InvalidHelmNamespace(chart=self.CHART,
                                                 namespace=namespace)
        else:
            return overrides
Пример #2
0
    def get_system_config(self):
        ceph_backend = StorageBackendConfig.get_backend_conf(
            self.dbapi, constants.CINDER_BACKEND_CEPH)
        if not ceph_backend:
            return {}  # ceph is not configured

        ceph_mon_ips = StorageBackendConfig.get_ceph_mon_ip_addresses(
            self.dbapi)

        if not ceph_mon_ips:
            return {}  # system configuration is not yet ready

        controller_hosts = [
            constants.CONTROLLER_0_HOSTNAME, constants.CONTROLLER_1_HOSTNAME
        ]
        mon_2_host = [
            mon['hostname'] for mon in self.dbapi.ceph_mon_get_list()
            if mon['hostname'] not in controller_hosts
        ]
        if len(mon_2_host) > 1:
            raise exception.SysinvException(
                'Too many ceph monitor hosts, expected 1, got: %s.' %
                mon_2_host)
        if mon_2_host:
            mon_2_host = mon_2_host[0]
        else:
            mon_2_host = None

        mon_0_ip = ceph_mon_ips[constants.CEPH_MON_0]
        mon_1_ip = ceph_mon_ips[constants.CEPH_MON_1]
        mon_2_ip = ceph_mon_ips.get(constants.CEPH_MON_2, None)
        floating_mon_ip = ceph_mon_ips[constants.CEPH_FLOATING_MON]

        mon_0_addr = self._format_ceph_mon_address(mon_0_ip)
        mon_1_addr = self._format_ceph_mon_address(mon_1_ip)
        if mon_2_ip:
            mon_2_addr = self._format_ceph_mon_address(mon_2_ip)
        else:
            mon_2_addr = None
        floating_mon_addr = self._format_ceph_mon_address(floating_mon_ip)

        # ceph can not bind to multiple address families, so only enable IPv6
        # if the monitors are IPv6 addresses
        ms_bind_ipv6 = (
            netaddr.IPAddress(mon_0_ip).version == constants.IPV6_FAMILY)

        skip_osds_during_restore = \
            (utils.is_std_system(self.dbapi) and
            ceph_backend.task == constants.SB_TASK_RESTORE)

        is_sx_to_dx_migration = self._get_system_capability(
            'simplex_to_duplex_migration')

        config = {
            'ceph::ms_bind_ipv6':
            ms_bind_ipv6,
            'platform::ceph::params::service_enabled':
            True,
            'platform::ceph::params::floating_mon_host':
            constants.CONTROLLER_HOSTNAME,
            'platform::ceph::params::mon_0_host':
            constants.CONTROLLER_0_HOSTNAME,
            'platform::ceph::params::mon_1_host':
            constants.CONTROLLER_1_HOSTNAME,
            'platform::ceph::params::mon_2_host':
            mon_2_host,
            'platform::ceph::params::floating_mon_ip':
            floating_mon_ip,
            'platform::ceph::params::mon_0_ip':
            mon_0_ip,
            'platform::ceph::params::mon_1_ip':
            mon_1_ip,
            'platform::ceph::params::mon_2_ip':
            mon_2_ip,
            'platform::ceph::params::floating_mon_addr':
            floating_mon_addr,
            'platform::ceph::params::mon_0_addr':
            mon_0_addr,
            'platform::ceph::params::mon_1_addr':
            mon_1_addr,
            'platform::ceph::params::mon_2_addr':
            mon_2_addr,
            'platform::ceph::params::rgw_enabled':
            self._is_radosgw_enabled(),
            'platform::ceph::rgw::keystone::swift_endpts_enabled':
            False,
            'platform::ceph::rgw::keystone::rgw_admin_user':
            self._get_service_user_name(self.SERVICE_NAME_RGW),
            'platform::ceph::rgw::keystone::rgw_admin_password':
            self._get_service_password(self.SERVICE_NAME_RGW),
            'platform::ceph::rgw::keystone::rgw_admin_domain':
            self._get_service_user_domain_name(),
            'platform::ceph::rgw::keystone::rgw_admin_project':
            self._get_service_tenant_name(),
            'platform::ceph::params::skip_osds_during_restore':
            skip_osds_during_restore,
            'platform::ceph::params::simplex_to_duplex_migration':
            bool(is_sx_to_dx_migration),
        }

        if is_sx_to_dx_migration:
            cephfs_filesystems = self._get_cephfs_filesystems()
            if cephfs_filesystems:
                config[
                    'platform::ceph::params::cephfs_filesystems'] = cephfs_filesystems

        if (utils.is_openstack_applied(self.dbapi) and utils.is_chart_enabled(
                self.dbapi, constants.HELM_APP_OPENSTACK,
                self.HELM_CHART_SWIFT, common.HELM_NS_OPENSTACK)):
            app = self.dbapi.kube_app_get(constants.HELM_APP_OPENSTACK)
            override = self.dbapi.helm_override_get(app.id,
                                                    self.SERVICE_NAME_RGW,
                                                    common.HELM_NS_OPENSTACK)
            password = override.system_overrides.get(self.SERVICE_NAME_RGW,
                                                     None)
            if password:
                swift_auth_password = password.encode('utf8', 'strict')
                config.update({
                    'platform::ceph::rgw::keystone::swift_endpts_enabled':
                    True
                })
                config.pop('platform::ceph::rgw::keystone::rgw_admin_user')
                config.update({
                    'platform::ceph::rgw::keystone::rgw_admin_password':
                    swift_auth_password
                })
                config.update({
                    'platform::ceph::rgw::keystone::rgw_admin_domain':
                    self.RADOSGW_SERVICE_DOMAIN_NAME
                })
                config.update({
                    'platform::ceph::rgw::keystone::rgw_admin_project':
                    self.RADOSGW_SERVICE_PROJECT_NAME
                })
            else:
                raise exception.SysinvException(
                    "Unable to retreive containerized swift auth password")

        return config