diff --git a/sdcm/cluster.py b/sdcm/cluster.py index bd6f90eca3..d85e57ab34 100644 --- a/sdcm/cluster.py +++ b/sdcm/cluster.py @@ -251,6 +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._spot_monitoring_thread = None self._journal_thread = None self._docker_log_process = None @@ -803,6 +804,14 @@ def public_ip_address(self) -> Optional[str]: self._public_ip_address_cached = self._get_public_ip_address() return self._public_ip_address_cached + @property + def public_dns_name(self) -> str: + return self.name + + @property + def private_dns_name(self) -> str: + return self.name + def _get_public_ip_address(self) -> Optional[str]: public_ips, _ = self._refresh_instance_state() if public_ips: @@ -894,6 +903,8 @@ def scylla_listen_address(self) -> str: Use it for localhost connections (e.g., cqlsh) """ + if self._use_dns_names: + return self.private_dns_name return self.ip_address @property @@ -3951,7 +3962,10 @@ def set_seeds(self, wait_for_timeout=300, first_only=False): @property def seed_nodes_ips(self): - seed_nodes_ips = [node.ip_address for node in self.nodes if node.is_seed] + if self.params.get('use_dns_names'): + seed_nodes_ips = [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 diff --git a/sdcm/cluster_aws.py b/sdcm/cluster_aws.py index f559b5632c..8f0a48ede9 100644 --- a/sdcm/cluster_aws.py +++ b/sdcm/cluster_aws.py @@ -513,6 +513,18 @@ def external_address(self): else: return self._instance.private_ip_address + @cached_property + def public_dns_name(self) -> str: + result = self.remoter.run( + 'curl http://169.254.169.254/latest/meta-data/public-hostname', verbose=False) + return result.stdout.strip() + + @cached_property + def private_dns_name(self) -> str: + result = self.remoter.run( + 'curl http://169.254.169.254/latest/meta-data/local-hostname', verbose=False) + return result.stdout.strip() + def _get_public_ip_address(self) -> Optional[str]: return self._instance.public_ip_address diff --git a/sdcm/provision/scylla_yaml/node_builder.py b/sdcm/provision/scylla_yaml/node_builder.py index 48abaf8ca9..b9c9ed8b4e 100644 --- a/sdcm/provision/scylla_yaml/node_builder.py +++ b/sdcm/provision/scylla_yaml/node_builder.py @@ -56,6 +56,8 @@ def seed_provider(self) -> Optional[List[SeedProvider]]: @property def listen_address(self) -> Optional[str]: + if self.params.get('use_dns_names'): + return self.node.private_dns_name if self._is_ip_ssh_connections_ipv6: return self._ipv6_ip_address if self.params.get('extra_network_interface'): @@ -65,6 +67,8 @@ def listen_address(self) -> Optional[str]: @property def rpc_address(self) -> Optional[str]: + if self.params.get('use_dns_names'): + return self.node.private_dns_name if self._is_ip_ssh_connections_ipv6: return self._ipv6_ip_address if self.params.get('extra_network_interface'): @@ -74,6 +78,8 @@ def rpc_address(self) -> Optional[str]: @property def broadcast_rpc_address(self) -> Optional[str]: + if self.params.get('use_dns_names'): + return self.node.private_dns_name if self._is_ip_ssh_connections_ipv6: return self._ipv6_ip_address if self.params.get('extra_network_interface'): diff --git a/sdcm/sct_config.py b/sdcm/sct_config.py index 3ca88caf7b..9e8bb3b814 100644 --- a/sdcm/sct_config.py +++ b/sdcm/sct_config.py @@ -1481,6 +1481,9 @@ class SCTConfiguration(dict): help="""Forces GossipingPropertyFileSnitch (regardless `endpoint_snitch`) to simulate racks. Provide number of racks to simulate."""), + dict(name="use_dns_names", env="SCT_USE_DNS_NAMES", type=boolean, + help="""Use dns names instead of ip addresses for nodes in cluster"""), + ] required_params = ['cluster_backend', 'test_duration', 'n_db_nodes', 'n_loaders', 'use_preinstalled_scylla', diff --git a/test-cases/longevity/longevity-mini-test-1h.yaml b/test-cases/longevity/longevity-mini-test-1h.yaml index d40b994382..42d6a693a2 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: 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"] +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"] n_db_nodes: 4 n_loaders: 1 @@ -9,8 +9,11 @@ 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: '--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' +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'