diff --git a/defaults/test_default.yaml b/defaults/test_default.yaml index 283b5aeccf..9929ddfbf7 100644 --- a/defaults/test_default.yaml +++ b/defaults/test_default.yaml @@ -228,4 +228,6 @@ run_fullscan: [] stress_step_duration: '15m' simulated_racks: 0 +use_dns_names: false + use_placement_group: false diff --git a/functional_tests/scylla_operator/test_functional.py b/functional_tests/scylla_operator/test_functional.py index 13cb3947ac..98e7c29a37 100644 --- a/functional_tests/scylla_operator/test_functional.py +++ b/functional_tests/scylla_operator/test_functional.py @@ -819,8 +819,8 @@ def test_operator_managed_tls(db_cluster: ScyllaPodCluster, tmp_path: path.Path) db_cluster.nodes[0].refresh_ip_address() execution_profile = ExecutionProfile(load_balancing_policy=WhiteListRoundRobinPolicy([ - db_cluster.nodes[0].cql_ip_address])) - cluster = Cluster(contact_points=[db_cluster.nodes[0].cql_ip_address], port=db_cluster.nodes[0].CQL_SSL_PORT, + db_cluster.nodes[0].cql_address])) + cluster = Cluster(contact_points=[db_cluster.nodes[0].cql_address], port=db_cluster.nodes[0].CQL_SSL_PORT, execution_profiles={EXEC_PROFILE_DEFAULT: execution_profile}) ssl_context = ssl.SSLContext(protocol=ssl.PROTOCOL_SSLv23) ssl_context.verify_mode = ssl.VerifyMode.CERT_REQUIRED # pylint: disable=no-member diff --git a/longevity_test.py b/longevity_test.py index 5a7515a76b..145abff504 100644 --- a/longevity_test.py +++ b/longevity_test.py @@ -311,7 +311,7 @@ def _run_stress_in_batches(self, total_stress, batch_size, stress_cmd): @property def all_node_ips_for_stress_command(self): - return f' -node {",".join([n.cql_ip_address for n in self.db_cluster.nodes])}' + return f' -node {",".join([n.cql_address for n in self.db_cluster.nodes])}' @staticmethod def _get_columns_num_of_single_stress(single_stress_cmd): diff --git a/sdcm/cassandra_harry_thread.py b/sdcm/cassandra_harry_thread.py index 43972bd39f..a341962b9f 100644 --- a/sdcm/cassandra_harry_thread.py +++ b/sdcm/cassandra_harry_thread.py @@ -66,7 +66,7 @@ def __init__(self, *args, **kwargs): def _run_stress(self, loader, loader_idx, cpu_idx): # Select first seed node to send the scylla-harry cmds - ip = self.node_list[0].cql_ip_address + ip = self.node_list[0].cql_address if not os.path.exists(loader.logdir): os.makedirs(loader.logdir, exist_ok=True) diff --git a/sdcm/cluster.py b/sdcm/cluster.py index d85e57ab34..ada7e89e11 100644 --- a/sdcm/cluster.py +++ b/sdcm/cluster.py @@ -251,7 +251,7 @@ def __init__(self, name, parent_cluster, ssh_login_info=None, base_logdir=None, self.remoter: Optional[RemoteCmdRunnerBase] = None - self._use_dns_names: bool = parent_cluster.params.get('use_dns_names') or False + self._use_dns_names: bool = parent_cluster.params.get('use_dns_names') if parent_cluster else False self._spot_monitoring_thread = None self._journal_thread = None self._docker_log_process = None @@ -434,8 +434,9 @@ def proposed_scylla_yaml(self) -> ScyllaYaml: def refresh_ip_address(self): # Invalidate ip address cache self._private_ip_address_cached = self._public_ip_address_cached = self._ipv6_ip_address_cached = None - self.__dict__.pop('cql_ip_address', None) - + self.__dict__.pop('cql_address', None) + self.__dict__.pop('public_dns_name', None) + self.__dict__.pop('private_dns_name', None) if self.ssh_login_info["hostname"] == self.external_address: return @@ -861,7 +862,7 @@ def _refresh_instance_state(self): raise NotImplementedError() @cached_property - def cql_ip_address(self): + def cql_address(self): if self.test_config.IP_SSH_CONNECTIONS == 'public': return self.external_address with self.remote_scylla_yaml() as scylla_yaml: @@ -3386,7 +3387,7 @@ def get_node_public_ips(self): return [node.public_ip_address for node in self.nodes] def get_node_cql_ips(self): - return [node.cql_ip_address for node in self.nodes] + return [node.cql_address for node in self.nodes] def get_node_database_errors(self): errors = {} @@ -3533,7 +3534,7 @@ def host_filter(host): wlrr = HostFilterPolicy(child_policy=RoundRobinPolicy(), predicate=host_filter) node_ips = [] else: - node_ips = [node.cql_ip_address] + node_ips = [node.cql_address] wlrr = WhiteListRoundRobinPolicy(node_ips) return self._create_session(node=node, keyspace=keyspace, user=user, password=password, compression=compression, protocol_version=protocol_version, @@ -3932,19 +3933,19 @@ def set_seeds(self, wait_for_timeout=300, first_only=False): seeds_selector = self.params.get('seeds_selector') seeds_num = self.params.get('seeds_num') - seed_nodes_ips = None + seed_nodes_addresses = None if first_only: node = self.nodes[0] node.wait_ssh_up() - seed_nodes_ips = [node.ip_address] + seed_nodes_addresses = [node.scylla_listen_address] elif seeds_selector == "all": - seed_nodes_ips = [node.ip_address for node in self.nodes] + seed_nodes_addresses = [node.scylla_listen_address for node in self.nodes] elif self.test_config.REUSE_CLUSTER or self.params.get('db_type') == 'cloud_scylla': node = self.nodes[0] node.wait_ssh_up() - seed_nodes_ips = wait.wait_for(self.read_seed_info_from_scylla_yaml, - step=10, text='Waiting for seed read from scylla yaml', - timeout=wait_for_timeout, throw_exc=True) + seed_nodes_addresses = wait.wait_for(self.read_seed_info_from_scylla_yaml, + step=10, text='Waiting for seed read from scylla yaml', + timeout=wait_for_timeout, throw_exc=True) else: if seeds_selector == 'random': selected_nodes = random.sample(self.nodes, seeds_num) @@ -3952,22 +3953,22 @@ def set_seeds(self, wait_for_timeout=300, first_only=False): else: selected_nodes = self.nodes[:seeds_num] - seed_nodes_ips = [node.ip_address for node in selected_nodes] + seed_nodes_addresses = [node.scylla_listen_address for node in selected_nodes] for node in self.nodes: - if node.ip_address in seed_nodes_ips: + if node.scylla_listen_address in seed_nodes_addresses: node.set_seed_flag(True) - assert seed_nodes_ips, "We should have at least one selected seed by now" + assert seed_nodes_addresses, "We should have at least one selected seed by now" @property - def seed_nodes_ips(self): + def seed_nodes_addresses(self): if self.params.get('use_dns_names'): - seed_nodes_ips = [node.private_dns_name for node in self.nodes if node.is_seed] + seed_nodes_addresses = [node.private_dns_name for node in self.nodes if node.is_seed] else: - seed_nodes_ips = [node.ip_address for node in self.nodes if node.is_seed] - assert seed_nodes_ips, "We should have at least one selected seed by now" - return seed_nodes_ips + seed_nodes_addresses = [node.ip_address for node in self.nodes if node.is_seed] + assert seed_nodes_addresses, "We should have at least one selected seed by now" + return seed_nodes_addresses @property def seed_nodes(self): @@ -3983,10 +3984,10 @@ def validate_seeds_on_all_nodes(self): for node in self.nodes: yaml_seeds_ips = node.extract_seeds_from_scylla_yaml() for ip in yaml_seeds_ips: - assert ip in self.seed_nodes_ips, \ + assert ip in self.seed_nodes_addresses, \ 'Wrong seed IP {act_ip} in the scylla.yaml on the {node_name} node. ' \ 'Expected {exp_ips}'.format(node_name=node.name, - exp_ips=self.seed_nodes_ips, + exp_ips=self.seed_nodes_addresses, act_ip=ip) @contextlib.contextmanager @@ -4676,10 +4677,10 @@ def read_seed_info_from_scylla_yaml(self, node=None): if not node: node = self.nodes[0] - seed_nodes_ips = node.extract_seeds_from_scylla_yaml() + seed_nodes_addresses = node.extract_seeds_from_scylla_yaml() # When cluster just started, seed IP in the scylla.yaml may be like '127.0.0.1' # In this case we want to ignore it and wait, when reflector will select real node and update scylla.yaml - return [n.ip_address for n in self.nodes if n.ip_address in seed_nodes_ips] + return [n.ip_address for n in self.nodes if n.ip_address in seed_nodes_addresses] def get_node(self): if not self._node_cycle: @@ -4812,7 +4813,7 @@ def create_cluster_manager(self, cluster_name: str, manager_tool=None, host_ip=N if manager_tool is None: manager_tool = mgmt.get_scylla_manager_tool(manager_node=self.scylla_manager_node, scylla_cluster=self) if host_ip is None: - host_ip = self.nodes[0].ip_address + host_ip = self.nodes[0].scylla_listen_address credentials = self.get_db_auth() # pylint: disable=no-member return manager_tool.add_cluster(name=cluster_name, host=host_ip, auth_token=self.scylla_manager_auth_token, credentials=credentials) @@ -5772,7 +5773,23 @@ def _get_ipv6_ip_address(self): def check_spot_termination(self): pass + @property + def private_dns_name(self): + raise NotImplementedError() + + @property + def public_dns_name(self) -> str: + raise NotImplementedError() + class LocalK8SHostNode(LocalNode): def configure_remote_logging(self): self.log.debug("No need to configure remote logging on k8s") + + @property + def private_dns_name(self): + raise NotImplementedError() + + @property + def public_dns_name(self) -> str: + raise NotImplementedError() diff --git a/sdcm/cluster_k8s/__init__.py b/sdcm/cluster_k8s/__init__.py index 8f775469a9..e4dac638b8 100644 --- a/sdcm/cluster_k8s/__init__.py +++ b/sdcm/cluster_k8s/__init__.py @@ -1818,7 +1818,7 @@ def _container_status(self): return None @property - def cql_ip_address(self): + def cql_address(self): return self.ip_address @property @@ -2576,7 +2576,7 @@ def install_scylla_manager(self, node): pass @property - def seed_nodes_ips(self): + def seed_nodes_addresses(self): return [] @property diff --git a/sdcm/ndbench_thread.py b/sdcm/ndbench_thread.py index f856243a61..2ed87c8638 100644 --- a/sdcm/ndbench_thread.py +++ b/sdcm/ndbench_thread.py @@ -121,7 +121,7 @@ def __init__(self, *args, **kwargs): self.stress_cmd = ' '.join([f'-Dndbench.config.{param.strip()}' for param in stress_cmd.split(';')]) timeout = '' if 'cli.timeoutMillis' in self.stress_cmd else f'-Dndbench.config.cli.timeoutMillis={self.timeout * 1000}' self.stress_cmd = f'./gradlew {timeout}' \ - f' -Dndbench.config.cass.host={self.node_list[0].cql_ip_address} {self.stress_cmd} run' + f' -Dndbench.config.cass.host={self.node_list[0].cql_address} {self.stress_cmd} run' def _run_stress(self, loader, loader_idx, cpu_idx): if not os.path.exists(loader.logdir): diff --git a/sdcm/nemesis.py b/sdcm/nemesis.py index 6533c6f60d..bff9aa053c 100644 --- a/sdcm/nemesis.py +++ b/sdcm/nemesis.py @@ -4273,7 +4273,7 @@ def _add_new_node_in_new_dc(self) -> BaseNode: with new_node.remote_scylla_yaml() as scylla_yml: scylla_yml.rpc_address = new_node.ip_address scylla_yml.seed_provider = [SeedProvider(class_name='org.apache.cassandra.locator.SimpleSeedProvider', - parameters=[{"seeds": self.tester.db_cluster.seed_nodes_ips}])] + parameters=[{"seeds": self.tester.db_cluster.seed_nodes_addresses}])] endpoint_snitch = self.cluster.params.get("endpoint_snitch") or "" if endpoint_snitch.endswith("GossipingPropertyFileSnitch"): rackdc_value = {"dc": "add_remove_nemesis_dc"} diff --git a/sdcm/nosql_thread.py b/sdcm/nosql_thread.py index 51648b7b6e..939429af6f 100644 --- a/sdcm/nosql_thread.py +++ b/sdcm/nosql_thread.py @@ -64,9 +64,9 @@ def __init__(self, *args, **kwargs): def build_stress_cmd(self, loader_idx: int): if hasattr(self.node_list[0], 'parent_cluster'): - target_address = self.node_list[0].parent_cluster.get_node().cql_ip_address + target_address = self.node_list[0].parent_cluster.get_node().cql_address else: - target_address = self.node_list[0].cql_ip_address + target_address = self.node_list[0].cql_address with self._per_loader_count_lock: threads_on_loader = self._per_loader_count.get(loader_idx, 0) threads_on_loader += 1 diff --git a/sdcm/provision/scylla_yaml/node_builder.py b/sdcm/provision/scylla_yaml/node_builder.py index b9c9ed8b4e..e7d0531b24 100644 --- a/sdcm/provision/scylla_yaml/node_builder.py +++ b/sdcm/provision/scylla_yaml/node_builder.py @@ -29,7 +29,7 @@ class ScyllaYamlNodeAttrBuilder(ScyllaYamlAttrBuilderBase): @property def _seed_address(self) -> str: - return ','.join(self.node.parent_cluster.seed_nodes_ips) + return ','.join(self.node.parent_cluster.seed_nodes_addresses) @property def _private_ip_address(self) -> str: diff --git a/sdcm/sct_config.py b/sdcm/sct_config.py index 9e8bb3b814..1004c458d9 100644 --- a/sdcm/sct_config.py +++ b/sdcm/sct_config.py @@ -1836,6 +1836,11 @@ def __init__(self): f"Simulating racks requires endpoint_snitch to be GossipingPropertyFileSnitch while it set to {self['endpoint_snitch']}" self["endpoint_snitch"] = "org.apache.cassandra.locator.GossipingPropertyFileSnitch" + # 16 Validate use_dns_names + if self.get("use_dns_names"): + if cluster_backend not in ("aws",): + raise ValueError(f"use_dns_names is not supported for {cluster_backend} backend") + def log_config(self): self.log.info(self.dump_config()) diff --git a/sdcm/scylla_bench_thread.py b/sdcm/scylla_bench_thread.py index ed91836a36..79b9c2cc7e 100644 --- a/sdcm/scylla_bench_thread.py +++ b/sdcm/scylla_bench_thread.py @@ -150,7 +150,7 @@ def create_stress_cmd(self, stress_cmd): stress_cmd = f'{stress_cmd.strip()} -cloud-config-path={self.target_connection_bundle_file}' else: # Select first seed node to send the scylla-bench cmds - ips = ",".join([n.cql_ip_address for n in self.node_list]) + ips = ",".join([n.cql_address for n in self.node_list]) stress_cmd = f'{stress_cmd.strip()} -nodes {ips}' return stress_cmd diff --git a/sdcm/stress/base.py b/sdcm/stress/base.py index d63ba7f0dd..5a6305879f 100644 --- a/sdcm/stress/base.py +++ b/sdcm/stress/base.py @@ -119,8 +119,8 @@ def db_node_to_query(self, loader): assert db_nodes, "No node to query, nemesis runs on all DB nodes!" node_to_query = random.choice(db_nodes) LOGGER.debug("Selected '%s' to query for local nodes", node_to_query) - return node_to_query.cql_ip_address - return self.node_list[0].cql_ip_address + return node_to_query.cql_address + return self.node_list[0].cql_address @property def connection_bundle_file(self) -> Path: diff --git a/sdcm/stress_thread.py b/sdcm/stress_thread.py index 9285cb48e0..8c2109dd7a 100644 --- a/sdcm/stress_thread.py +++ b/sdcm/stress_thread.py @@ -150,7 +150,7 @@ def create_stress_cmd(self, cmd_runner, keyspace_idx, loader): # pylint: disabl LOGGER.error("Not found datacenter for loader region '%s'. Datacenter per loader dict: %s", loader.region, datacenter_name_per_region) - node_ip_list = [n.cql_ip_address for n in self.node_list] + node_ip_list = [n.cql_address for n in self.node_list] stress_cmd += ",".join(node_ip_list) if 'skip-unsupported-columns' in self._get_available_suboptions(cmd_runner, '-errors'): stress_cmd = self._add_errors_option(stress_cmd, ['skip-unsupported-columns']) diff --git a/sdcm/utils/docker_remote.py b/sdcm/utils/docker_remote.py index 504b033626..f8d8ae8489 100644 --- a/sdcm/utils/docker_remote.py +++ b/sdcm/utils/docker_remote.py @@ -41,9 +41,17 @@ def private_ip_address(self): return self.internal_ip_address @property - def cql_ip_address(self): + def cql_address(self): return self.internal_ip_address + @property + def private_dns_name(self): + raise NotImplementedError() + + @property + def public_dns_name(self) -> str: + raise NotImplementedError() + @cached_property def running_in_docker(self): ok = self.node.remoter.run("test /.dockerenv", ignore_status=True).ok diff --git a/sdcm/ycsb_thread.py b/sdcm/ycsb_thread.py index 7134380f2a..c49b6bc83b 100644 --- a/sdcm/ycsb_thread.py +++ b/sdcm/ycsb_thread.py @@ -121,9 +121,9 @@ def copy_template(self, docker): target_address = 'alternator' else: if hasattr(self.node_list[0], 'parent_cluster'): - target_address = self.node_list[0].parent_cluster.get_node().cql_ip_address + target_address = self.node_list[0].parent_cluster.get_node().cql_address else: - target_address = self.node_list[0].cql_ip_address + target_address = self.node_list[0].cql_address if 'dynamodb' in self.stress_cmd: dynamodb_teample = dedent(''' @@ -168,7 +168,7 @@ def copy_template(self, docker): docker.send_files(tmp_file.name, os.path.join('/tmp', 'aws_empty_file')) def build_stress_cmd(self): - hosts = ",".join([i.cql_ip_address for i in self.node_list]) + hosts = ",".join([i.cql_address for i in self.node_list]) stress_cmd = f'{self.stress_cmd} -s ' if 'dynamodb' in self.stress_cmd: diff --git a/test-cases/longevity/longevity-mini-test-1h.yaml b/test-cases/longevity/longevity-mini-test-1h.yaml index 42d6a693a2..d40b994382 100644 --- a/test-cases/longevity/longevity-mini-test-1h.yaml +++ b/test-cases/longevity/longevity-mini-test-1h.yaml @@ -1,5 +1,5 @@ -test_duration: 1000 -stress_cmd: ["cassandra-stress write cl=QUORUM duration=900m -schema 'replication(strategy=NetworkTopologyStrategy,replication_factor=3)' -mode cql3 native -rate threads=2 -pop seq=1..10000000 -log interval=5"] +test_duration: 180 +stress_cmd: ["cassandra-stress write cl=QUORUM duration=90m -schema 'replication(strategy=NetworkTopologyStrategy,replication_factor=3)' -mode cql3 native -rate threads=50 -pop seq=1..10000000 -log interval=5"] n_db_nodes: 4 n_loaders: 1 @@ -9,11 +9,8 @@ instance_type_db: 'i4i.large' nemesis_class_name: 'SisyphusMonkey' nemesis_interval: 1 -nemesis_multiply_factor: 1 -use_dns_names: true - user_prefix: 'longevity-mini-test' space_node_threshold: 6442 -append_scylla_args: ' --blocked-reactor-notify-ms 25 --abort-on-lsa-bad-alloc 1 --abort-on-seastar-bad-alloc --abort-on-internal-error 1 --abort-on-ebadf 1 --enable-sstable-key-validation 1' +append_scylla_args: '--memory 4G --blocked-reactor-notify-ms 25 --abort-on-lsa-bad-alloc 1 --abort-on-seastar-bad-alloc --abort-on-internal-error 1 --abort-on-ebadf 1 --enable-sstable-key-validation 1' diff --git a/unit_tests/test_gemini_thread.py b/unit_tests/test_gemini_thread.py index dfac77c1a0..0b0c803d73 100644 --- a/unit_tests/test_gemini_thread.py +++ b/unit_tests/test_gemini_thread.py @@ -27,7 +27,7 @@ def __init__(self, nodes): self.nodes = nodes def get_node_cql_ips(self): - return [node.cql_ip_address for node in self.nodes] + return [node.cql_address for node in self.nodes] def test_01_gemini_thread(request, docker_scylla, params): diff --git a/unit_tests/test_scylla_yaml_builders.py b/unit_tests/test_scylla_yaml_builders.py index de883c8712..dbe053a427 100644 --- a/unit_tests/test_scylla_yaml_builders.py +++ b/unit_tests/test_scylla_yaml_builders.py @@ -39,7 +39,7 @@ def is_builtin(inst): # pylint: disable=too-few-public-methods class FakeCluster: - seed_nodes_ips = ['1.1.1.1'] + seed_nodes_addresses = ['1.1.1.1'] # pylint: disable=too-few-public-methods @@ -407,7 +407,7 @@ def __init__(self, params): # pylint: disable=super-init-not-called self.name = 'dummy_cluster' @property - def seed_nodes_ips(self): + def seed_nodes_addresses(self): return [node.ip_address for node in self.nodes] def init_nodes(self): @@ -585,7 +585,7 @@ def _run_test(self, config_path: str, expected_node_config: str): cluster.nodes.append(node) cluster.nodes[0].is_seed = True cluster.init_nodes() - seed_node_ips = ','.join(cluster.seed_nodes_ips) + seed_node_ips = ','.join(cluster.seed_nodes_addresses) for node in cluster.nodes: node.validate_scylla_yaml(expected_node_config=expected_node_config, seed_node_ips=seed_node_ips) finally: diff --git a/unit_tests/test_seed_selector.py b/unit_tests/test_seed_selector.py index 3dd753834e..51ed83c265 100644 --- a/unit_tests/test_seed_selector.py +++ b/unit_tests/test_seed_selector.py @@ -73,8 +73,8 @@ def test_first_2_seeds(self): self.cluster.set_seeds() self.assertTrue(self.cluster.seed_nodes == [self.cluster.nodes[0], self.cluster.nodes[1]]) self.assertTrue(self.cluster.non_seed_nodes == [self.cluster.nodes[2]]) - self.assertTrue(self.cluster.seed_nodes_ips == [self.cluster.nodes[0].ip_address, - self.cluster.nodes[1].ip_address]) + self.assertTrue(self.cluster.seed_nodes_addresses == [self.cluster.nodes[0].ip_address, + self.cluster.nodes[1].ip_address]) def test_reuse_cluster_seed(self): self.setup_cluster(nodes_number=3) @@ -84,7 +84,7 @@ def test_reuse_cluster_seed(self): self.cluster.set_seeds() self.assertTrue(self.cluster.seed_nodes == [self.cluster.nodes[1]]) self.assertTrue(self.cluster.non_seed_nodes == [self.cluster.nodes[0], self.cluster.nodes[2]]) - self.assertTrue(self.cluster.seed_nodes_ips == [self.cluster.nodes[1].ip_address]) + self.assertTrue(self.cluster.seed_nodes_addresses == [self.cluster.nodes[1].ip_address]) def test_random_2_seeds(self): self.setup_cluster(nodes_number=3) @@ -92,7 +92,7 @@ def test_random_2_seeds(self): self.cluster.set_seeds() self.assertTrue(len(self.cluster.seed_nodes) == 2) self.assertTrue(len(self.cluster.non_seed_nodes) == 1) - self.assertTrue(len(self.cluster.seed_nodes_ips) == 2) + self.assertTrue(len(self.cluster.seed_nodes_addresses) == 2) def test_first_1_seed(self): self.setup_cluster(nodes_number=1) @@ -100,4 +100,4 @@ def test_first_1_seed(self): self.cluster.set_seeds() self.assertTrue(self.cluster.seed_nodes == [self.cluster.nodes[0]]) self.assertTrue(self.cluster.non_seed_nodes == []) - self.assertTrue(self.cluster.seed_nodes_ips == [self.cluster.nodes[0].ip_address]) + self.assertTrue(self.cluster.seed_nodes_addresses == [self.cluster.nodes[0].ip_address])