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