[PATCH 2/2] node_device: Treat NVMe disks as regular disks

Peter Krempa pkrempa at redhat.com
Wed Jan 26 16:11:11 UTC 2022


On Wed, Jan 26, 2022 at 14:13:21 +0100, Michal Privoznik wrote:
> Unfortunately, udev doesn't set ID_TYPE attribute for NVMe disks,
> therefore we have to add another case into udevKludgeStorageType()
> to treat /dev/nvme* devlinks as any other disk.

I had to do a bit digging because /dev/nvme0 a controller and not a
storage device, but it turns out the function below is called only for
the namespace portion which is a storage device and not even the
partition portion, so the code itself is good.

> 
> Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2045953
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/node_device/node_device_udev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
> index 14acb3fee0..27efda1ab0 100644
> --- a/src/node_device/node_device_udev.c
> +++ b/src/node_device/node_device_udev.c
> @@ -900,6 +900,9 @@ udevKludgeStorageType(virNodeDeviceDef *def)
>           * ID_TYPE=disk does not exist on DASDs they fall through
>           * the udevProcessStorage detection logic. */
>          { "/dev/dasd", "dasd" },
> +
> +        /* NVMe disk */

e.g. for example note here that this is called for /dev/nvme0n1 and
alike only so doing a prefix match is okay.

> +        { "/dev/nvme", "disk" },
>      };
>  
>      VIR_DEBUG("Could not find definitive storage type for device "

Reviewed-by: Peter Krempa <pkrempa at redhat.com>




More information about the libvir-list mailing list