canonical / cloud-init

Official upstream for the cloud-init: cloud instance initialization
https://cloud-init.io/
Other
2.99k stars 882 forks source link

OpenBSD: disk-based DataSource detection is unreliable #4711

Open igalic opened 10 months ago

igalic commented 10 months ago

Bug report

in ds-identify, OpenBSD disk detection doesn't exist, which means it uses the Linux paths, which don't work. in the Python code, the disk-detection looks rather questionable:

https://github.com/canonical/cloud-init/blob/4f60ff099eb0a6f57595706f4d34cf713d3c02b1/cloudinit/util.py#L1444-L1458

none of the criteria are actually considered. We only return any found cd drives, whether those have anything mounted or not. But a source could just as well be mounted as disk.

Steps to reproduce the problem

Environment details

hcartiaux commented 7 months ago

I had a look at that.

So it uses this sysctl command, which returns a very thin output:

# sysctl -n hw.disknames                                                                                                                                                                                                                                                                                               
cd0:,cd1:,sd0:34abf85fbe2151ba,fd0:

To know if there's something behind cd0, cd1, fd0, disklabel can be used:

disklabel cd0 
# /dev/rcd0c:
type: ATAPI
disk: cidata          
label:                 
duid: 0000000000000000
flags:
bytes/sector: 2048
sectors/track: 100
tracks/cylinder: 1
sectors/cylinder: 100
cylinders: 2
total sectors: 182
boundstart: 0
boundend: 182

16 partitions:
#                size           offset  fstype [fsize bsize   cpg]
  a:              182                0 ISO9660                    
  c:              182                0 ISO9660