Bug 1252477 - power_state_change module not enabled by default
power_state_change module not enabled by default
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: cloud-init (Show other bugs)
7.4
x86_64 Linux
medium Severity low
: rc
: 7.4
Assigned To: Lars Kellogg-Stedman
Vratislav Hutsky
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-11 10:08 EDT by Jaroslav Henner
Modified: 2017-08-01 19:23 EDT (History)
3 users (show)

See Also:
Fixed In Version: cloud-init-0.7.9-6.el7
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2017-08-01 19:23:42 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jaroslav Henner 2015-08-11 10:08:56 EDT
Description of problem:
Cloud-init doesn't have the power_state_change module enabled by default. That causes that it is cumbersome to reboot the VM after some changes were applied by cloud-init.

This can be workarounded by enabling it on-demand, but then all the modules required have to be specified in the cloud-config, which is quite inconvenient:

#cloud-config
cloud_final_modules:
 - rightscale_userdata
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - ssh-authkey-fingerprints
 - keys-to-console
 - phone-home
 - final-message
 - power_state_change
power_state:
 delay: "now"
 mode: reboot
 message: Rebooting due to atomic host update was performed
 timeout: 30
the fix is to make sure that this module is in the cloud-init defaults (/etc/cloud/cloud.cfg).

---8<---8<---8<---8<
...
cloud_final_modules:
 - rightscale_userdata
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - ssh-authkey-fingerprints
 - keys-to-console
 - phone-home
 - final-message
 - power_state_change
...
---8<---8<---8<---8<

Version-Release number of selected component (if applicable):
cloud-init 0.7.6


How reproducible:
always

Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:
Comment 5 Vratislav Hutsky 2017-07-20 09:04:59 EDT
Verified on RHEL 7.4 Release Candidate in AWS (ami-3d6ecc52 in the eu-central-1 region). 

# rpm -iq cloud-init
cloud-init-0.7.9-9.el7.x86_64


# cat /etc/cloud/cloud.cfg
...
cloud_final_modules:
 - rightscale_userdata
 - scripts-per-once
 - scripts-per-boot
 - scripts-per-instance
 - scripts-user
 - ssh-authkey-fingerprints
 - keys-to-console
 - phone-home
 - final-message
 - power-state-change
...
(I omitted parts of /etc/cloud/cloud.cfg)




When I starting a machine with this user data:

#cloud-config
power_state:
 delay: "now"
 mode: poweroff
 message: Stopping the machine
 timeout: 30


the machine was stopped indeed and the /var/log/cloud-init.log contained the following lines:

2017-07-20 12:29:50,366 - cc_power_state_change.py[DEBUG]: After pid 1325 ends, will execute: shutdown -P now Stopping the machine
2017-07-20 12:29:50,368 - handlers.py[DEBUG]: finish: modules-final/config-power-state-change: SUCCESS: config-power-state-change ran successfully
Comment 6 errata-xmlrpc 2017-08-01 19:23:42 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2017:2275

Note You need to log in before you can comment on or make changes to this bug.