From nobody Sun Feb 8 12:37:26 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1617184293; cv=none; d=zohomail.com; s=zohoarc; b=gcx3R/srWsvqR8IK1r5cnZ9PlN/6+WgRZ4x7yuB/obDNlVoo57xoO8z3IV99RYx9BCuYGPzAfe9ViqtyhgQsgPQ+b3xN0sbKCChMvJm9FUSTjv2fWgJnNCp8EyTrlB/ckyfJD2GNqVdC/zirjtx0VzgjG35INOaQLEqbag2hxmk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617184293; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=teLn4oIDWuVk+6ooEr/0PuoaqbsARUTt2jK8960iRxE=; b=Hp9AqbRhi3B5R57w1uS1fe/ltViCPmWFTmclspWr/ahGy3xg0RXHxjJE1zHfHaNO52ppOfeCclYIqr8OPeFfoVnA31SN2x529UzjLNskIp3qOQ6MexOqMkwq3oBHZo4oNUKal1GndnuE8zd7EW8yuPbsCIPBCWg7IX+gdiZUxiw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1617184293007694.5270397328752; Wed, 31 Mar 2021 02:51:33 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-261-8YI-IX9lOxyPfvs0aWkBuQ-1; Wed, 31 Mar 2021 05:51:29 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10DD3801FD8; Wed, 31 Mar 2021 09:51:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E3C152C31A; Wed, 31 Mar 2021 09:51:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9E7FF4BB7C; Wed, 31 Mar 2021 09:51:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12V9oXXX006841 for ; Wed, 31 Mar 2021 05:50:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 985A04F3C6; Wed, 31 Mar 2021 09:50:33 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-114-96.ams2.redhat.com [10.36.114.96]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6F3C6E71D; Wed, 31 Mar 2021 09:50:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617184292; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=teLn4oIDWuVk+6ooEr/0PuoaqbsARUTt2jK8960iRxE=; b=ABHO+GVFdBjuWgnCnRW5YI/SKm1rhwJRT0F3YiZA2s6elLfTfjfa8RENf5JL309d0xPvNq +r4ap/4X36HIVyVQrzsdVFDBTnMXnmaR2mC1Wz4Cr6Sy0vi05aN4oo5Uuuc+CdSGsS5X7d 5qE/TJo27zrqPNh7mZ2yOyQUfUN/NMc= X-MC-Unique: 8YI-IX9lOxyPfvs0aWkBuQ-1 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] conf: add support for disk "rotation_rate" property Date: Wed, 31 Mar 2021 10:50:25 +0100 Message-Id: <20210331095026.228215-2-berrange@redhat.com> In-Reply-To: <20210331095026.228215-1-berrange@redhat.com> References: <20210331095026.228215-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) This lets the app expose the virtual SCSI or IDE disks as solid state devices by setting a rate of '1', or rotational media by setting a rate between 1025 and 65534. Signed-off-by: Daniel P. Berrang=C3=A9 --- docs/formatdomain.rst | 13 ++++++++++--- docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 11 +++++++++++ src/conf/domain_conf.h | 1 + 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 741130bf21..224f44a0a2 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2372,7 +2372,7 @@ paravirtualized driver is specified via the ``disk`` = element. - + @@ -2385,7 +2385,7 @@ paravirtualized driver is specified via the ``disk`` = element. - +
@@ -2885,10 +2885,17 @@ paravirtualized driver is specified via the ``disk`= ` element. to "closed". NB, the value of ``tray`` could be updated while the domai= n is running. The optional attribute ``removable`` sets the removable flag f= or USB disks, and its value can be either "on" or "off", defaulting to "off". + The optional attribute ``rotation_rate`` sets the rotation rate of the + storage for disks on a SCSI, IDE, or SATA bus. Values in the range 1025= to + 65534 are used to indicate rotational media spee in revolutions per min= ute. + A value of one is used to indicate solid state, or otherwise non-rotati= onal, + storage. These values are not required to match the values of the under= lying + host storage. :since:`Since 0.0.3`; ``bus`` attribute :since:`since 0.4.3`; ``tray`` attribute :since:`since 0.9.11`; "usb" attribute value :since:`since after 0.4.4`; "sata" attribute value :since:`since 0.9.7`; - "removable" attribute value :since:`since 1.1.3` + "removable" attribute value :since:`since 1.1.3`; + "rotation_rate" attribute value :since:`since 7.3.0` ``iotune`` The optional ``iotune`` element provides the ability to provide additio= nal per-device I/O tuning, with values that can vary for each device (contr= ast diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index f5ced5b7a2..2ff7862539 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -2230,6 +2230,11 @@ + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d050a519c6..1e72171586 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9319,6 +9319,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, g_autofree char *vendor =3D NULL; g_autofree char *product =3D NULL; g_autofree char *domain_name =3D NULL; + g_autofree char *rotation_rate =3D NULL; =20 if (!(def =3D virDomainDiskDefNew(xmlopt))) return NULL; @@ -9383,6 +9384,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, bus =3D virXMLPropString(cur, "bus"); tray =3D virXMLPropString(cur, "tray"); removable =3D virXMLPropString(cur, "removable"); + rotation_rate =3D virXMLPropString(cur, "rotation_rate"); =20 /* HACK: Work around for compat with Xen * driver in previous libvirt releases */ @@ -9615,6 +9617,13 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlop= t, } } =20 + if (rotation_rate && + virStrToLong_ui(rotation_rate, NULL, 10, &def->rotation_rate) < 0)= { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Cannot parse rotation rate '%s'"), rotation_rate= ); + return NULL; + } + if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info, flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOO= T) < 0) { return NULL; @@ -25141,6 +25150,8 @@ virDomainDiskDefFormat(virBufferPtr buf, virBufferAsprintf(buf, " removable=3D'%s'", virTristateSwitchTypeToString(def->removable)); } + if (def->rotation_rate) + virBufferAsprintf(buf, " rotation_rate=3D'%u'", def->rotation_rate= ); virBufferAddLit(buf, "/>\n"); =20 virDomainDiskDefFormatIotune(buf, def); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 0b8895bbdf..3da9ba01bf 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -539,6 +539,7 @@ struct _virDomainDiskDef { char *dst; int tray_status; /* enum virDomainDiskTray */ int removable; /* enum virTristateSwitch */ + unsigned int rotation_rate; =20 virStorageSourcePtr mirror; int mirrorState; /* enum virDomainDiskMirrorState */ --=20 2.30.2