Merge ~rodsmith/maas-cert-server:set-mtu-in-start-iperf3 into maas-cert-server:master

Proposed by Rod Smith
Status: Merged
Approved by: Rod Smith
Approved revision: 77f7d6dd7b419515a2340dedea1db0cd7db15403
Merged at revision: 70f73dc02e5c9c7cdd5e0370b9134e0075377f71
Proposed branch: ~rodsmith/maas-cert-server:set-mtu-in-start-iperf3
Merge into: maas-cert-server:master
Diff against target: 59 lines (+26/-1)
2 files modified
debian/changelog (+7/-0)
usr/sbin/start-iperf3 (+19/-1)
Reviewer Review Type Date Requested Status
Jeff Lane  Approve
Review via email: mp+380157@code.launchpad.net

Commit message

Update start-iperf3 to have it set an MTU of 9000 on any NIC with an over-10Gbps speed on which iperf3 is launched.

Description of the change

Update start-iperf3 to have it set an MTU of 9000 on any NIC with an over-10Gbps speed on which iperf3 is launched.

To post a comment you must log in.
Revision history for this message
Jeff Lane  (bladernr) wrote :

LGTM, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/debian/changelog b/debian/changelog
index b2fdba6..346c710 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
1maas-cert-server (0.4.8-0ppa1) bionic; urgency=medium
2
3 * Updated start-iperf3 script to ensure an MTU of 9000 is set on
4 any NIC with a speed of over 10 Gbps.
5
6 -- Rod Smith <rod.smith@canonical.com> Tue, 03 Mar 2020 10:10:51 -0500
7
1maas-cert-server (0.4.7-0ppa1) bionic; urgency=medium8maas-cert-server (0.4.7-0ppa1) bionic; urgency=medium
29
3 * Update maniacs-setup.sh to replace deprecated maas-region-admin call10 * Update maniacs-setup.sh to replace deprecated maas-region-admin call
diff --git a/usr/sbin/start-iperf3 b/usr/sbin/start-iperf3
index 419fa88..c3f819c 100755
--- a/usr/sbin/start-iperf3
+++ b/usr/sbin/start-iperf3
@@ -1,6 +1,6 @@
1#!/usr/bin/env python31#!/usr/bin/env python3
22
3# Copyright (c) 2018 Canonical, Ltd.3# Copyright (c) 2018-2020 Canonical, Ltd.
4#4#
5# Authors5# Authors
6# Rod Smith <rod.smith@canonical.com>6# Rod Smith <rod.smith@canonical.com>
@@ -128,6 +128,23 @@ def launch_all_iperf3(core_list, ip_address, num_instances):
128 print("Failed running iperf: {}".format(iperf_exception.output))128 print("Failed running iperf: {}".format(iperf_exception.output))
129129
130130
131def set_mtu(device):
132 speed = psutil.net_if_stats()[device].speed
133 mtu = psutil.net_if_stats()[device].mtu
134 if (speed > 10000) and (mtu < 9000):
135 print("Trying to set MTU on {} to 9000".format(device))
136 cmd = "sudo ip link set {} mtu 9000".format(device)
137 try:
138 check_output(shlex.split(cmd), universal_newlines=True)
139 except CalledProcessError as mtu_exception:
140 print("Failed setting MTU: {}".format(mtu_exception.output))
141 if (speed > 10000):
142 mtu = psutil.net_if_stats()[device].mtu
143 print("MTU on {} is now {}".format(device, mtu))
144 if (mtu < 9000):
145 print("*** INADEQUATE MTU ON {}! ***".format(device))
146
147
131def main(args):148def main(args):
132 gopts = ArgumentParser()149 gopts = ArgumentParser()
133 gopts.add_argument('-a', '--address', type=str,150 gopts.add_argument('-a', '--address', type=str,
@@ -143,6 +160,7 @@ def main(args):
143 if device is not None:160 if device is not None:
144 node = find_numa(device)161 node = find_numa(device)
145 core_list = find_cores(node)162 core_list = find_cores(node)
163 set_mtu(device)
146 launch_all_iperf3(core_list, args.address, args.num_instances)164 launch_all_iperf3(core_list, args.address, args.num_instances)
147 else:165 else:
148 print("Could not find a network device associated with {}!\n".166 print("Could not find a network device associated with {}!\n".

Subscribers

People subscribed via source and target branches