From cbd90c1c14e083c5cc563cfd94f55266d28f77be Mon Sep 17 00:00:00 2001 From: Lucas Alvares Gomes Date: Tue, 15 Mar 2016 11:15:59 +0000 Subject: [PATCH] Replace SYSRQ commands This patch is modifying the shutdown.sh script to not use SYSRQ when performing power actions. SYSRQ has a similar effect to a hardware reset button/power switch, which can be problematic after copying an image to the disk (data loss) therefore, this patch is changing the script to use soft power action via the poweroff and reboot commands. SYSRQ was required before because the ironic-python-agent service was running inside a docker container, but since we've moved it to run into a chroot (when built with coreos) or on the ramdisk's OS (when built with DIB) the SYSRQ actions are not needed anymore. In many parts of Ironic we were considering the standby.{power_off, reboot} methods of IPA to be soft actions, which they are not at present. This patch is also fixing that assumption. Change-Id: Ibe3a3f61a4a0e98b2c2501ad95154839933b4d7a Closes-Bug: #1557450 --- ironic_python_agent/shell/shutdown.sh | 11 ++++------- releasenotes/notes/remove-sysrq-2c2804930180f408.yaml | 7 +++++++ 2 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/remove-sysrq-2c2804930180f408.yaml diff --git a/ironic_python_agent/shell/shutdown.sh b/ironic_python_agent/shell/shutdown.sh index 3c7738c77..b685d28f7 100644 --- a/ironic_python_agent/shell/shutdown.sh +++ b/ironic_python_agent/shell/shutdown.sh @@ -14,16 +14,13 @@ # See the License for the specific language governing permissions and # limitations under the License. -# This script reboots by echoing into /proc/sysrq_trigger. - set -e -# Make sure all functions of sysrq is enabled. -echo "1" > /proc/sys/kernel/sysrq +# flush file system buffers +sync -echo "s" > /proc/sysrq-trigger if [[ $1 = '-h' ]]; then - echo "o" > /proc/sysrq-trigger + poweroff elif [[ $1 = '-r' ]]; then - echo "b" > /proc/sysrq-trigger + reboot fi diff --git a/releasenotes/notes/remove-sysrq-2c2804930180f408.yaml b/releasenotes/notes/remove-sysrq-2c2804930180f408.yaml new file mode 100644 index 000000000..f2dc2a5c2 --- /dev/null +++ b/releasenotes/notes/remove-sysrq-2c2804930180f408.yaml @@ -0,0 +1,7 @@ +--- +fixes: + - Stop using SYSRQ when performing the in-band reboot or power off + because it has a similar effect to a hardware reset button/power + switch and can be problematic on some hardware types. Instead, + reboot/power off the node via the "poweroff" and "reboot" commands + (soft power action).