Skip to content

Commit

Permalink
fix(cluster): ipv6 address in network_interfaces object
Browse files Browse the repository at this point in the history
The problem was found during IPv6 test.
IPv6 was converted to full format when parse nodetool status result.
This change was represented by  #7047

But IPv6 address was not converted when collected info about nodes network interfaces (AWS).

During checking nodes status, we compare between 'nodetool status' output and node address
that kept in the network_interfaces object. It fails because the IPv6 address miss leading zeros.
As result the test fails with errors 'Failed to find a node in cluster by IP'

Fixes: #7447
  • Loading branch information
juliayakovlev committed May 21, 2024
1 parent f602bf2 commit 67a42eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sdcm/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2744,7 +2744,7 @@ def get_peers_info(self):
for row in cql_results:
peer = row.peer
try:
ipaddress.ip_address(row.peer)
peer = ipaddress.ip_address(row.peer).exploded
except ValueError as exc:
current_err = f"Peer '{peer}' is not an IP address, err: {exc}\n"
LOGGER.warning(current_err)
Expand Down Expand Up @@ -2776,7 +2776,7 @@ def get_gossip_info(self) -> dict[BaseNode, dict]:
if line.startswith('SCHEMA:'):
schema = line.replace('SCHEMA:', '')
elif line.startswith('RPC_ADDRESS:'):
ip = line.replace('RPC_ADDRESS:', '')
ip = ipaddress.ip_address(line.replace('RPC_ADDRESS:', '')).exploded
elif line.startswith('STATUS:'):
status = line.replace('STATUS:', '').split(',')[0]
elif line.startswith('DC:'):
Expand Down
5 changes: 3 additions & 2 deletions sdcm/cluster_aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Copyright (c) 2020 ScyllaDB

# pylint: disable=too-many-lines, too-many-public-methods

import ipaddress
import json
import logging
import os
Expand Down Expand Up @@ -460,7 +460,8 @@ def network_interfaces(self):
for interface in self._instance.network_interfaces:
private_ip_addresses = [private_address["PrivateIpAddress"]
for private_address in interface.private_ip_addresses]
ipv6_addresses = [ipv6_address['Ipv6Address'] for ipv6_address in interface.ipv6_addresses]
ipv6_addresses = [ipaddress.ip_address(
ipv6_address['Ipv6Address']).exploded for ipv6_address in interface.ipv6_addresses]
device_indexes.append(interface.attachment['DeviceIndex'])
ipv4_public_address = interface.association_attribute['PublicIp'] if interface.association_attribute else None
dns_public_name = interface.association_attribute['PublicDnsName'] if interface.association_attribute else None
Expand Down

0 comments on commit 67a42eb

Please sign in to comment.