<p>Pau Espin Pedrol has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/13524">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">ansible: gsm-tester: Install osmo-gsm-tester_netns_setup.sh<br><br>Change-Id: Iaa8802b86429abfaf84fc0f20bd207737dbc9812<br>---<br>A ansible/roles/gsm-tester/files/osmo-gsm-tester_netns_setup.sh<br>M ansible/roles/gsm-tester/tasks/main.yml<br>2 files changed, 35 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/24/13524/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/ansible/roles/gsm-tester/files/osmo-gsm-tester_netns_setup.sh b/ansible/roles/gsm-tester/files/osmo-gsm-tester_netns_setup.sh</span><br><span>new file mode 100755</span><br><span>index 0000000..1600c44</span><br><span>--- /dev/null</span><br><span>+++ b/ansible/roles/gsm-tester/files/osmo-gsm-tester_netns_setup.sh</span><br><span>@@ -0,0 +1,22 @@</span><br><span style="color: hsl(120, 100%, 40%);">+#!/bin/bash -e</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ifname="$1"</span><br><span style="color: hsl(120, 100%, 40%);">+netns="$2"</span><br><span style="color: hsl(120, 100%, 40%);">+shift</span><br><span style="color: hsl(120, 100%, 40%);">+shift</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if [ -f "/var/run/netns/${netns}" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+    echo "netns $netns already exists"</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+    echo "Creating netns $netns"</span><br><span style="color: hsl(120, 100%, 40%);">+    ip netns add "$netns"</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+if [ -d "/sys/class/net/${ifname}" ]; then</span><br><span style="color: hsl(120, 100%, 40%);">+    echo "Moving iface $ifname to netns $netns"</span><br><span style="color: hsl(120, 100%, 40%);">+    ip link set $ifname netns $netns</span><br><span style="color: hsl(120, 100%, 40%);">+else</span><br><span style="color: hsl(120, 100%, 40%);">+    ip netns exec $netns ls "/sys/class/net/${ifname}" >/dev/null && echo "iface $ifname already in netns $netns"</span><br><span style="color: hsl(120, 100%, 40%);">+fi</span><br><span>diff --git a/ansible/roles/gsm-tester/tasks/main.yml b/ansible/roles/gsm-tester/tasks/main.yml</span><br><span>index c9b7429..34846a5 100644</span><br><span>--- a/ansible/roles/gsm-tester/tasks/main.yml</span><br><span>+++ b/ansible/roles/gsm-tester/tasks/main.yml</span><br><span>@@ -254,6 +254,19 @@</span><br><span>     dest: /etc/sudoers.d/osmo-gsm-tester_netns_exec</span><br><span>     mode: 0440</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+- name: create a wrapper script to move modem net iface into its own netns</span><br><span style="color: hsl(120, 100%, 40%);">+  copy:</span><br><span style="color: hsl(120, 100%, 40%);">+    src: osmo-gsm-tester_netns_setup.sh</span><br><span style="color: hsl(120, 100%, 40%);">+    dest: /usr/local/bin/osmo-gsm-tester_netns_setup.sh</span><br><span style="color: hsl(120, 100%, 40%);">+    mode: 755</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+- name: allow osmo-gsm-tester sudo osmo-gsm-tester_netns_setup.sh</span><br><span style="color: hsl(120, 100%, 40%);">+  copy:</span><br><span style="color: hsl(120, 100%, 40%);">+    content: |</span><br><span style="color: hsl(120, 100%, 40%);">+      %osmo-gsm-tester ALL=(root) NOPASSWD: /usr/local/bin/osmo-gsm-tester_netns_setup.sh</span><br><span style="color: hsl(120, 100%, 40%);">+    dest: /etc/sudoers.d/osmo-gsm-tester_netns_setup</span><br><span style="color: hsl(120, 100%, 40%);">+    mode: 0440</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> - name: logrotate limit filesizes to 10M</span><br><span>   copy:</span><br><span>     content: "maxsize 10M"</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/13524">change 13524</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/13524"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ci </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Iaa8802b86429abfaf84fc0f20bd207737dbc9812 </div>
<div style="display:none"> Gerrit-Change-Number: 13524 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>