Custom scsi serials are only applied after restarten the VM

Please, describe the problem here and provide additional information below (if applicable) …


Versions of the related components and OS (frontend, hypervisors, VMs):

Alma 9, OpenNebula 7.0, KVM, iscsi storage with LVM driver

Steps to reproduce:

attach a new (only tried with volatile) disk to a VM via Sunstone, set a custom serial and check with udevadm info <disk> inside the VM

Current results:

before reboot the serial looks something like

ID_SERIAL=0QEMU_QEMU_HARDDISK_drive-scsi0-0-18-0 and ID_SCSI_SERIAL is missing

after reboot both are working

Expected results:

both serials to be set without a reboot

Hello,

Have you triggered the udevadm rules (sudo udevadm trigger) after the disk is attached?
Do dmesg and lshw show any useful information before the VM is rebooted?

Thanks

i’ve tried triggering the udev rules, nothing changed. i’m not sure how that’s supposed to update the serial though.

dmesg shows:

[6849284.483828] scsi 0:0:23:0: Direct-Access     QEMU     QEMU HARDDISK    2.5+ PQ: 0 ANSI: 5
[6849284.605794] sd 0:0:23:0: Power-on or device reset occurred
[6849284.606890] sd 0:0:23:0: LUN assignments on this target have changed. The Linux SCSI layer does not automatically remap LUN assignments.
[6849284.607071] sd 0:0:23:0: [sda] 31457280 512-byte logical blocks: (16.1 GB/15.0 GiB)
[6849284.607793] sd 0:0:23:0: [sda] Write Protect is off
[6849284.607797] sd 0:0:23:0: [sda] Mode Sense: 63 00 00 08
[6849284.608017] sd 0:0:23:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[6849284.610834] sd 0:0:23:0: [sda] Attached SCSI disk
[6849284.612076] sd 0:0:23:0: Attached scsi generic sg1 type 0

lshw:

  *-disk
       description: SCSI Disk
       product: QEMU HARDDISK
       vendor: QEMU
       physical id: 0.17.0
       bus info: scsi@0:0.23.0
       logical name: /dev/sda
       version: 2.5+
       size: 15GiB (16GB)
       capabilities: 5400rpm
       configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512

i think the issue is with the attach_disk script. after attaching the disk virsh dumpxml also doesn’t show a serial for the disk:

    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' discard='unmap'/>
      <source dev='/var/lib/one//datastores/100/45/disk.2' index='4'/>
      <backingStore/>
      <target dev='sdx' bus='scsi'/>
      <alias name='scsi0-0-23-0'/>
      <address type='drive' controller='0' bus='0' target='23' unit='0'/>
    </disk>

after powering off and restarting the vm:

    <disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='none' discard='unmap'/>
      <source dev='/var/lib/one//datastores/100/45/disk.2' index='2'/>
      <backingStore/>
      <target dev='sdx' bus='scsi'/>
      <serial>test.serial</serial>
      <alias name='scsi0-0-23-0'/>
      <address type='drive' controller='0' bus='0' target='23' unit='0'/>
    </disk>

Could you try the attached patch?

attach_disk_serial.patch (1.4 KB)

Should be applied on the frontend:

# become the oneadmin user
sudo -i -u oneadmin
# apply the patch
patch -b -p 0 <...path_to/attach_disk_serrial.patch
# populate the patched drivers on the hosts
onehost sync --force

Best Regards,
Anton Todorov

patch works perfectly, thanks!

1 Like

Great,

Just added a github issue with the patch.

Best Regards,
Anton Todorov

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.