You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.6 KiB

From 6bc676b1a1bfa7145106f737a6747526ce662b93 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 23 Jul 2018 16:57:22 +0200
Subject: [PATCH] rules: add udev rule that automatically offline HW attached
to ACPI container
Resolves: #1597958
---
Makefile.am | 1 +
rules/40-redhat-hotunplug.rules | 14 ++++++++++++++
2 files changed, 15 insertions(+)
create mode 100644 rules/40-redhat-hotunplug.rules
diff --git a/Makefile.am b/Makefile.am
index 40ebbe98ee..3995dcce89 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3524,6 +3524,7 @@ dist_udevrules_DATA += \
rules/40-redhat.rules \
rules/40-redhat-disable-lenovo-ir-camera.rules \
rules/40-redhat-disable-dell-ir-camera.rules \
+ rules/40-redhat-hotunplug.rules \
rules/73-idrac.rules \
rules/80-net-name-slot.rules
diff --git a/rules/40-redhat-hotunplug.rules b/rules/40-redhat-hotunplug.rules
new file mode 100644
index 0000000000..3befdaffc8
--- /dev/null
+++ b/rules/40-redhat-hotunplug.rules
@@ -0,0 +1,14 @@
+# ACPI0004 container offline for Huawei Kunlun
+# do not edit this file, it will be overwritten on update
+
+SUBSYSTEM=="container", ACTION=="change", DEVPATH=="*/ACPI0004:??", \
+RUN+="/bin/sh -c ' \
+if [ $(cat /sys/$env{DEVPATH}/online) -eq 1 ]; then \
+ find -L /sys/$env{DEVPATH}/firmware_node/*/physical_node* -maxdepth 1 -name online | \
+ while read line; do \
+ if [ $(cat $line) -eq 1 ]; then \
+ /bin/echo 0 > $line; \
+ fi \
+ done; \
+ /bin/echo 0 > /sys/$env{DEVPATH}/online; \
+fi'"
\ No newline at end of file