Bug 1574656

Summary: cloudinit is not putting the systemd mount options to wait for cloudinit
Product: Red Hat Enterprise Linux 7 Reporter: Dan <danis>
Component: cloud-initAssignee: Eduardo Otubo <eterrell>
Status: CLOSED ERRATA QA Contact: Vratislav Hutsky <vhutsky>
Severity: high Docs Contact:
Priority: high    
Version: 7.5CC: ailan, danis, dkinkead, eterrell, ipinto, jenander, jen, jgreguske, linl, mkrcmari, mprashad, mrezanin, mtessun, paulmey, ribarry, tdrake, ushkalim, vkuznets, wshi, yacao, yujiang, yuxisun
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cloud-init-18.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1641404 (view as bug list) Environment:
Last Closed: 2018-10-30 11:30:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1560415    
Bug Blocks:    
Attachments:
Description Flags
patch and cmds none

Description Dan 2018-05-03 18:55:03 UTC
Created attachment 1430864 [details]
patch and cmds

Description of problem:
Related to bug 1560415, when you provision a VM using cloud-init on azure, then deallocate it, and start it, it does not mount the ephemeral disk.

Version-Release number of selected component (if applicable):
7.5

How reproducible:
az group create --name myrg --location centralus

## create new VM
az vm create \
  --resource-group myrg \
  --name rh75 \
  --admin-username myadmin \
  --image RedHat:RHEL:7-RAW-CI:latest \
  --ssh-key-value /.. 

run : cat /proc/mounts, you will see:
/dev/sdb1 /mnt ext4 rw,seclabel,relatime,data=ordered 0 0

dealloc and start:
az vm deallocate --resource-group myrg --name rh75
az vm start --resource-group myrg --name rh75


Actual results:
run : cat /proc/mounts, you will see no entry for /dev/sdb1

Expected results:
/dev/sdb1 /mnt ext4 rw,seclabel,relatime,data=ordered 0 0

Additional info:
We have been testing with the attached patch, cloudinit is not putting the systemd mount options to wait for cloudinit, while the code on disk shows it should, can you take a look?

Please also be aware this is blocking GA for cloud-init on RHEL, we have multiple customers waiting for this.

Comment 2 Vitaly Kuznetsov 2018-05-07 10:54:38 UTC
Hi Dan,

this is a config issue. If you modify your /etc/cloud/cloud.cfg:

diff --git a/redhat/cloud-init-rhel.cfg b/redhat/cloud-init-rhel.cfg
index 986f241e..b38fe13a 100644
--- a/redhat/cloud-init-rhel.cfg
+++ b/redhat/cloud-init-rhel.cfg
@@ -4,7 +4,7 @@ users:
 disable_root: 1
 ssh_pwauth:   0
 
-mount_default_fields: [~, ~, 'auto', 'defaults,nofail', '0', '2']
+mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']
 resize_rootfs_tmp: /dev
 ssh_deletekeys:   0
 ssh_genkeytypes:  ~

things will likely work as expected (or, at least this particular issue should be gone). Could you please try it? In the meantime I'll try to make this the default for RHEL7.

Comment 3 Dan 2018-05-07 23:53:13 UTC
Hi Vitaly, thanks for this, i ran through these tests, checking that mounts existed, and monitor for critical errors.
1) Create VM from CI Image, apply patch attached and your additional config (/etc/cloud/cloud.cfg), then deallocate VM.
All tests passed
2) VM Restart (shutdown -r now)
All tests passed
3) Create custom image from VM created in step1
All tests passed
4) Deallocate and Start VM created from custom image
All tests passed
5) Create custom image from VM created in step1, but add 2 data disks
All tests passed

Can you put this change into the RHEL cloud-init package?

Comment 6 Eduardo Otubo 2018-05-11 13:13:45 UTC
(In reply to Dan from comment #3)
> Hi Vitaly, thanks for this, i ran through these tests, checking that mounts
> existed, and monitor for critical errors.
> 1) Create VM from CI Image, apply patch attached and your additional config
> (/etc/cloud/cloud.cfg), then deallocate VM.
> All tests passed
> 2) VM Restart (shutdown -r now)
> All tests passed
> 3) Create custom image from VM created in step1
> All tests passed
> 4) Deallocate and Start VM created from custom image
> All tests passed
> 5) Create custom image from VM created in step1, but add 2 data disks
> All tests passed
> 
> Can you put this change into the RHEL cloud-init package?

@Dan, as updated on the other BZ#1560415, I included these changes on the package as well and will submit the package for testing. Will keep this BZ updated as well.

Comment 7 Dan 2018-05-11 15:01:53 UTC
Thanks! Waiting on the maintainers for feedback on the other patch, will chase today.

Comment 14 Vladimir 2018-05-17 07:51:41 UTC
I've run automation sanity for this build using cloud-init on RHEV
All tests passed successfully

Comment 15 Yuxin Sun 2018-05-17 08:04:16 UTC
Ran regression test in Huawei and Alibaba clouds. Result is pass.

Comment 17 Dan 2018-05-17 15:30:27 UTC
Thanks!

Comment 24 Eduardo Otubo 2018-07-11 12:18:20 UTC
@Mirek can you give devel_ack on this? I believe we're good to go.

Comment 25 Rick Barry 2018-07-11 14:34:12 UTC
Eduardo, devel_ack is already set. All 3 acks are set for 7.6. Was this just waiting for the cloud-init 18.2 rebase? Should this be moved to POST/MODIFIED?

Comment 26 Eduardo Otubo 2018-07-12 12:37:59 UTC
(In reply to Rick Barry from comment #25)
> Eduardo, devel_ack is already set. All 3 acks are set for 7.6. Was this just
> waiting for the cloud-init 18.2 rebase? Should this be moved to
> POST/MODIFIED?

Yes, it was waiting for the rebase and looks like all pre-tests were ok. I'm not sure which status this BZ should be changed to, though.

Comment 27 Rick Barry 2018-07-12 14:56:09 UTC
I believe the next step is for Mirek to add this BZ to the RHEL 7.6 errata so it can move to ON_QA.

Comment 30 Yuxin Sun 2018-07-25 05:48:23 UTC
Hi Eduardo,

This line "mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']" is not in cloud.cfg by default in cloud-init-18.2-1.el7.x86_64.rpm. Do we need to add this line into the package? Thanks!

Comment 37 Yuhui Jiang 2018-10-19 21:43:40 UTC
Test with cloud-init-18.2-1.el7_6.1 in RHEL7.6, this issue has fixed.
But cloud-init-18.2-1.el8 in RHEL8.0,this issue still exists.There is not "x-systemd.requires=cloud-init.service" in /etc/cloud/cloud.cfg

Comment 39 Yuhui Jiang 2018-10-22 02:50:57 UTC
Due to this issue has fixed in RHEL7.6, so change current status to VERIFIED, and clone a new bug(bz#1641404) for RHEL8.0 tracking.

Comment 41 errata-xmlrpc 2018-10-30 11:30:45 UTC
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/RHBA-2018:3241