Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit e2b2c36

Browse files
committed
F #196: Force recontextualization on NIC detach
1 parent 8d5542c commit e2b2c36

4 files changed

Lines changed: 41 additions & 4 deletions

File tree

src/lib/udev/rules.d/65-context.rules##apk.one

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
# On NIC hogplug the delayed reconfiguration is triggered.
1+
# NIC detach workaround for recontextualization on OpenNebula < 5.10.3
2+
# https://github.com/OpenNebula/one/issues/4130
3+
# https://github.com/OpenNebula/one/issues/4194
4+
SUBSYSTEM=="net", ACTION=="remove", \
5+
RUN+="/bin/sh -c 'test -f /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.local; test -f /var/run/one-context/context.sh.network && echo >> /var/run/one-context/context.sh.network'"
6+
7+
# On NIC hotplug the delayed reconfiguration is triggered.
28
SUBSYSTEM=="net", ACTION=="add", \
39
RUN+="/sbin/service one-context-reconfigure-delayed restart"
410

11+
SUBSYSTEM=="net", ACTION=="remove", \
12+
RUN+="/sbin/service one-context-reconfigure-delayed restart"
13+
514
# On CONTEXT CD-ROM change the immediate reconfiguration is triggered.
615
SUBSYSTEM=="block", ACTION=="change", \
716
ENV{ID_CDROM}=="1", \

src/lib/udev/rules.d/65-context.rules##deb.one

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1-
# On NIC hogplug the delayed reconfiguration is triggered.
1+
# NIC detach workaround for recontextualization on OpenNebula < 5.10.3
2+
# https://github.com/OpenNebula/one/issues/4130
3+
# https://github.com/OpenNebula/one/issues/4194
4+
SUBSYSTEM=="net", ACTION=="remove", \
5+
RUN+="/bin/sh -c 'test -f /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.local; test -f /var/run/one-context/context.sh.network && echo >> /var/run/one-context/context.sh.network'"
6+
7+
# On NIC hotplug the delayed reconfiguration is triggered.
28
SUBSYSTEM=="net", ACTION=="add", \
39
TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service", \
410
RUN+="/usr/bin/timeout 5 /usr/sbin/service one-context-reconfigure-delayed start"
511

12+
SUBSYSTEM=="net", ACTION=="remove", \
13+
TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service", \
14+
RUN+="/usr/bin/timeout 5 /usr/sbin/service one-context-reconfigure-delayed start"
15+
616
# When CONTEXT CD-ROM is changed, it generates 2 events. This rule takes
717
# every second event and triggers systemd service one-context-reconfigure.
818
# This service also stops any existing delayed reconfiguration.

src/lib/udev/rules.d/65-context.rules##rpm.systemd.one

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
# On NIC hogplug the delayed reconfiguration is triggered.
1+
# NIC detach workaround for recontextualization on OpenNebula < 5.10.3
2+
# https://github.com/OpenNebula/one/issues/4130
3+
# https://github.com/OpenNebula/one/issues/4194
4+
SUBSYSTEM=="net", ACTION=="remove", \
5+
RUN+="/bin/sh -c 'test -f /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.local; test -f /var/run/one-context/context.sh.network && echo >> /var/run/one-context/context.sh.network'"
6+
7+
# On NIC hotplug the delayed reconfiguration is triggered.
28
SUBSYSTEM=="net", ACTION=="add", \
39
TAG+="systemd", ENV{SYSTEMD_WANTS}+="one-context-reconfigure-delayed.service"
410

11+
SUBSYSTEM=="net", ACTION=="remove", \
12+
RUN+="/bin/systemctl --no-block start one-context-reconfigure-delayed.service"
13+
514
# When CONTEXT CD-ROM is changed, it generates 2 events. This rule takes
615
# every second event and triggers systemd service one-context-reconfigure.
716
# This service also stops any existing delayed reconfiguration.

src/lib/udev/rules.d/65-context.rules##rpm.sysv.one

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
1-
# On NIC hogplug the delayed reconfiguration is triggered.
1+
# NIC detach workaround for recontextualization on OpenNebula < 5.10.3
2+
# https://github.com/OpenNebula/one/issues/4130
3+
# https://github.com/OpenNebula/one/issues/4194
4+
SUBSYSTEM=="net", ACTION=="remove", \
5+
RUN+="/bin/sh -c 'test -f /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.local; test -f /var/run/one-context/context.sh.network && echo >> /var/run/one-context/context.sh.network'"
6+
7+
# On NIC hotplug the delayed reconfiguration is triggered.
28
SUBSYSTEM=="net", ACTION=="add", \
39
RUN+="/sbin/service one-context-reconfigure-delayed start"
410

11+
SUBSYSTEM=="net", ACTION=="remove", \
12+
RUN+="/sbin/service one-context-reconfigure-delayed start"
13+
514
# Handle disk resize
615
SUBSYSTEM=="block", ACTION=="change", \
716
ENV{RESIZE}=="1", \

0 commit comments

Comments
 (0)