cirros-dev / cirros

120 stars 33 forks source link

AHCI module missing leading to weirdness when booting from SATA based disks and attaching SATA based cdrom config drives #64

Closed lyarwood closed 3 years ago

lyarwood commented 3 years ago

The OpenStack Nova project is looking to start testing the q35 machine type provided by QEMU [1] in our CI. As this machine type drops IDE bus support config drives will be attached as SATA based cdroms [2]. While testing this in CI it was noticed that SATA attached devices aren't present within Cirros under lsblk etc causing some of our integration tests to fail.

This appears to be due to the ahci module not being present or loaded within the guest. What is odd is that we can actually boot from a SATA based cirros disk, the disk itself just never shows up inside the running guest.

Here's some examples with and without the module loaded:

[..]
  <os>
    <type arch='x86_64' machine='pc-q35-4.2'>hvm</type>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>
[..]
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/opt/stack/data/nova/instances/7a7aa8d2-4169-4409-82cc-d93000725d73/disk' index='2'/>
      <backingStore type='file' index='3'>
        <format type='raw'/>
        <source file='/opt/stack/data/nova/instances/_base/655031014c554bf503ad620fdf94729e0a1dcd4a'/>
        <backingStore/>
      </backingStore>
      <target dev='sda' bus='sata'/>
      <alias name='sata0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/opt/stack/data/nova/instances/7a7aa8d2-4169-4409-82cc-d93000725d73/disk.config' index='1'/>
      <backingStore/>
      <target dev='sdb' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
[..]
$ cat /etc/cirros/version 
0.5.1
$ lsblk
$ 
$ dmesg | grep -i sata
$ 

and with the module loaded...

[..]
  <os>
    <type arch='x86_64' machine='pc-q35-4.2'>hvm</type>
    <boot dev='hd'/>
    <smbios mode='sysinfo'/>
  </os>
[..]
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='none'/>
      <source file='/opt/stack/data/nova/instances/63a5d966-902f-4fad-adde-4492abf8f4f1/disk' index='2'/>
      <backingStore type='file' index='3'>
        <format type='raw'/>
        <source file='/opt/stack/data/nova/instances/_base/4f1431a6092d2d061812368ad6ea9bdcaad8ae90'/>
        <backingStore/>
      </backingStore>
      <target dev='sda' bus='sata'/>
      <alias name='sata0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/opt/stack/data/nova/instances/63a5d966-902f-4fad-adde-4492abf8f4f1/disk.config' index='1'/>
      <backingStore/>
      <target dev='sdb' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
[..]
$ cat /etc/cirros/version 
d210217
$ lsblk
NAME    MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda       8:0    0    1G  0 disk 
|-sda1    8:1    0 1015M  0 part /
`-sda15   8:15   0    8M  0 part 
sr0      11:0    1  482K  0 rom  
$ dmesg | grep -i sata
[    5.860366] ahci 0000:00:1f.2: AHCI 0001.0000 32 slots 6 ports 1.5 Gbps 0x3f impl SATA mode
[    5.863890] ata1: SATA max UDMA/133 abar m4096@0xfea29000 port 0xfea29100 irq 51
[    5.863911] ata2: SATA max UDMA/133 abar m4096@0xfea29000 port 0xfea29180 irq 51
[    5.863926] ata3: SATA max UDMA/133 abar m4096@0xfea29000 port 0xfea29200 irq 51
[    5.863946] ata4: SATA max UDMA/133 abar m4096@0xfea29000 port 0xfea29280 irq 51
[    5.863961] ata5: SATA max UDMA/133 abar m4096@0xfea29000 port 0xfea29300 irq 51
[    5.863981] ata6: SATA max UDMA/133 abar m4096@0xfea29000 port 0xfea29380 irq 51
[    6.175890] ata3: SATA link down (SStatus 0 SControl 300)
[    6.176421] ata6: SATA link down (SStatus 0 SControl 300)
[    6.176903] ata4: SATA link down (SStatus 0 SControl 300)
[    6.177390] ata5: SATA link down (SStatus 0 SControl 300)
[    6.177897] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[    6.180982] ata1: SATA link up 1.5 Gbps (SStatus 113 SControl 300)

[1] https://wiki.qemu.org/Features/Q35 [2] https://github.com/openstack/nova/blob/2e8d87098c9b714cf347dfe1ffdd9cbca3175c1a/nova/virt/libvirt/blockinfo.py#L258-L264