Skip to content

Commit

Permalink
fix(multi-networks): configure scylla correctly with the right interface
Browse files Browse the repository at this point in the history
* configure `listen_interface` in scylla.yaml as needed
* return correct selected interface on `get_nic_devices()`
* run `scylla_sysconfig_setup` again on right network interface
  • Loading branch information
fruch committed Dec 8, 2024
1 parent 1d4cbaa commit 5eba5ae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sdcm/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
from sdcm.provision.helpers.certificate import (
create_ca, install_client_certificate, install_encryption_at_rest_files, create_certificate,
export_pem_cert_to_pkcs12_keystore, CA_CERT_FILE, CA_KEY_FILE, JKS_TRUSTSTORE_FILE, TLSAssets)
from sdcm.provision.network_configuration import network_interfaces_count
from sdcm.remote import RemoteCmdRunnerBase, LOCALRUNNER, NETWORK_EXCEPTIONS, shell_script_cmd, RetryableNetworkException
from sdcm.remote.libssh2_client import UnexpectedExit as Libssh2_UnexpectedExit
from sdcm.remote.remote_long_running import run_long_running_cmd
Expand Down Expand Up @@ -3030,6 +3031,9 @@ def disable_daily_triggered_services(self):

def get_nic_devices(self) -> List:
"""Returns list of ethernet network interfaces"""
if self.scylla_network_configuration:
return [self.scylla_network_configuration.device]

result = self.remoter.run('/sbin/ip -o link show |grep ether |awk -F": " \'{print $2}\'', verbose=True)
return result.stdout.strip().split()

Expand Down Expand Up @@ -4723,6 +4727,9 @@ def node_setup(self, node: BaseNode, verbose: bool = False, timeout: int = 3600)
node.clean_scylla_data()
node.remoter.sudo(cmd="rm -f /etc/scylla/ami_disabled", ignore_status=True)

if network_interfaces_count(self.params) > 1:
node.run_scylla_sysconfig_setup()

if append_scylla_node_exporter_args := self.params.get('append_scylla_node_exporter_args'):
configuration_file = '/etc/default/scylla-node-exporter'
with remote_file(remoter=node.remoter,
Expand Down
6 changes: 6 additions & 0 deletions sdcm/provision/scylla_yaml/node_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ def broadcast_address(self) -> Optional[str]:
return self._public_ip_address
return None

@property
def listen_interface(self):
if self.node.scylla_network_configuration:
return self.node.scylla_network_configuration.device
return None

@property
def enable_ipv6_dns_lookup(self) -> bool:
return self._is_ip_ssh_connections_ipv6
Expand Down

0 comments on commit 5eba5ae

Please sign in to comment.