From fb82378b6f60d917b1af0eb9915d971ade49cefc Mon Sep 17 00:00:00 2001 From: Israel Fruchter Date: Sun, 8 Dec 2024 22:12:28 +0200 Subject: [PATCH] fix(multi-networks): configure scylla correctly with the right interface * 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 --- sdcm/cluster.py | 7 +++++++ sdcm/provision/scylla_yaml/node_builder.py | 6 ++++++ sdcm/provision/scylla_yaml/scylla_yaml.py | 1 + .../PR-provision-test.result.json | 1 + .../test_scylla_yaml_builders/functional.result.json | 1 + .../test_data/test_scylla_yaml_builders/jepsen.result.json | 1 + .../longevity-10gb-3h.result.json | 1 + .../manager-backup-1TB-gce.result.json | 1 + .../cdc-replication-longevity.result.json | 1 + .../multi_network_interfaces/longevity-10gb-3h.result.json | 1 + .../perf-regression.100threads.30M-keys.result.json | 1 + .../test_scylla_yaml_builders/rolling-upgrade.result.json | 1 + unit_tests/test_scylla_yaml_builders.py | 4 ++-- 13 files changed, 25 insertions(+), 2 deletions(-) diff --git a/sdcm/cluster.py b/sdcm/cluster.py index ae55b0fdc8..993020345d 100644 --- a/sdcm/cluster.py +++ b/sdcm/cluster.py @@ -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 @@ -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() @@ -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, diff --git a/sdcm/provision/scylla_yaml/node_builder.py b/sdcm/provision/scylla_yaml/node_builder.py index 4cfa17b4d0..57b2c77bfb 100644 --- a/sdcm/provision/scylla_yaml/node_builder.py +++ b/sdcm/provision/scylla_yaml/node_builder.py @@ -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 diff --git a/sdcm/provision/scylla_yaml/scylla_yaml.py b/sdcm/provision/scylla_yaml/scylla_yaml.py index 4d3845395e..9beebea610 100644 --- a/sdcm/provision/scylla_yaml/scylla_yaml.py +++ b/sdcm/provision/scylla_yaml/scylla_yaml.py @@ -32,6 +32,7 @@ class Config: # pylint: disable=too-few-public-methods broadcast_address: str = None # "" api_port: int = None # 10000 api_address: str = None # "" + listen_interface: str = None # "eth0" ssl_storage_port: int = None # 7001 background_writer_scheduling_quota: float = None # 1.0 auto_adjust_flush_quota: bool = None # False diff --git a/unit_tests/test_data/test_scylla_yaml_builders/PR-provision-test.result.json b/unit_tests/test_data/test_scylla_yaml_builders/PR-provision-test.result.json index 48aabdaa41..553b942ffd 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/PR-provision-test.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/PR-provision-test.result.json @@ -20,5 +20,6 @@ "alternator_enforce_authorization": false, "auto_bootstrap": true, "enable_ipv6_dns_lookup": false, + "listen_interface": "eth0", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_data/test_scylla_yaml_builders/functional.result.json b/unit_tests/test_data/test_scylla_yaml_builders/functional.result.json index 48aabdaa41..553b942ffd 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/functional.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/functional.result.json @@ -20,5 +20,6 @@ "alternator_enforce_authorization": false, "auto_bootstrap": true, "enable_ipv6_dns_lookup": false, + "listen_interface": "eth0", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_data/test_scylla_yaml_builders/jepsen.result.json b/unit_tests/test_data/test_scylla_yaml_builders/jepsen.result.json index 48aabdaa41..553b942ffd 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/jepsen.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/jepsen.result.json @@ -20,5 +20,6 @@ "alternator_enforce_authorization": false, "auto_bootstrap": true, "enable_ipv6_dns_lookup": false, + "listen_interface": "eth0", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_data/test_scylla_yaml_builders/longevity-10gb-3h.result.json b/unit_tests/test_data/test_scylla_yaml_builders/longevity-10gb-3h.result.json index f5b4626f2f..6fe01279fc 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/longevity-10gb-3h.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/longevity-10gb-3h.result.json @@ -20,5 +20,6 @@ "enable_ipv6_dns_lookup": true, "alternator_enforce_authorization": false, "auto_bootstrap": true, + "listen_interface": "eth0", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_data/test_scylla_yaml_builders/manager-backup-1TB-gce.result.json b/unit_tests/test_data/test_scylla_yaml_builders/manager-backup-1TB-gce.result.json index 48aabdaa41..553b942ffd 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/manager-backup-1TB-gce.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/manager-backup-1TB-gce.result.json @@ -20,5 +20,6 @@ "alternator_enforce_authorization": false, "auto_bootstrap": true, "enable_ipv6_dns_lookup": false, + "listen_interface": "eth0", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_data/test_scylla_yaml_builders/multi_network_interfaces/cdc-replication-longevity.result.json b/unit_tests/test_data/test_scylla_yaml_builders/multi_network_interfaces/cdc-replication-longevity.result.json index 531ac9c41c..54945e8c7f 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/multi_network_interfaces/cdc-replication-longevity.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/multi_network_interfaces/cdc-replication-longevity.result.json @@ -19,5 +19,6 @@ "alternator_enforce_authorization": false, "auto_bootstrap": true, "enable_ipv6_dns_lookup": false, + "listen_interface": "eth1", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_data/test_scylla_yaml_builders/multi_network_interfaces/longevity-10gb-3h.result.json b/unit_tests/test_data/test_scylla_yaml_builders/multi_network_interfaces/longevity-10gb-3h.result.json index 884654c140..612a300bba 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/multi_network_interfaces/longevity-10gb-3h.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/multi_network_interfaces/longevity-10gb-3h.result.json @@ -19,5 +19,6 @@ "enable_ipv6_dns_lookup": false, "alternator_enforce_authorization": false, "auto_bootstrap": true, + "listen_interface": "eth1", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_data/test_scylla_yaml_builders/perf-regression.100threads.30M-keys.result.json b/unit_tests/test_data/test_scylla_yaml_builders/perf-regression.100threads.30M-keys.result.json index 48aabdaa41..553b942ffd 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/perf-regression.100threads.30M-keys.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/perf-regression.100threads.30M-keys.result.json @@ -20,5 +20,6 @@ "alternator_enforce_authorization": false, "auto_bootstrap": true, "enable_ipv6_dns_lookup": false, + "listen_interface": "eth0", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_data/test_scylla_yaml_builders/rolling-upgrade.result.json b/unit_tests/test_data/test_scylla_yaml_builders/rolling-upgrade.result.json index 9057c063f8..c74ebb8954 100644 --- a/unit_tests/test_data/test_scylla_yaml_builders/rolling-upgrade.result.json +++ b/unit_tests/test_data/test_scylla_yaml_builders/rolling-upgrade.result.json @@ -28,5 +28,6 @@ "alternator_enforce_authorization": false, "auto_bootstrap": true, "enable_ipv6_dns_lookup": false, + "listen_interface": "eth0", "hinted_handoff_enabled": false } diff --git a/unit_tests/test_scylla_yaml_builders.py b/unit_tests/test_scylla_yaml_builders.py index b814a0fb74..6fcaf94f35 100644 --- a/unit_tests/test_scylla_yaml_builders.py +++ b/unit_tests/test_scylla_yaml_builders.py @@ -459,7 +459,7 @@ def network_interfaces(self): dns_private_name="", dns_public_name="", device_index=0, - device_name='', + device_name='eth0', mac_address='' ), NetworkInterface(ipv4_public_address=None, @@ -469,7 +469,7 @@ def network_interfaces(self): dns_private_name="", dns_public_name="", device_index=1, - device_name='', + device_name='eth1', mac_address='' ) ]