src/bhyve/bhyve_command.c | 4 +++ src/bhyve/bhyve_domain.c | 6 ++++ ...hyvexml2argv-disk-virtio-rotation-rate.xml | 23 ++++++++++++++ .../bhyvexml2argv-sata-rotation-rate.args | 10 ++++++ .../bhyvexml2argv-sata-rotation-rate.ldargs | 4 +++ .../bhyvexml2argv-sata-rotation-rate.xml | 31 +++++++++++++++++++ tests/bhyvexml2argvtest.c | 2 ++ 7 files changed, 80 insertions(+) create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-rotation-rate.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.xml
Bhyve supports specifying disk rotation rate using the nmrr attribute,
e.g.:
-s 3:0,ahci,hd:/data/img/freebsd.img,nmrr=1
Where 1 means the SSD, 0 (default) means do not report, and other values
specify the actual RPM.
Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
---
src/bhyve/bhyve_command.c | 4 +++
src/bhyve/bhyve_domain.c | 6 ++++
...hyvexml2argv-disk-virtio-rotation-rate.xml | 23 ++++++++++++++
.../bhyvexml2argv-sata-rotation-rate.args | 10 ++++++
.../bhyvexml2argv-sata-rotation-rate.ldargs | 4 +++
.../bhyvexml2argv-sata-rotation-rate.xml | 31 +++++++++++++++++++
tests/bhyvexml2argvtest.c | 2 ++
7 files changed, 80 insertions(+)
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-rotation-rate.xml
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.args
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.ldargs
create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.xml
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index ab6d6e92e4..10f07db06c 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -278,6 +278,10 @@ bhyveBuildAHCIControllerArgStr(const virDomainDef *def,
_("unsupported disk device"));
return -1;
}
+
+ if (disk->rotation_rate)
+ virBufferAsprintf(&device, ",nmrr=%u", disk->rotation_rate);
+
virBufferAddBuffer(&buf, &device);
}
diff --git a/src/bhyve/bhyve_domain.c b/src/bhyve/bhyve_domain.c
index 9dec300a99..7685d21c71 100644
--- a/src/bhyve/bhyve_domain.c
+++ b/src/bhyve/bhyve_domain.c
@@ -290,6 +290,12 @@ bhyveDomainDeviceDefValidate(const virDomainDeviceDef *dev,
return -1;
}
}
+ } else if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
+ dev->data.disk->rotation_rate &&
+ dev->data.disk->bus != VIR_DOMAIN_DISK_BUS_SATA) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("rotation rate is only valid for SATA bus"));
+ return -1;
}
return 0;
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-rotation-rate.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-rotation-rate.xml
new file mode 100644
index 0000000000..0ec14018c1
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-rotation-rate.xml
@@ -0,0 +1,23 @@
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+ <memory>219136</memory>
+ <vcpu>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <devices>
+ <disk type='file'>
+ <driver name='file' type='raw'/>
+ <source file='/tmp/freebsd.img'/>
+ <target dev='vda' bus='virtio' rotation_rate='10000'/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='52:54:00:bc:85:fe'/>
+ <model type='virtio'/>
+ <source bridge="virbr0"/>
+ <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.args b/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.args
new file mode 100644
index 0000000000..2cf40953e8
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.args
@@ -0,0 +1,10 @@
+bhyve \
+-c 1 \
+-m 214 \
+-u \
+-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 3:0,virtio-net,faketapdev,mac=52:54:00:b9:94:02 \
+bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.ldargs b/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.ldargs
new file mode 100644
index 0000000000..4257ffccee
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.ldargs
@@ -0,0 +1,4 @@
+bhyveload \
+-m 214 \
+-d /tmp/freebsd1.img \
+bhyve
diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.xml b/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.xml
new file mode 100644
index 0000000000..a0d80cb908
--- /dev/null
+++ b/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.xml
@@ -0,0 +1,31 @@
+<domain type='bhyve'>
+ <name>bhyve</name>
+ <uuid>df3be7e7-a104-11e3-aeb0-50e5492bd3dc</uuid>
+ <memory>219136</memory>
+ <vcpu>1</vcpu>
+ <os>
+ <type>hvm</type>
+ </os>
+ <devices>
+ <disk type='file'>
+ <driver name='file' type='raw'/>
+ <source file='/tmp/freebsd1.img'/>
+ <target dev='hda' bus='sata' rotation_rate='7200'/>
+ </disk>
+ <disk type='file'>
+ <driver name='file' type='raw'/>
+ <source file='/tmp/freebsd2.img'/>
+ <target dev='hdb' bus='sata' rotation_rate='5400'/>
+ </disk>
+ <disk type='file'>
+ <driver name='file' type='raw'/>
+ <source file='/tmp/freebsd3.img'/>
+ <target dev='hdc' bus='sata' rotation_rate='1'/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='52:54:00:b9:94:02'/>
+ <model type='virtio'/>
+ <source bridge="virbr0"/>
+ </interface>
+ </devices>
+</domain>
diff --git a/tests/bhyvexml2argvtest.c b/tests/bhyvexml2argvtest.c
index cc6b17233d..9493551f8d 100644
--- a/tests/bhyvexml2argvtest.c
+++ b/tests/bhyvexml2argvtest.c
@@ -259,6 +259,8 @@ mymain(void)
DO_TEST("serial-tcp");
DO_TEST("4-consoles");
DO_TEST_FAILURE("serial-invalid-port");
+ DO_TEST("sata-rotation-rate");
+ DO_TEST_FAILURE("disk-virtio-rotation-rate");
/* Address allocation tests */
DO_TEST("addr-single-sata-disk");
--
2.51.0
On 10/25/25 13:47, Roman Bogorodskiy wrote: > Bhyve supports specifying disk rotation rate using the nmrr attribute, > e.g.: > > -s 3:0,ahci,hd:/data/img/freebsd.img,nmrr=1 > > Where 1 means the SSD, 0 (default) means do not report, and other values > specify the actual RPM. > > Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> > --- > src/bhyve/bhyve_command.c | 4 +++ > src/bhyve/bhyve_domain.c | 6 ++++ > ...hyvexml2argv-disk-virtio-rotation-rate.xml | 23 ++++++++++++++ > .../bhyvexml2argv-sata-rotation-rate.args | 10 ++++++ > .../bhyvexml2argv-sata-rotation-rate.ldargs | 4 +++ > .../bhyvexml2argv-sata-rotation-rate.xml | 31 +++++++++++++++++++ > tests/bhyvexml2argvtest.c | 2 ++ > 7 files changed, 80 insertions(+) > create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-rotation-rate.xml > create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.args > create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.ldargs > create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.xml Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Michal
On Wed, Oct 29, 2025 at 10:31:10 +0100, Michal Prívozník wrote: > On 10/25/25 13:47, Roman Bogorodskiy wrote: > > Bhyve supports specifying disk rotation rate using the nmrr attribute, > > e.g.: > > > > -s 3:0,ahci,hd:/data/img/freebsd.img,nmrr=1 > > > > Where 1 means the SSD, 0 (default) means do not report, and other values > > specify the actual RPM. > > > > Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com> > > --- > > src/bhyve/bhyve_command.c | 4 +++ > > src/bhyve/bhyve_domain.c | 6 ++++ > > ...hyvexml2argv-disk-virtio-rotation-rate.xml | 23 ++++++++++++++ > > .../bhyvexml2argv-sata-rotation-rate.args | 10 ++++++ > > .../bhyvexml2argv-sata-rotation-rate.ldargs | 4 +++ > > .../bhyvexml2argv-sata-rotation-rate.xml | 31 +++++++++++++++++++ > > tests/bhyvexml2argvtest.c | 2 ++ > > 7 files changed, 80 insertions(+) > > create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-rotation-rate.xml > > create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.args > > create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.ldargs > > create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.xml > > Reviewed-by: Michal Privoznik <mprivozn@redhat.com> And pushed before the freeze. Jirka
© 2016 - 2025 Red Hat, Inc.