Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix name of single IB device when provisioning RDMA #2814

Merged
merged 1 commit into from
May 8, 2023
Merged
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
23 changes: 14 additions & 9 deletions azurelinuxagent/common/rdma.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,28 +419,33 @@ def update_iboip_interfaces(self, mac_ip_array):

@staticmethod
def update_iboip_interface(ipv4_addr, timeout_sec, check_interval_sec):
logger.info("Wait for ib0 become available")
logger.info("Wait for ib become available")
total_retries = timeout_sec / check_interval_sec
n = 0
found_ib0 = None
while not found_ib0 and n < total_retries:
found_ib = None
while not found_ib and n < total_retries:
ret, output = shellutil.run_get_output("ifconfig -a")
if ret != 0:
raise Exception("Failed to list network interfaces")
found_ib0 = re.search("ib0", output, re.IGNORECASE)
if found_ib0:
found_ib = re.search(r"(ib\S+):", output, re.IGNORECASE)
if found_ib:
break
time.sleep(check_interval_sec)
n += 1

if not found_ib0:
raise Exception("ib0 is not available")
if not found_ib:
raise Exception("ib is not available")

ibname = found_ib.groups()[0]
if shellutil.run("ifconfig {0} up".format(ibname)) != 0:
raise Exception("Could not run ifconfig {0} up".format(ibname))

netmask = 16
logger.info("RDMA: configuring IPv4 addr and netmask on ipoib interface")
addr = '{0}/{1}'.format(ipv4_addr, netmask)
if shellutil.run("ifconfig ib0 {0}".format(addr)) != 0:
raise Exception("Could set addr to {0} on ib0".format(addr))
if shellutil.run("ifconfig {0} {1}".format(ibname, addr)) != 0:
raise Exception("Could not set addr to {0} on {1}".format(addr, ibname))

logger.info("RDMA: ipoib address and netmask configured on interface")

@staticmethod
Expand Down