Open jichenjc opened 1 month ago
@jichenjc Thanks for reporting!
Can you please provide the logs and user-data that came from openstack?
will openstack logs helpful here ? as when the VM is created, then openstack not involved anymore I will request the user data from my colleagues ,
some example of the issue with more detail originally from /etc/fstab during cloud-init setup , /dev/vdb is selected as swap disk and it's setup to system , so everything is fine
/dev/vdb none swap sw,comment=cloudconfig 0 0 <----THIS IS THE MAPPING AT DEPLOY TIME
/dev/datavg/datalv /data xfs defaults 0 0
then after hard reboot
from openstack , which will undefine the xml and create the virsh xml from openstack db
due to the reason I pasted above, the original disk become vdc which makes /etc/fstab definition incorrect anymore
#lsblk
...
└─vda2 252:2 0 512M 0 part /boot
vdb 252:16 0 100G 0 disk
└─vdb1 252:17 0 100G 0 part
└─datavg-datalv 253:0 0 100G 0 lvm /data
vdc 252:32 0 32G 0 disk <------------ THIS SHOULD BE THE SWAP DISK
[root@rh90-kvm000 404dde05-7b5c-4df3-84b4-7cbffd45e42a]# pwd
/var/lib/cloud/instances/404dde05-7b5c-4df3-84b4-7cbffd45e42a
[root@rh90-kvm000 404dde05-7b5c-4df3-84b4-7cbffd45e42a]# ls -lh
total 36K
-rw-r--r--. 1 root root 57 Jul 20 00:34 boot-finished
-rw-------. 1 root root 0 Jul 20 00:34 cloud-config.txt
-rw-r--r--. 1 root root 74 Jul 20 00:34 datasource
drwxr-xr-x. 2 root root 6 Jul 20 00:28 handlers
-r--------. 1 root root 8.7K Jul 20 00:34 obj.pkl
drwxr-xr-x. 2 root root 6 Jul 20 00:28 scripts
drwxr-xr-x. 2 root root 4.0K Jul 20 00:28 sem
-rw-------. 1 root root 0 Jul 20 00:34 user-data.txt
-rw-------. 1 root root 308 Jul 20 00:34 user-data.txt.i
-rw-------. 1 root root 0 Jul 20 00:34 vendor-data.txt
-rw-------. 1 root root 308 Jul 20 00:34 vendor-data.txt.i
-rw-------. 1 root root 0 Jul 20 00:34 vendor-data2.txt
-rw-------. 1 root root 308 Jul 20 00:34 vendor-data2.txt.i
[root@rh90-kvm000 404dde05-7b5c-4df3-84b4-7cbffd45e42a]#
is this the user data you are looking for ?it's 0 so no user input from openstack side ..
@jichenjc maybe you could use another path to identify the device as a workaround ? (for example I use /dev/disk/by-id/scsi-0QEMU_QEMU_HARDDISK_drive-scsi1-part1
)
Of course this would be a temporary fix until cloud-init has proper support for UUID on disks
ok, thanks for valuable feedback, I will check what I can do here to bypass ..
this might work for SCSI disks, but for swap I doubt it's doable... will do more checks here, thanks
Bug report
with default cloud-init installation and default cloud settings , if I create a VM through openstack with swap disk (e.g 1G) and using the image here I got one root and 1 swap disk ,they can be /dev/vda , /dev/vdb
now, with default cloud-init the /etc/fstab is created like
my expectation is the /etc/fstab need to be following (replace the /dev/vdb with the UUID=) ,so over reboot even the /dev/vdb might be chagned to /dev/vdc due to additional disk is added, it won't affect the swap disk function , otherwise, from libvirt that the /dev/vdx disk order are not guaranteed, the swap disk might point to other data disks..
some info from libvirt
some detailed info
Steps to reproduce the problem
Environment details
cloud-init logs