Exemple #1
0
    def get_host_config(self, host):
        ceph_backend = StorageBackendConfig.get_backend_conf(
            self.dbapi, constants.CINDER_BACKEND_CEPH)
        if not ceph_backend:
            return {}  # ceph is not configured

        config = {}
        if host.personality in [constants.CONTROLLER, constants.STORAGE]:
            config.update(self._get_ceph_osd_config(host))
        config.update(self._get_ceph_mon_config(host))
        return config
Exemple #2
0
    def get_system_config(self):
        ceph_rook_backend = StorageBackendConfig.get_backend_conf(
            self.dbapi, constants.SB_TYPE_CEPH_ROOK)

        enable = False
        if ceph_rook_backend:
            enable = True

        config = {
            'platform::rook::params::service_enabled': enable,
        }
        return config
Exemple #3
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
Exemple #4
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)

        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['ceph-mon-0-ip']
        mon_1_ip = ceph_mon_ips['ceph-mon-1-ip']
        mon_2_ip = ceph_mon_ips.get('ceph-mon-2-ip', None)
        floating_mon_ip = ceph_mon_ips['ceph-floating-mon-ip']

        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)

        ksuser = self._get_service_user_name(self.SERVICE_NAME_RGW)

        return {
            '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_admin_user':
                ksuser,
            'platform::ceph::params::rgw_admin_domain':
                self._get_service_user_domain_name(),
            'platform::ceph::params::rgw_admin_project':
                self._get_service_tenant_name(),

            'platform::ceph::rgw::keystone::auth::auth_name':
                ksuser,
            'platform::ceph::rgw::keystone::auth::public_url':
                self._get_rgw_public_url(),
            'platform::ceph::rgw::keystone::auth::internal_url':
                self._get_rgw_internal_url(),
            'platform::ceph::rgw::keystone::auth::admin_url':
                self._get_rgw_admin_url(),
            'platform::ceph::rgw::keystone::auth::region':
                self._get_rgw_region_name(),
            'platform::ceph::rgw::keystone::auth::tenant':
                self._get_service_tenant_name(),
        }