sven-lange-last commented on a change in pull request #3007: Clean orphaned 
ifstate.veth* files on Ubuntu 14.04
URL: 
https://github.com/apache/incubator-openwhisk/pull/3007#discussion_r155519027
 
 

 ##########
 File path: ansible/roles/invoker/tasks/clean.yml
 ##########
 @@ -38,3 +38,14 @@
     path: "{{ whisk_logs_dir }}/invoker{{ 
groups['invokers'].index(inventory_hostname) }}"
     state: absent
   become: "{{ logs.dir.become }}"
+
+# Workaround for orphaned ifstate.veth* files on Ubuntu 14.04
+# See https://github.com/moby/moby/issues/22513
+# Remove inactive files older than 60 minutes
+- name: "Clean orphaned ifstate.veth* files on Ubuntu 14.04"
+  shell: |
+    ACTIVE_IFACES_REGEXP=$(ip -oneline link show | grep --only-matching 
--extended-regexp 'veth[0-9a-f]+' | tr '\n' '|' | sed -e 's/.$//' | xargs -I 
'{}' /bin/echo '/run/network/ifstate\.({})')
+    find /run/network -regextype posix-egrep \( -not -regex 
${ACTIVE_IFACES_REGEXP} \) -and -name 'ifstate.veth*' -and -mmin +60 -delete
 
 Review comment:
   Debug output for invoker clean if Docker containers are running:
   
   ```
   changed: [<IP address redacted>] => {
       "changed": true,
       "cmd": "ACTIVE_VETH_IFACES=$(ip -oneline link show | grep 
--only-matching --extended-regexp 'veth[0-9a-f]+' | tr '\\n' '|' | sed -e 
's/.$//')\n EXCLUDE_REGEX=$(if [ -z ${ACTIVE_VETH_IFACES} ]; then echo 'No 
active veth interfaces found' >&2; else printf '( -not -regex  
/run/network/ifstate\\.(%s) ) -and ' ${ACTIVE_VETH_IFACES}; fi)\n find 
/run/network -regextype posix-egrep ${EXCLUDE_REGEX} -name 'ifstate.veth*' -and 
-mmin +60 -delete",
       "delta": "0:00:01.010373",
       "end": "2017-12-07 13:22:28.903225",
       "invocation": {
           "module_args": {
               "_raw_params": "ACTIVE_VETH_IFACES=$(ip -oneline link show | 
grep --only-matching --extended-regexp 'veth[0-9a-f]+' | tr '\\n' '|' | sed -e 
's/.$//')\n EXCLUDE_REGEX=$(if [ -z ${ACTIVE_VETH_IFACES} ]; then echo 'No 
active veth interfaces found' >&2; else printf '( -not -regex  
/run/network/ifstate\\.(%s) ) -and ' ${ACTIVE_VETH_IFACES}; fi)\n find 
/run/network -regextype posix-egrep ${EXCLUDE_REGEX} -name 'ifstate.veth*' -and 
-mmin +60 -delete",
               "_uses_shell": true,
               "chdir": null,
               "creates": null,
               "executable": null,
               "removes": null,
               "warn": true
           }
       },
       "rc": 0,
       "start": "2017-12-07 13:22:27.892852",
       "stderr": "",
       "stderr_lines": [],
       "stdout": "",
       "stdout_lines": []
   }
   ```
   
   Debug output for invoker clean if NO Docker containers are running:
   
   ```
   changed: [<IP adress redacted>] => {
       "changed": true,
       "cmd": "ACTIVE_VETH_IFACES=$(ip -oneline link show | grep 
--only-matching --extended-regexp 'veth[0-9a-f]+' | tr '\\n' '|' | sed -e 
's/.$//')\n EXCLUDE_REGEX=$(if [ -z ${ACTIVE_VETH_IFACES} ]; then echo 'No 
active veth interfaces found' >&2; else printf '( -not -regex  
/run/network/ifstate\\.(%s) ) -and ' ${ACTIVE_VETH_IFACES}; fi)\n find 
/run/network -regextype posix-egrep ${EXCLUDE_REGEX} -name 'ifstate.veth*' -and 
-mmin +60 -delete",
       "delta": "0:00:00.009733",
       "end": "2017-12-07 13:24:52.460935",
       "invocation": {
           "module_args": {
               "_raw_params": "ACTIVE_VETH_IFACES=$(ip -oneline link show | 
grep --only-matching --extended-regexp 'veth[0-9a-f]+' | tr '\\n' '|' | sed -e 
's/.$//')\n EXCLUDE_REGEX=$(if [ -z ${ACTIVE_VETH_IFACES} ]; then echo 'No 
active veth interfaces found' >&2; else printf '( -not -regex  
/run/network/ifstate\\.(%s) ) -and ' ${ACTIVE_VETH_IFACES}; fi)\n find 
/run/network -regextype posix-egrep ${EXCLUDE_REGEX} -name 'ifstate.veth*' -and 
-mmin +60 -delete",
               "_uses_shell": true,
               "chdir": null,
               "creates": null,
               "executable": null,
               "removes": null,
               "warn": true
           }
       },
       "rc": 0,
       "start": "2017-12-07 13:24:52.451202",
       "stderr": "No active veth interfaces found",
       "stderr_lines": [
           "No active veth interfaces found"
       ],
       "stdout": "",
       "stdout_lines": []
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to