From ca49ee7e81b14354d60f3f9bbb8865926e238388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Ospal=C3=BD?= Date: Tue, 31 Mar 2020 21:51:45 +0200 Subject: [PATCH] F OpenNebula/addon-context-linux#196 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Petr OspalĂ˝ --- src/lib/udev/rules.d/65-context.rules##apk.one | 10 +++++++++- src/lib/udev/rules.d/65-context.rules##deb.one | 11 ++++++++++- .../udev/rules.d/65-context.rules##rpm.systemd.one | 10 +++++++++- src/lib/udev/rules.d/65-context.rules##rpm.sysv.one | 10 +++++++++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/lib/udev/rules.d/65-context.rules##apk.one b/src/lib/udev/rules.d/65-context.rules##apk.one index 6da454a..7a3ae60 100644 --- a/src/lib/udev/rules.d/65-context.rules##apk.one +++ b/src/lib/udev/rules.d/65-context.rules##apk.one @@ -1,5 +1,13 @@ -# On NIC hogplug the delayed reconfiguration is triggered. +# On NIC hotplug the delayed reconfiguration is triggered. SUBSYSTEM=="net", ACTION=="add", \ + RUN+="/bin/sh -c 'echo >> /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.network'" +SUBSYSTEM=="net", ACTION=="add", \ + RUN+="/sbin/service one-context-reconfigure-delayed restart" + +# On NIC detach - workaround for the older OpenNebula versions <5.10.2 +SUBSYSTEM=="net", ACTION=="remove", \ + RUN+="/bin/sh -c 'echo >> /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.network'" +SUBSYSTEM=="net", ACTION=="remove", \ RUN+="/sbin/service one-context-reconfigure-delayed restart" # On CONTEXT CD-ROM change the immediate reconfiguration is triggered. diff --git a/src/lib/udev/rules.d/65-context.rules##deb.one b/src/lib/udev/rules.d/65-context.rules##deb.one index 52c6f8e..c310163 100644 --- a/src/lib/udev/rules.d/65-context.rules##deb.one +++ b/src/lib/udev/rules.d/65-context.rules##deb.one @@ -1,5 +1,14 @@ -# On NIC hogplug the delayed reconfiguration is triggered. +# On NIC hotplug the delayed reconfiguration is triggered. SUBSYSTEM=="net", ACTION=="add", \ + RUN+="/bin/sh -c 'echo >> /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.network'" +SUBSYSTEM=="net", ACTION=="add", \ + TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service", \ + RUN+="/usr/bin/timeout 5 /usr/sbin/service one-context-reconfigure-delayed start" + +# On NIC detach - workaround for the older OpenNebula versions <5.10.2 +SUBSYSTEM=="net", ACTION=="remove", \ + RUN+="/bin/sh -c 'echo >> /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.network'" +SUBSYSTEM=="net", ACTION=="remove", \ TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service", \ RUN+="/usr/bin/timeout 5 /usr/sbin/service one-context-reconfigure-delayed start" diff --git a/src/lib/udev/rules.d/65-context.rules##rpm.systemd.one b/src/lib/udev/rules.d/65-context.rules##rpm.systemd.one index 76f3aea..3c276ac 100644 --- a/src/lib/udev/rules.d/65-context.rules##rpm.systemd.one +++ b/src/lib/udev/rules.d/65-context.rules##rpm.systemd.one @@ -1,7 +1,15 @@ -# On NIC hogplug the delayed reconfiguration is triggered. +# On NIC hotplug the delayed reconfiguration is triggered. +SUBSYSTEM=="net", ACTION=="add", \ + RUN+="/bin/sh -c 'echo >> /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.network'" SUBSYSTEM=="net", ACTION=="add", \ TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service" +# On NIC detach - workaround for the older OpenNebula versions <5.10.2 +SUBSYSTEM=="net", ACTION=="remove", \ + RUN+="/bin/sh -c 'echo >> /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.network'" +SUBSYSTEM=="net", ACTION=="remove", \ + RUN+="/bin/systemctl --no-block start one-context-reconfigure-delayed.service" + # When CONTEXT CD-ROM is changed, it generates 2 events. This rule takes # every second event and triggers systemd service one-context-reconfigure. # This service also stops any existing delayed reconfiguration. diff --git a/src/lib/udev/rules.d/65-context.rules##rpm.sysv.one b/src/lib/udev/rules.d/65-context.rules##rpm.sysv.one index fae9e08..f9fb7cd 100644 --- a/src/lib/udev/rules.d/65-context.rules##rpm.sysv.one +++ b/src/lib/udev/rules.d/65-context.rules##rpm.sysv.one @@ -1,5 +1,13 @@ -# On NIC hogplug the delayed reconfiguration is triggered. +# On NIC hotplug the delayed reconfiguration is triggered. SUBSYSTEM=="net", ACTION=="add", \ + RUN+="/bin/sh -c 'echo >> /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.network'" +SUBSYSTEM=="net", ACTION=="add", \ + RUN+="/sbin/service one-context-reconfigure-delayed start" + +# On NIC detach - workaround for the older OpenNebula versions <5.10.2 +SUBSYSTEM=="net", ACTION=="remove", \ + RUN+="/bin/sh -c 'echo >> /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.network'" +SUBSYSTEM=="net", ACTION=="remove", \ RUN+="/sbin/service one-context-reconfigure-delayed start" # Handle disk resize