From: Kyr Shatskyy Date: Tue, 11 Mar 2025 16:14:28 +0000 (+0100) Subject: qa/tasks/cephfs/mount: use 'ip r' instead 'route' X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b26ddb9c30da688665061858aa34458f616ca8c2;p=ceph.git qa/tasks/cephfs/mount: use 'ip r' instead 'route' Some linux host may not have 'route' installed. So, maybe, prefer 'ip r' to find out which default gateway is configured. Addresses error if there is no net-tools installed on ubuntu remote hosts: route: command not found Signed-off-by: Kyr Shatskyy (cherry picked from commit 46d7dd9952fa89497f9d781a24327b7e80954ca7) --- diff --git a/qa/tasks/cephfs/mount.py b/qa/tasks/cephfs/mount.py index 0060e7af2bf2..c00ded82b56a 100644 --- a/qa/tasks/cephfs/mount.py +++ b/qa/tasks/cephfs/mount.py @@ -296,12 +296,11 @@ class CephFSMountBase(object): self.client_remote.run(args=args, timeout=(5*60), omit_sudo=False) # Setup the NAT - p = self.client_remote.run(args=['route'], stderr=StringIO(), - stdout=StringIO(), timeout=(5*60)) - p = re.findall(r'default .*', p.stdout.getvalue()) - if p == False: + routes = self.client_remote.sh('ip r', timeout=(5*60)) + defaults = re.findall(r'^default .*', routes) + if defaults == False: raise RuntimeError("No default gw found") - gw = p[0].split()[7] + gw = defaults[0].split()[4] self.run_shell_payload(f""" set -e @@ -441,12 +440,12 @@ class CephFSMountBase(object): ip = IP(self.ceph_brx_net)[-2] mask = self.ceph_brx_net.split('/')[1] - p = self.client_remote.run(args=['route'], stderr=StringIO(), - stdout=StringIO(), timeout=(5*60)) - p = re.findall(r'default .*', p.stdout.getvalue()) - if p == False: + routes = self.client_remote.sh('ip r', timeout=(5*60)) + defaults = re.findall(r'^default .*', routes) + if defaults == False: raise RuntimeError("No default gw found") - gw = p[0].split()[7] + gw = defaults[0].split()[4] + self.run_shell_payload(f""" set -e sudo iptables -D FORWARD -o {gw} -i ceph-brx -j ACCEPT