Re: nvme virtualisation string for bhyve

From: Chuck Tuffli <chuck_at_tuffli.net>
Date: Sat, 14 Sep 2024 14:18:53 UTC
On Sat, Sep 14, 2024, at 6:14 AM, void wrote:
> ...
> I usually start my vms with a bhyve variable for the disk
> like:
> 
> -s 4,virtio-blk,/dev/zvol/ssd/vm2 \
> 
> The man page for bhyve says this:
> 
> ###  NVMe device backends
> ###       •   devpath[,maxq=#][,qsz=#][,ioslots=#][,sectsz=#][,ser=#][,eui64=#][,dsm=opt]
> 
> How do I get this information? Like maxq qsg ioslots sectorz ser eui64 dsm
> 
> The ssds are:
> 
> nvme0: <Intel DC PC4500>
> nvme1: <DC P3700 SSD>

If you want the guest to see their storage as an NVMe device, you would replace "virtio-blk" with "nvme" in your device specification above (i.e., -s 4,nvme,...). The bhyve NVMe emulation code will pick sensible values for the above device characteristics like the max number of supported queues (a.k.a., maxq). If you want to override the values bhyve picks, you can add those key-value pairs after the device name.

Note that the emulated device the guest VM sees is entirely separate from the devices providing the storage to the host OS. As an example, the guest can have an NVMe drive backed by a zpool on the host comprised of SATA or SCSI drives.

So if the question was, "how do I determine maxq, qsz, etc. from the host drive information?", the answer is, you wouldn't.

--chuck