Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions avocado/utils/network/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,27 @@ def _get_bondinterface_details(self):
f"Slave interface not found for " f"the bond {self.name}"
) from exc

def _get_bondingmaster(self):
"""Get the bonding master interface name from a slave interface.

This method returns the bond interface name for the current slave interface.

:return: Bond master interface name as string
:raises NWException: If bonding master not found or interface is not a slave
"""
master_path = f"/sys/class/net/{self.name}/master"
cmd = f"readlink -f {master_path}"
try:
output = run_command(cmd, self.host)
# Extract the bond interface name from the path
# Output will be like: /sys/devices/virtual/net/bond0
bond_name = os.path.basename(output.strip())
return bond_name
except Exception as exc:
raise NWException(
f"Bonding master not found for interface {self.name}"
) from exc

def _move_file_to_backup(self, filename, ignore_missing=True):
"""Moves a file to a backup location.

Expand Down
Loading