Bhyve allows to set eui64 for the NVMe disks: eui64 IEEE Extended Unique Identifier (8 byte value). And in a real command line: -s 5:0,nvme,/data/img/10gb.img,ser=BHYVE-NVME01-F000,eui64=0x01000000efbeadde Model that using the <wwn> element: <disk type='file'> <driver name='file' type='raw'/> <source file='/path/to/some.img'/> <target dev='nvme0n1' bus='nvme'/> <wwn>01000000efbeadde</wwn> </disk> As this element does not allow commas, it's not necessary to add additional validation for that. Closes: https://gitlab.com/libvirt/libvirt/-/work_items/901 Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- I think there's a bug in bhyve that results in a reversed order value, so I have to use "01000000efbeadde" to get "deadbeef00000001". I'm trying to address that in https://reviews.freebsd.org/D59080. src/bhyve/bhyve_command.c | 4 ++++ .../x86_64/bhyvexml2argv-2-nvme-2-controllers.args | 2 +- .../x86_64/bhyvexml2argv-2-nvme-2-controllers.xml | 1 + .../x86_64/bhyvexml2argv-nvme-explicit-controller.args | 2 +- .../x86_64/bhyvexml2argv-nvme-explicit-controller.xml | 1 + .../x86_64/bhyvexml2xmlout-2-nvme-2-controllers.xml | 1 + .../x86_64/bhyvexml2xmlout-nvme-explicit-controller.xml | 1 + 7 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c index 956fcab06c..f0a87cffea 100644 --- a/src/bhyve/bhyve_command.c +++ b/src/bhyve/bhyve_command.c @@ -479,6 +479,10 @@ bhyveBuildNVMeControllerArgStr(const virDomainDef *def, virBufferAsprintf(&opt, ",maxq=%d", disk->queues); if (disk->queue_size) virBufferAsprintf(&opt, ",qsz=%d", disk->queue_size); + if (disk->wwn) + virBufferAsprintf(&opt, ",eui64=%s%s", + STRPREFIX(disk->wwn, "0x") ? "" : "0x", + disk->wwn); if (controller->opts.nvmeopts.serial) virBufferAsprintf(&opt, ",ser=%s", controller->opts.nvmeopts.serial); diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-nvme-2-controllers.args b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-nvme-2-controllers.args index 664eec99bc..5be39bda1d 100644 --- a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-nvme-2-controllers.args +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-nvme-2-controllers.args @@ -5,6 +5,6 @@ bhyve \ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,nvme,/tmp/freebsd.img \ +-s 2:0,nvme,/tmp/freebsd.img,eui64=0xdeadbeef00000001 \ -s 3:0,nvme,/tmp/data.img \ bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-nvme-2-controllers.xml b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-nvme-2-controllers.xml index 30f337197e..6a5efd3831 100644 --- a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-nvme-2-controllers.xml +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-2-nvme-2-controllers.xml @@ -11,6 +11,7 @@ <driver name='file' type='raw'/> <source file='/tmp/freebsd.img'/> <target dev='nvme0n1' bus='nvme'/> + <wwn>0xdeadbeef00000001</wwn> </disk> <disk type='file'> <driver name='file' type='raw'/> diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-explicit-controller.args b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-explicit-controller.args index 74dd4baa37..022a4df209 100644 --- a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-explicit-controller.args +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-explicit-controller.args @@ -5,5 +5,5 @@ bhyve \ -H \ -P \ -s 0:0,hostbridge \ --s 2:0,nvme,/tmp/freebsd.img,maxq=2,qsz=256,ser=BHYVE-NVME0-01234 \ +-s 2:0,nvme,/tmp/freebsd.img,maxq=2,qsz=256,eui64=0x01000000efbeadde,ser=BHYVE-NVME0-01234 \ bhyve diff --git a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-explicit-controller.xml b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-explicit-controller.xml index 9781d3aaef..fb7ed573c5 100644 --- a/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-explicit-controller.xml +++ b/tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-explicit-controller.xml @@ -14,6 +14,7 @@ <driver name='file' type='raw' queues='2' queue_size='256'/> <source file='/tmp/freebsd.img'/> <target dev='nvme0n1' bus='nvme'/> + <wwn>01000000efbeadde</wwn> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> </devices> diff --git a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-2-nvme-2-controllers.xml b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-2-nvme-2-controllers.xml index d0eb9c7fc8..107beef587 100644 --- a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-2-nvme-2-controllers.xml +++ b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-2-nvme-2-controllers.xml @@ -17,6 +17,7 @@ <driver name='file' type='raw'/> <source file='/tmp/freebsd.img'/> <target dev='nvme0n1' bus='nvme'/> + <wwn>0xdeadbeef00000001</wwn> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <disk type='file' device='disk'> diff --git a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-nvme-explicit-controller.xml b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-nvme-explicit-controller.xml index f646267ec5..7c4dd2cdb3 100644 --- a/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-nvme-explicit-controller.xml +++ b/tests/bhyvexml2xmloutdata/x86_64/bhyvexml2xmlout-nvme-explicit-controller.xml @@ -17,6 +17,7 @@ <driver name='file' type='raw' queues='2' queue_size='256'/> <source file='/tmp/freebsd.img'/> <target dev='nvme0n1' bus='nvme'/> + <wwn>01000000efbeadde</wwn> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> <controller type='nvme' index='0'> -- 2.52.0
participants (1)
-
Roman Bogorodskiy