Skip to content

Commit

Permalink
B OpenNebula#196: add NIC recontextualization support
Browse files Browse the repository at this point in the history
Signed-off-by: Petr Ospalý <[email protected]>
  • Loading branch information
Petr Ospalý committed Mar 31, 2020
1 parent da802e3 commit f2e8a70
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/lib/udev/rules.d/65-context.rules##apk.one
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
11 changes: 10 additions & 1 deletion src/lib/udev/rules.d/65-context.rules##deb.one
Original file line number Diff line number Diff line change
@@ -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"

Expand Down
10 changes: 9 additions & 1 deletion src/lib/udev/rules.d/65-context.rules##rpm.systemd.one
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 9 additions & 1 deletion src/lib/udev/rules.d/65-context.rules##rpm.sysv.one
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit f2e8a70

Please sign in to comment.