As a test, i changed the FSTAB entry for the swap to add a dependency on cloud-init:
/dev/disk/cloud/azure_resource-part2 none swap sw,nofail,x-systemd.requires=cloud-init.service,comment=cloudconfig 0 0
I deallocated and started the VM, sdb mounts correctly, but the FSTAB is overwritten for swap with the previous config. I modified the FSTAB again, with the addition, then rebooted, again, everything works.
Does azure_resource-part2 need a dependency like azure_resource-part1?
You can also test this using the existing Azure cloud-init preview images (cloud-init 0.7.9.x)
az vm create
--resource-group rgName
--name vmName
--image RedHat:RHEL:7-RAW-CI:latest
--admin-username anotherusr
--custom-data /../swapconfig.txt
--ssh-key-value /.../my.pub
az vm deallocate --resource-group rgName --name vmName
az vm start --resource-group rgName --name vmName
Environment : RHEL 7.5 on Azure, using cloud-init 18.2 rebase with these patches: https:/ /git.launchpad. net/cloud- init/commit/ ?id=aa4eeb80
Scenario:
I provision an image with the above on Azure, in addition, i apply this cloud-init config:
#cloud-config
disk_setup:
ephemeral0:
table_type: gpt
layout: [66, [33, 82]]
overwrite: True
fs_setup:
- device: ephemeral0.1
filesystem: ext4
- device: ephemeral0.2
filesystem: swap
mounts:
- ["ephemeral0.1", "/mnt"]
- ["ephemeral0.2", "none", "swap", "sw", "0", "0"]
The VM provisions successfully, you see /sdb1 gets mounted and the swap file config succeeds.
If i deallocate the VM and start it, /sdb1 does not get mounted, you see the errors below.
2018-06-20 19:50:38,138 - util.py[WARNING]: Failed reading the partition table Unexpected error while running command. sbin/blockdev' , '--rereadpt', '/dev/sdb'] sbin/blockdev' , '--rereadpt', '/dev/sdb'] python2. 7/site- packages/ cloudinit/ config/ cc_disk_ setup.py" , line 685, in read_parttbl subp(blkdev_ cmd) python2. 7/site- packages/ cloudinit/ util.py" , line 1958, in subp nError: Unexpected error while running command.
Command: ['/usr/
Exit code: 1
Reason: -
Stdout:
Stderr: blockdev: ioctl error on BLKRRPART: Device or resource busy
2018-06-20 19:50:38,138 - util.py[DEBUG]: Failed reading the partition table Unexpected error while running command.
Command: ['/usr/
Exit code: 1
Reason: -
Stdout:
Stderr: blockdev: ioctl error on BLKRRPART: Device or resource busy
Traceback (most recent call last):
File "/usr/lib/
util.
File "/usr/lib/
cmd=args)
ProcessExecutio
Running multiple deallocates and starts does not see the system resolve itself.
I check fstab: 1ec3-4c27- 9c16-afb90a4c45 13 / xfs defaults 0 0 4be6-4b72- b107-c2d7a68688 c4 /boot xfs defaults 0 0 cloud/azure_ resource- part1 /mnt auto defaults, nofail, x-systemd. requires= cloud-init. service, comment= cloudconfig 0 2 cloud/azure_ resource- part2 none swap sw,comment= cloudconfig 0 0
UUID=6e4681f0-
UUID=f2116236-
/dev/disk/
/dev/disk/
As a test, i changed the FSTAB entry for the swap to add a dependency on cloud-init: cloud/azure_ resource- part2 none swap sw,nofail, x-systemd. requires= cloud-init. service, comment= cloudconfig 0 0
/dev/disk/
I deallocated and started the VM, sdb mounts correctly, but the FSTAB is overwritten for swap with the previous config. I modified the FSTAB again, with the addition, then rebooted, again, everything works.
Does azure_resource- part2 need a dependency like azure_resource- part1?
You can also test this using the existing Azure cloud-init preview images (cloud-init 0.7.9.x) RHEL:7- RAW-CI: latest
az vm create
--resource-group rgName
--name vmName
--image RedHat:
--admin-username anotherusr
--custom-data /../swapconfig.txt
--ssh-key-value /.../my.pub
az vm deallocate --resource-group rgName --name vmName
az vm start --resource-group rgName --name vmName
Thanks,