[PATCH] qemu: implement NVMe device emulation support

Peter Krempa pkrempa at redhat.com
Thu May 13 05:39:51 UTC 2021


On Thu, May 13, 2021 at 11:45:25 +0800, Zhiyong Ye wrote:
> Implements QEMU support for NVMe device emulation, which was added in
> qemu 1.6.0:
> 
> https://git.qemu.org/?p=qemu.git;a=commit;h=f3c507adcd7
> 
> It can be used by adding elements in XML like this:
> <devices>
>   ...
>   <disk type='file' device='disk'>
>     <driver name='qemu' type='raw'/>
>     <source file='/var/lib/libvirt/images/nvme.img'/>
>     <target dev='nvmea' bus='nvme'/>
>     <serial>QEMU-WMAP9A966149</serial>
>   </disk>
>   ...
> </devices>
> 
> Signed-off-by: Zhiyong Ye <yezhiyong at bytedance.com>
> Signed-off-by: zhenwei pi <pizhenwei at bytedance.com>
> ---
>  docs/formatdomain.rst                         | 11 ++++++--
>  docs/schemas/domaincommon.rng                 |  3 ++-
>  src/bhyve/bhyve_command.c                     |  1 +
>  src/bhyve/bhyve_domain.c                      |  1 +
>  src/conf/domain_conf.c                        |  5 ++++
>  src/conf/domain_conf.h                        |  1 +
>  src/conf/domain_validate.c                    |  4 ++-
>  src/hyperv/hyperv_driver.c                    |  2 ++
>  src/qemu/qemu_alias.c                         |  1 +
>  src/qemu/qemu_command.c                       |  8 ++++++
>  src/qemu/qemu_domain_address.c                | 11 +++++---
>  src/qemu/qemu_hotplug.c                       |  2 ++
>  src/qemu/qemu_validate.c                      | 13 ++++++++++
>  src/util/virutil.c                            |  3 ++-
>  src/vbox/vbox_common.c                        |  1 +
>  src/vz/vz_sdk.c                               |  2 ++
>  src/vz/vz_utils.c                             |  1 +
>  tests/qemuxml2argvdata/disk-nvme-device.args  | 28 +++++++++++++++++++++
>  tests/qemuxml2argvdata/disk-nvme-device.xml   | 30 ++++++++++++++++++++++
>  tests/qemuxml2argvtest.c                      |  1 +
>  tests/qemuxml2xmloutdata/disk-nvme-device.xml | 36 +++++++++++++++++++++++++++
>  tests/qemuxml2xmltest.c                       |  1 +
>  22 files changed, 157 insertions(+), 9 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/disk-nvme-device.args
>  create mode 100644 tests/qemuxml2argvdata/disk-nvme-device.xml
>  create mode 100644 tests/qemuxml2xmloutdata/disk-nvme-device.xml

Hi, firstly it's customary in libvirt to split patches at least into the
following categories:

conf/ and XML additions

qemu/qemu_capabilities as separate change

and then required changes to the qemu driver possibly also split if
there are appropriate points.

Please note that after every commit the tree MUST compile cleanly
although obviously the new feature is not required to work properly
until the end of the series.

Additionally there was a discussion some time ago where we've discussed
some of the technicalies:

https://listman.redhat.com/archives/libvir-list/2020-November/msg00415.html

We've discussed there that the NVMe device should be more like a
'<controller>' and '<disk>' would map to a signle namespace on the
controller. According to that thread NVMe actually supports that.




More information about the libvir-list mailing list