Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
src/qemu/qemu_capabilities.c | 2 +
src/qemu/qemu_capabilities.h | 1 +
src/qemu/qemu_command.c | 3 +
src/qemu/qemu_validate.c | 22 ++++++++
.../caps_2.12.0.aarch64.xml | 1 +
.../caps_4.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.0.0.ppc64.xml | 1 +
.../caps_4.0.0.riscv32.xml | 1 +
.../caps_4.0.0.riscv64.xml | 1 +
.../qemucapabilitiesdata/caps_4.0.0.s390x.xml | 1 +
.../caps_4.0.0.x86_64.xml | 1 +
.../caps_4.1.0.x86_64.xml | 1 +
.../caps_4.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 1 +
.../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 1 +
.../caps_4.2.0.x86_64.xml | 1 +
.../caps_5.0.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
.../caps_5.0.0.riscv64.xml | 1 +
.../caps_5.0.0.x86_64.xml | 1 +
.../qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 +
.../caps_5.1.0.x86_64.xml | 1 +
.../caps_5.2.0.aarch64.xml | 1 +
.../qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 +
.../caps_5.2.0.riscv64.xml | 1 +
.../qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 +
.../caps_5.2.0.x86_64.xml | 1 +
.../caps_6.0.0.x86_64.xml | 1 +
.../disk-rotation.x86_64-latest.args | 56 +++++++++++++++++++
tests/qemuxml2argvdata/disk-rotation.xml | 38 +++++++++++++
tests/qemuxml2argvtest.c | 1 +
.../disk-rotation.x86_64-latest.xml | 55 ++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
33 files changed, 203 insertions(+)
create mode 100644 tests/qemuxml2argvdata/disk-rotation.x86_64-latest.args
create mode 100644 tests/qemuxml2argvdata/disk-rotation.xml
create mode 100644 tests/qemuxml2xmloutdata/disk-rotation.x86_64-latest.xml
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index deedff2e9f..ea24e2d6a5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -624,6 +624,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"audiodev",
"blockdev-backup",
"object.qapified",
+ "rotation-rate",
);
@@ -1440,6 +1441,7 @@ static struct virQEMUCapsDevicePropsFlags
virQEMUCapsDevicePropsSCSIDisk[] = {
{ "write-cache", QEMU_CAPS_DISK_WRITE_CACHE, NULL },
{ "device_id", QEMU_CAPS_SCSI_DISK_DEVICE_ID, NULL },
{ "werror", QEMU_CAPS_STORAGE_WERROR, NULL },
+ { "rotation_rate", QEMU_CAPS_ROTATION_RATE, NULL },
};
static struct virQEMUCapsDevicePropsFlags virQEMUCapsDevicePropsIDEDrive[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index da51a788fa..a70c00a265 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -604,6 +604,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check
*/
QEMU_CAPS_AUDIODEV, /* -audiodev instead of QEMU_AUDIO_DRV */
QEMU_CAPS_BLOCKDEV_BACKUP, /* qemu supports the blockdev-backup job */
QEMU_CAPS_OBJECT_QAPIFIED, /* parameters for object-add are formally described */
+ QEMU_CAPS_ROTATION_RATE, /* scsi-disk / ide-drive rotation-rate prop */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 1b4fa77867..7fcf7ad1ef 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1863,6 +1863,9 @@ qemuBuildDiskDeviceStr(const virDomainDef *def,
virBufferAsprintf(&opt, ",wwn=0x%s", disk->wwn);
}
+ if (disk->rotation_rate)
+ virBufferAsprintf(&opt, ",rotation_rate=%u",
disk->rotation_rate);
+
if (disk->vendor) {
virBufferAddLit(&opt, ",vendor=");
virQEMUBuildBufferEscapeComma(&opt, disk->vendor);
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 6043f974ce..09778085a8 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -2547,6 +2547,28 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDomainDiskDef
*disk,
}
}
+ if (disk->rotation_rate) {
+ if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI &&
+ disk->bus != VIR_DOMAIN_DISK_BUS_IDE &&
+ disk->bus != VIR_DOMAIN_DISK_BUS_SATA) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("rotation rate is only valid for SCSI/IDE/SATA
bus"));
+ return -1;
+ }
+
+ if (disk->device != VIR_DOMAIN_DISK_DEVICE_DISK) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("rotation rate is only valid for disk device"));
+ return -1;
+ }
+
+ if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_ROTATION_RATE)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("rotation rate is not supported with this
QEMU"));
+ return -1;
+ }
+ }
+
switch (disk->bus) {
case VIR_DOMAIN_DISK_BUS_SCSI:
diskInfo = (virDomainDeviceInfoPtr)&disk->info;
diff --git a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
index 93c768c633..f9d85560b6 100644
--- a/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
@@ -169,6 +169,7 @@
<flag name='vhost-user-blk'/>
<flag name='cpu-max'/>
<flag name='vnc-opts'/>
+ <flag name='rotation-rate'/>
<version>2012000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700289</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml
b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml
index 915c84f66e..8f8d09eda0 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml
@@ -184,6 +184,7 @@
<flag name='cpu-max'/>
<flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
<flag name='vnc-opts'/>
+ <flag name='rotation-rate'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml
b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml
index b096120ae3..3c32aceaf9 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml
@@ -192,6 +192,7 @@
<flag name='cpu-max'/>
<flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
<flag name='vnc-opts'/>
+ <flag name='rotation-rate'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml
b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml
index 53c35beba6..3741f75aff 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml
@@ -184,6 +184,7 @@
<flag name='vhost-user-blk'/>
<flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
<flag name='vnc-opts'/>
+ <flag name='rotation-rate'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>0</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml
b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml
index d76ad4102b..c2ee65a232 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml
@@ -184,6 +184,7 @@
<flag name='vhost-user-blk'/>
<flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
<flag name='vnc-opts'/>
+ <flag name='rotation-rate'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>0</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml
index e61a9570b7..3b25aabf93 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml
@@ -148,6 +148,7 @@
<flag name='cpu-max'/>
<flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
<flag name='vnc-opts'/>
+ <flag name='rotation-rate'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>39100240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
index 17395394df..5c2511eaa7 100644
--- a/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
@@ -229,6 +229,7 @@
<flag name='cpu-max'/>
<flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
<flag name='vnc-opts'/>
+ <flag name='rotation-rate'/>
<version>4000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100240</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
index 6bc2fea7b4..49d5fc5578 100644
--- a/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
@@ -236,6 +236,7 @@
<flag name='cpu-max'/>
<flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
<flag name='vnc-opts'/>
+ <flag name='rotation-rate'/>
<version>4001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
index 371e6192e2..eeeb27797b 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
@@ -199,6 +199,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>4001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
index 83f914cabe..d18776778d 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
@@ -199,6 +199,7 @@
<flag name='memory-backend-file.x-use-canonical-path-for-ramblock-id'/>
<flag name='vnc-opts'/>
<flag name='audiodev'/>
+ <flag name='rotation-rate'/>
<version>4001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
index 1f6f2e5833..67c6f9248c 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
@@ -161,6 +161,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>4002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>39100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
index 8f9972eb14..28f6666f7f 100644
--- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
@@ -247,6 +247,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>4002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
index 51d83b9f47..68ccaf6219 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
@@ -209,6 +209,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
index 4e6aec6fda..3dd4139263 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
@@ -218,6 +218,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
index 850dda922b..5993348d6b 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
@@ -204,6 +204,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>0</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
index 7dd3e9ae89..9467e4cfeb 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
@@ -254,6 +254,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
b/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
index 5b4b9d4b5b..a4838def4d 100644
--- a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
+++ b/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
@@ -119,6 +119,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>0</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
index 71ae857c8f..12bb9a1b0f 100644
--- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
@@ -256,6 +256,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
index 4417f03f13..d88f7c989a 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
@@ -213,6 +213,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
index f5d072b6c6..673d8b38ad 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
@@ -220,6 +220,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
index c12477a55c..da2320fd69 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
@@ -206,6 +206,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>0</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
index 53ed7fa312..a54b9bb096 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
@@ -168,6 +168,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>39100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
index 1f6b2de2a1..2fee135b1e 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
@@ -257,6 +257,7 @@
<flag name='vnc-opts'/>
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
+ <flag name='rotation-rate'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
index 555b6b5317..f260c60d5a 100644
--- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
@@ -260,6 +260,7 @@
<flag name='audiodev'/>
<flag name='blockdev-backup'/>
<flag name='object.qapified'/>
+ <flag name='rotation-rate'/>
<version>5002050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemuxml2argvdata/disk-rotation.x86_64-latest.args
b/tests/qemuxml2argvdata/disk-rotation.x86_64-latest.args
new file mode 100644
index 0000000000..1ee96424e1
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-rotation.x86_64-latest.args
@@ -0,0 +1,56 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/tmp/lib/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/tmp/lib/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/tmp/lib/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-i386 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object
'{"qom-type":"secret","id":"masterKey0","format":"raw",\
+"file":"/tmp/lib/domain--1-QEMUGuest1/master-key.aes"}' \
+-machine pc,accel=tcg,usb=off,dump-guest-core=off,memory-backend=pc.ram \
+-cpu qemu64 \
+-m 214 \
+-object
'{"qom-type":"memory-backend-ram","id":"pc.ram","size":224395264}'
\
+-overcommit mem-lock=off \
+-smp 8,sockets=8,cores=1,threads=1 \
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-no-acpi \
+-boot strict=on \
+-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
+-device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x2 \
+-blockdev
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest1",\
+"node-name":"libvirt-3-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-3-format","read-only":false,"driver":"raw",\
+"file":"libvirt-3-storage"}' \
+-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,\
+device_id=drive-scsi0-0-0-0,drive=libvirt-3-format,id=scsi0-0-0-0,bootindex=1,\
+rotation_rate=7200 \
+-blockdev
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest2",\
+"node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-2-format","read-only":false,"driver":"raw",\
+"file":"libvirt-2-storage"}' \
+-device scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,\
+device_id=drive-scsi0-0-0-1,drive=libvirt-2-format,id=scsi0-0-0-1,\
+rotation_rate=1 \
+-blockdev
'{"driver":"host_device","filename":"/dev/HostVG/QEMUGuest3",\
+"node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}'
\
+-blockdev
'{"node-name":"libvirt-1-format","read-only":false,"driver":"raw",\
+"file":"libvirt-1-storage"}' \
+-device ide-hd,bus=ide.0,unit=0,drive=libvirt-1-format,id=ide0-0-0,\
+rotation_rate=4500 \
+-audiodev id=audio1,driver=none \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,\
+resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/disk-rotation.xml
b/tests/qemuxml2argvdata/disk-rotation.xml
new file mode 100644
index 0000000000..0a810e54cc
--- /dev/null
+++ b/tests/qemuxml2argvdata/disk-rotation.xml
@@ -0,0 +1,38 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sda' bus='scsi' rotation_rate='7200'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='sdb' bus='scsi' rotation_rate='1'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='1'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <source dev='/dev/HostVG/QEMUGuest3'/>
+ <target dev='hda' bus='ide' rotation_rate='4500'/>
+ </disk>
+ <controller type='usb' index='0'/>
+ <controller type='scsi' index='0'
model='virtio-scsi'/>
+ <controller type='pci' index='0' model='pci-root'/>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <memballoon model='virtio'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 3439f34ef1..ea98f0e6a8 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -1469,6 +1469,7 @@ mymain(void)
DO_TEST_CAPS_LATEST("disk-backing-chains-noindex");
DO_TEST_CAPS_LATEST("disk-slices");
+ DO_TEST_CAPS_LATEST("disk-rotation");
DO_TEST_CAPS_ARCH_VER("disk-arm-virtio-sd", "aarch64",
"4.0.0");
DO_TEST_CAPS_ARCH_LATEST("disk-arm-virtio-sd", "aarch64");
diff --git a/tests/qemuxml2xmloutdata/disk-rotation.x86_64-latest.xml
b/tests/qemuxml2xmloutdata/disk-rotation.x86_64-latest.xml
new file mode 100644
index 0000000000..2b639c87f9
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/disk-rotation.x86_64-latest.xml
@@ -0,0 +1,55 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory unit='KiB'>219136</memory>
+ <currentMemory unit='KiB'>219136</currentMemory>
+ <vcpu placement='static'>8</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>qemu64</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-i386</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='sda' bus='scsi' rotation_rate='7200'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='sdb' bus='scsi' rotation_rate='1'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='1'/>
+ </disk>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest3'/>
+ <target dev='hda' bus='ide' rotation_rate='4500'/>
+ <address type='drive' controller='0' bus='0'
target='0' unit='0'/>
+ </disk>
+ <controller type='usb' index='0' model='piix3-uhci'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x2'/>
+ </controller>
+ <controller type='scsi' index='0' model='virtio-scsi'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x02' function='0x0'/>
+ </controller>
+ <controller type='pci' index='0' model='pci-root'/>
+ <controller type='ide' index='0'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x1'/>
+ </controller>
+ <input type='mouse' bus='ps2'/>
+ <input type='keyboard' bus='ps2'/>
+ <audio id='1' type='none'/>
+ <memballoon model='virtio'>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x03' function='0x0'/>
+ </memballoon>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 4e7cce21c6..137f1871af 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -525,6 +525,7 @@ mymain(void)
DO_TEST("pci-serial-dev-chardev", NONE);
DO_TEST_CAPS_LATEST("disk-slices");
+ DO_TEST_CAPS_LATEST("disk-rotation");
DO_TEST("encrypted-disk", QEMU_CAPS_QCOW2_LUKS);
DO_TEST("encrypted-disk-usage", QEMU_CAPS_QCOW2_LUKS);
--
2.30.2