From nobody Sun Feb 8 18:09:17 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1761652085; cv=none; d=zohomail.com; s=zohoarc; b=RKrIf9nCsBIZbnzmCy7HedRoUHhbAuVdrhXPDavCHqB93ZeYuMlHHdoiqPRvBnH6Wzu3EjnyKWCwgXCCrIAqsys5bfnG3TKvTD/diOeEvxervN+GAzfnLmHDrnd6ZhmmUyY48COHMfHFmsz5vy3qk3MFLzEw8w0mlQgpGiNQgRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1761652085; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=g2WbOMS4K2RvMVLDNtIRTMSJ+frECI3JrfVxuKxh6uU=; b=Do1r42yZNHRfH7uj/ZV42MAybDwA6aiIyTMK6OgxAiFKfe8spJtZuAZgzJk7KIXlBjhBMegA4e8tBSL8PhAE5s/2DTrM8VCZN8AvOQ7a+CMzCdK9SCEnJZc9N0cp3ol3+AGY2VGhDzZIqsV3E3uZl4JW9YFon2a/Ylg+RPA3I3o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 17616520854437.465645371252549; Tue, 28 Oct 2025 04:48:05 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id A94913F361; Tue, 28 Oct 2025 07:47:44 -0400 (EDT) Received: from [172.19.199.25] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id BDC473F881; Tue, 28 Oct 2025 07:46:04 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 0CA43465C3; Sat, 25 Oct 2025 07:49:17 -0400 (EDT) Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 0363A465C1 for ; Sat, 25 Oct 2025 07:49:16 -0400 (EDT) Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-b3d196b7eeeso622897366b.0 for ; Sat, 25 Oct 2025 04:49:15 -0700 (PDT) Received: from tulp.my.domain (84-25-144-101.cable.dynamic.v4.ziggo.nl. [84.25.144.101]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b6d8ceeaffasm82152366b.45.2025.10.25.04.49.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Oct 2025 04:49:13 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761392954; x=1761997754; darn=lists.libvirt.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=g2WbOMS4K2RvMVLDNtIRTMSJ+frECI3JrfVxuKxh6uU=; b=lVozx4pL2bzCi5XaJ1Om39kW6K1tJ9Wv0naALLYV9LKetGIVeGZ4LBtG/L0Pz/7jau qiz8cqH8rIIXKfhWmpIHkE4zu7FjUbjn6lzzdUU+OMvfXWdmMqTndqmLvk70yFqNDBrB zICFj4cQxyJIHJmtqsa5lwVqyGV9e2guRGJb724b7hv6hsXWBidlL0P26QAf4Q7fRUaV qNGoIW/eoKe4Vf/UTh8wydz1dwOMzsPR8Q8CLkmtILOih0KNiQO/Ehl67OfE7cAFi972 Eu4qvD0tJwwahdM1GUY7hQjxaUhA7eh47iGkQzwr/6Ch3ol5OXIDYq9NyUrvao4Y15Z8 qkZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761392954; x=1761997754; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g2WbOMS4K2RvMVLDNtIRTMSJ+frECI3JrfVxuKxh6uU=; b=EIP8RAsJHULGOzvS6j02sB5kGZhoIie5UldO4UCGDy+uDgHPRQyLAa6UTc7HsKJYj2 HJzg+1mkmxB7ourPHiQmUrhFQviw/VhsP/82LHIQ10nOH3TB/tHnIFhQwxft05DPlbxt vzTp2ruTUoCM3GH0rr6/PYCHC8g87AbfQ8z/rz6DM+sWNc2gy7vIzmHt2DTRhfVsLlNg 8n+DP6yGLDSJSqnxEavGWfmIAmT/6RLuH+hy9T7M4aZNLslUwI5Sm/hxc1A272LfJWH4 zR1vNiyaZxLpf2BFGsk4lsdAaNxCASXIg5iAV/NN01g2S6QJ54CQVOmRtJGtBaa602M4 UN0A== X-Gm-Message-State: AOJu0YytPBSrWMj36CMg6nH3azMDJ5K+V2j2XuzRfzcCjiqKu3GuYC5v aAsCIm6FF56YZq+kTame6JmurPrKUUHLpEECVa77DAPMd8XkSo8DLFszYdpQcXTB3u7WiQ== X-Gm-Gg: ASbGncs4jM608TVJsHDbowh8mgf/ktQNyTREWxLZLkhlH+WFyJ8KdZopLXDLAfNlK9x uC6D16+UMnWsAlnWKMNhJ4iOR5nCpdd5e/GjakznZSBJqZx+fgo8u+CBgwJE2nlWH4BrvNWJLCU jhXwblhtun7+4Thqd7WYBSbFP8wdc+1EL4JsyBKC9JZBkoUtdBE7PYxwrX49JAUH/25/GKOeIgP rQc55pJhf3Lt7aloFn6x8HL0SXGXuN6vMsTkweEnNh0SN0KM9TOPKJX+zMSblVBzcAZcARTDDSQ Es8vfxZHSqi4GOPK5bR1VLoTD9qEkyEmAF5igPYYsp8AdfIvM612Bt/B8WOeVOm8scEe+KyFkdd sn9jVl7fHSPj46cMI+MjUPuTKnG+vSvJpifp0rVG4gY4vzmhXUQjbmhByM3uU2JM3uMpfC9NGJ3 1WZo09vA3NkRiM11UenmfU20p3fdD5ES+BNU0Y33CngahRJDHfbpZ5Dxy6 X-Google-Smtp-Source: AGHT+IELTn78tA03IOf0oybqsPtwCfZNctCTWEctYbBPY3eadtpdSg1eCnD/JzayqgIUCaa3pfbX/w== X-Received: by 2002:a17:907:3d91:b0:b55:befd:8f8d with SMTP id a640c23a62f3a-b647500ec03mr4085001466b.57.1761392954132; Sat, 25 Oct 2025 04:49:14 -0700 (PDT) From: Roman Bogorodskiy To: devel@lists.libvirt.org Subject: [PATCH] bhyve: support specifying disk rotation rate Date: Sat, 25 Oct 2025 13:47:15 +0200 Message-ID: <20251025114715.9520-1-bogorodskiy@gmail.com> X-Mailer: git-send-email 2.51.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2EOZX5PQCNGXQTWLPWEDYJZ6QN5YJ5PW X-Message-ID-Hash: 2EOZX5PQCNGXQTWLPWEDYJZ6QN5YJ5PW X-MailFrom: bogorodskiy@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Roman Bogorodskiy X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1761652088015154100 Content-Type: text/plain; charset="utf-8" Bhyve supports specifying disk rotation rate using the nmrr attribute, e.g.: -s 3:0,ahci,hd:/data/img/freebsd.img,nmrr=3D1 Where 1 means the SSD, 0 (default) means do not report, and other values specify the actual RPM. Signed-off-by: Roman Bogorodskiy Reviewed-by: Michal Privoznik --- 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-rotat= ion-rate.xml create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rat= e.args create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rat= e.ldargs create mode 100644 tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rat= e.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=3D%u", disk->rotation_rate); + virBufferAddBuffer(&buf, &device); } =20 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 =3D=3D VIR_DOMAIN_DEVICE_DISK && + dev->data.disk->rotation_rate && + dev->data.disk->bus !=3D VIR_DOMAIN_DISK_BUS_SATA) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("rotation rate is only valid for SATA bus")); + return -1; } =20 return 0; diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-disk-virtio-rotation-rat= e.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 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + + hvm + + + + + + +
+ + + + + +
+ + + 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=3D7200,hd:/tmp/freebsd2.img,nmrr=3D5= 400,hd:/tmp/freebsd3.img,nmrr=3D1 \ +-s 3:0,virtio-net,faketapdev,mac=3D52:54:00:b9:94:02 \ +bhyve diff --git a/tests/bhyvexml2argvdata/bhyvexml2argv-sata-rotation-rate.ldarg= s 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 @@ + + bhyve + df3be7e7-a104-11e3-aeb0-50e5492bd3dc + 219136 + 1 + + hvm + + + + + + + + + + + + + + + + + + + + + + + + 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"); =20 /* Address allocation tests */ DO_TEST("addr-single-sata-disk"); --=20 2.51.0