On Fri, Jul 31, 2026 at 19:52:05 +0200, Roman Bogorodskiy wrote:
As bhyve options are passed as a comma separated list, e.g.:
-s N:0,ahci,hd:/tmp/my.img,nmrr=7200,ser=BHYVE-SER01-0001
Do not allow using "," in the serial name. This applies to both NVMe and SATA disks.
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> --- src/bhyve/bhyve_domain.c | 15 ++++++++++++ .../bhyvexml2argv-nvme-invalid-serial.xml | 20 ++++++++++++++++ ...bhyvexml2argv-sata-disk-invalid-serial.xml | 23 +++++++++++++++++++ tests/bhyvexml2argvtest.c | 2 ++ tests/bhyvexml2xmltest.c | 2 ++ 5 files changed, 62 insertions(+) create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-nvme-invalid-serial.xml create mode 100644 tests/bhyvexml2argvdata/x86_64/bhyvexml2argv-sata-disk-invalid-serial.xml
This patch should go first before you do the actual impl.
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c index b6344185b7..1c588d9243 100644 --- a/src/bhyve/bhyve_domain.c +++ b/src/bhyve/bhyve_domain.c @@ -338,6 +338,13 @@ bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev, _("Bhyve virtio-serial controller supports up to 16 ports")); return -1; } + } else if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_NVME && + controller->opts.nvmeopts.serial) { + if (strchr(controller->opts.nvmeopts.serial, ',')) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Serial number may not contain ',' character")); + return -1; + } } break; } @@ -423,6 +430,14 @@ bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev, return -1; }
+ if (disk->bus == VIR_DOMAIN_DISK_BUS_SATA && disk->serial) { + if (strchr(disk->serial, ',')) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Serial number may not contain ',' character")); + return -1; + } + } + break; } case VIR_DOMAIN_DEVICE_NET: {
Reviewed-by: Peter Krempa <pkrempa@redhat.com>