ironic-python-agent/ironic_python_agent/shell/shutdown.sh
Lucas Alvares Gomes cbd90c1c14 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
2016-03-21 12:57:50 +00:00

27 lines
712 B
Bash

#!/bin/bash
# Copyright 2013 Rackspace, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
# flush file system buffers
sync
if [[ $1 = '-h' ]]; then
poweroff
elif [[ $1 = '-r' ]]; then
reboot
fi