bhyve: support setting serial number for SATA disks

bhyve supports passing disk serial number using the "ser=<SN>"
option, so update bhyveBuildAHCIControllerArgStr() to set it
from the "serial" element.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Roman Bogorodskiy committed 2026-08-21 13:43:35 +02:00
1 parent 5a59a74769
commit 083db37e22
3 files changed
+7 -1

No files matched your search

+3
View File
@@ -333,6 +333,9 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
if (disk->rotation_rate)
virBufferAsprintf(&device, ",nmrr=%u", disk->rotation_rate);
if (disk->serial)
virBufferAsprintf(&device, ",ser=%s", disk->serial);
virBufferAddBuffer(&buf, &device);
}
@@ -5,6 +5,6 @@ bhyve \
-H \
-P \
-s 0:0,hostbridge \
-s 2:0,ahci,hd:/tmp/freebsd1.img,nmrr=7200,hd:/tmp/freebsd2.img,nmrr=5400,hd:/tmp/freebsd3.img,nmrr=1 \
-s 2:0,ahci,hd:/tmp/freebsd1.img,nmrr=7200,ser=BHYVE-SER01-0001,hd:/tmp/freebsd2.img,nmrr=5400,ser=BHYVE-SER02-0004,hd:/tmp/freebsd3.img,nmrr=1,ser=BHYVE-SER03-1234 \
-s 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 \
bhyve
@@ -8,16 +8,19 @@
</os>
<devices>
<disk type='file'>
<serial>BHYVE-SER01-0001</serial>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd1.img'/>
<target dev='hda' bus='sata' rotation_rate='7200'/>
</disk>
<disk type='file'>
<serial>BHYVE-SER02-0004</serial>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd2.img'/>
<target dev='hdb' bus='sata' rotation_rate='5400'/>
</disk>
<disk type='file'>
<serial>BHYVE-SER03-1234</serial>
<driver name='file' type='raw'/>
<source file='/tmp/freebsd3.img'/>
<target dev='hdc' bus='sata' rotation_rate='1'/>