<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 31, 2021 at 5:51 PM Daniel P. Berrangé <<a href="mailto:berrange@redhat.com">berrange@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This lets the app expose the virtual SCSI or IDE disks as solid state<br>
devices by setting a rate of '1', or rotational media by setting a<br>
rate between 1025 and 65534.<br>
<br>
Signed-off-by: Daniel P. Berrangé <<a href="mailto:berrange@redhat.com" target="_blank">berrange@redhat.com</a>><br>
---<br>
 docs/formatdomain.rst         | 13 ++++++++++---<br>
 docs/schemas/domaincommon.rng |  5 +++++<br>
 src/conf/domain_conf.c        | 11 +++++++++++<br>
 src/conf/domain_conf.h        |  1 +<br>
 4 files changed, 27 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst<br>
index 741130bf21..224f44a0a2 100644<br>
--- a/docs/formatdomain.rst<br>
+++ b/docs/formatdomain.rst<br>
@@ -2372,7 +2372,7 @@ paravirtualized driver is specified via the ``disk`` element.<br>
        <source protocol="tftp" name="url_path"><br>
          <host name="hostname" port="69"/><br>
        </source><br>
-       <target dev='hdi' bus='ide' tray='open'/><br>
+       <target dev='hdi' bus='ide' tray='open' rotation_rate='7200'/><br>
        <readonly/><br>
      </disk><br>
      <disk type='block' device='lun'><br>
@@ -2385,7 +2385,7 @@ paravirtualized driver is specified via the ``disk`` element.<br>
            <source type='unix' path='/path/to/qemu-pr-helper' mode='client'/><br>
          </reservations><br>
        </source><br>
-       <target dev='sda' bus='scsi'/><br>
+       <target dev='sda' bus='scsi' rotation_rate='1'/><br>
        <address type='drive' controller='0' bus='0' target='3' unit='0'/><br>
      </disk><br>
      <disk type='block' device='disk'><br>
@@ -2885,10 +2885,17 @@ paravirtualized driver is specified via the ``disk`` element.<br>
    to "closed". NB, the value of ``tray`` could be updated while the domain is<br>
    running. The optional attribute ``removable`` sets the removable flag for USB<br>
    disks, and its value can be either "on" or "off", defaulting to "off".<br>
+   The optional attribute ``rotation_rate`` sets the rotation rate of the<br>
+   storage for disks on a SCSI, IDE, or SATA bus. Values in the range 1025 to<br>
+   65534 are used to indicate rotational media spee in revolutions per minute.<br></blockquote><div>I don't see any value range limitation in the libvirt code. Is it limited by qemu?<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+   A value of one is used to indicate solid state, or otherwise non-rotational,<br>
+   storage. These values are not required to match the values of the underlying<br>
+   host storage.<br>
    :since:`Since 0.0.3`; ``bus`` attribute :since:`since 0.4.3`; ``tray``<br>
    attribute :since:`since 0.9.11`; "usb" attribute value<br>
    :since:`since after 0.4.4`; "sata" attribute value :since:`since 0.9.7`;<br>
-   "removable" attribute value :since:`since 1.1.3`<br>
+   "removable" attribute value :since:`since 1.1.3`;<br>
+   "rotation_rate" attribute value :since:`since 7.3.0`<br>
 ``iotune``<br>
    The optional ``iotune`` element provides the ability to provide additional<br>
    per-device I/O tuning, with values that can vary for each device (contrast<br>
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng<br>
index f5ced5b7a2..2ff7862539 100644<br>
--- a/docs/schemas/domaincommon.rng<br>
+++ b/docs/schemas/domaincommon.rng<br>
@@ -2230,6 +2230,11 @@<br>
           <ref name="virOnOff"/><br>
         </attribute><br>
       </optional><br>
+      <optional><br>
+        <attribute name="rotation_rate"><br>
+          <ref name="positiveInteger"/><br>
+        </attribute><br>
+      </optional><br>
     </element><br>
   </define><br>
   <define name="geometry"><br>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c<br>
index d050a519c6..1e72171586 100644<br>
--- a/src/conf/domain_conf.c<br>
+++ b/src/conf/domain_conf.c<br>
@@ -9319,6 +9319,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,<br>
     g_autofree char *vendor = NULL;<br>
     g_autofree char *product = NULL;<br>
     g_autofree char *domain_name = NULL;<br>
+    g_autofree char *rotation_rate = NULL;<br>
<br>
     if (!(def = virDomainDiskDefNew(xmlopt)))<br>
         return NULL;<br>
@@ -9383,6 +9384,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,<br>
             bus = virXMLPropString(cur, "bus");<br>
             tray = virXMLPropString(cur, "tray");<br>
             removable = virXMLPropString(cur, "removable");<br>
+            rotation_rate = virXMLPropString(cur, "rotation_rate");<br>
<br>
             /* HACK: Work around for compat with Xen<br>
              * driver in previous libvirt releases */<br>
@@ -9615,6 +9617,13 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,<br>
         }<br>
     }<br>
<br>
+    if (rotation_rate &&<br>
+        virStrToLong_ui(rotation_rate, NULL, 10, &def->rotation_rate) < 0) {<br>
+        virReportError(VIR_ERR_INTERNAL_ERROR,<br>
+                       _("Cannot parse rotation rate '%s'"), rotation_rate);<br>
+        return NULL;<br>
+    }<br>
+<br>
     if (virDomainDeviceInfoParseXML(xmlopt, node, ctxt, &def->info,<br>
                                     flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT) < 0) {<br>
         return NULL;<br>
@@ -25141,6 +25150,8 @@ virDomainDiskDefFormat(virBufferPtr buf,<br>
         virBufferAsprintf(buf, " removable='%s'",<br>
                           virTristateSwitchTypeToString(def->removable));<br>
     }<br>
+    if (def->rotation_rate)<br>
+        virBufferAsprintf(buf, " rotation_rate='%u'", def->rotation_rate);<br>
     virBufferAddLit(buf, "/>\n");<br>
<br>
     virDomainDiskDefFormatIotune(buf, def);<br>
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h<br>
index 0b8895bbdf..3da9ba01bf 100644<br>
--- a/src/conf/domain_conf.h<br>
+++ b/src/conf/domain_conf.h<br>
@@ -539,6 +539,7 @@ struct _virDomainDiskDef {<br>
     char *dst;<br>
     int tray_status; /* enum virDomainDiskTray */<br>
     int removable; /* enum virTristateSwitch */<br>
+    unsigned int rotation_rate;<br>
<br>
     virStorageSourcePtr mirror;<br>
     int mirrorState; /* enum virDomainDiskMirrorState */<br>
-- <br>
2.30.2<br>
<br>
</blockquote></div></div>