]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: implement setting of rotation rate for SCSI/IDE disks
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 31 Mar 2021 09:17:07 +0000 (10:17 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Thu, 1 Apr 2021 14:11:38 +0000 (15:11 +0100)
This is available in QEMU with "ide-hd" and "scsi-hd" device
types. It was originally mistakenly added to the "scsi-block"
device type too, but later removed. This doesn't affect libvirt
since we restrict usage to device=disk.

When this property is not set then QEMU's default behaviour
is to not report any rotation rate information, which
causes most guest OS to assume rotational storage.

https://bugzilla.redhat.com/show_bug.cgi?id=1498955

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
33 files changed:
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
src/qemu/qemu_command.c
src/qemu/qemu_validate.c
tests/qemucapabilitiesdata/caps_2.12.0.aarch64.xml
tests/qemucapabilitiesdata/caps_4.0.0.aarch64.xml
tests/qemucapabilitiesdata/caps_4.0.0.ppc64.xml
tests/qemucapabilitiesdata/caps_4.0.0.riscv32.xml
tests/qemucapabilitiesdata/caps_4.0.0.riscv64.xml
tests/qemucapabilitiesdata/caps_4.0.0.s390x.xml
tests/qemucapabilitiesdata/caps_4.0.0.x86_64.xml
tests/qemucapabilitiesdata/caps_4.1.0.x86_64.xml
tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml
tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml
tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml
tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml
tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
tests/qemuxml2argvdata/disk-rotation.x86_64-latest.args [new file with mode: 0644]
tests/qemuxml2argvdata/disk-rotation.xml [new file with mode: 0644]
tests/qemuxml2argvtest.c
tests/qemuxml2xmloutdata/disk-rotation.x86_64-latest.xml [new file with mode: 0644]
tests/qemuxml2xmltest.c

index deedff2e9f528be5b3fc0023e7e6d716e12c9306..ea24e2d6a58596cba192d4938e1bf48dc406894b 100644 (file)
@@ -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[] = {
index da51a788fa674f989739a642dbfec21bde13fce0..a70c00a265193321b62fe614b93739b951a61158 100644 (file)
@@ -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;
index 1b4fa778675483ddd0fd3483b654490aa867f01c..7fcf7ad1efb1e43fa7c44852daf6372be7b26e91 100644 (file)
@@ -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);
index 6043f974ce7a88cedc221cc336bd7d9fd38a3025..09778085a8a4dee1b90785798e25258107e8b367 100644 (file)
@@ -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;
index 93c768c6339d729ef800d7a724dfdce4622e16b8..f9d85560b60e00d6cbef88d92928213cc48238d0 100644 (file)
   <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>
index 915c84f66ef8abb7db15add784777c945aea4ca3..8f8d09eda0e46116901bf1df7c1f044ee3ae3cd5 100644 (file)
   <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>
index b096120ae3530976eab59492d8f66ef4a7fa39c4..3c32aceaf91fe2b03c6ca6173f5172349a6197cd 100644 (file)
   <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>
index 53c35beba6bf8f80426cfaebc4cf49dafa7a8a11..3741f75aff66cb22746a35e3916155c34419aff8 100644 (file)
   <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>
index d76ad4102b5e10cfc49d46ba840c36d6226811ef..c2ee65a2323b169c43f360808371bf8cd1987a71 100644 (file)
   <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>
index e61a9570b75447b74cf0c79be36cce2673d4735d..3b25aabf93d42dc89fd7219d790d7e3f2c1925b9 100644 (file)
   <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>
index 17395394dfd9f3f214b368c3d8b0c07cd861d2b3..5c2511eaa7031219530cf3d7e09d9ff5ef0aa4a7 100644 (file)
   <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>
index 6bc2fea7b4a336dc09545242290586e9aff76079..49d5fc55785c6ab1af8b41972762f3e715e7ebbc 100644 (file)
   <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>
index 371e6192e22f7dce88c73425b5c6eb5a37faabb3..eeeb27797b88ec0dac0974764de8bc8f3b2db272 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>4001050</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>61700242</microcodeVersion>
index 83f914cabe3d2da31aa0d103c147f66a88ca187c..d18776778d6654e294cd92a20e68def462704781 100644 (file)
   <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>
index 1f6f2e583348f2642cd525920c726ae799c41f61..67c6f9248c19ed16ceaf68e89fcc63d8a6eaa5af 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>4002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>39100242</microcodeVersion>
index 8f9972eb14313096b1b51df9b5cc84623931ad5e..28f6666f7f81ad04517c461af4ea078fea38964b 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>4002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>43100242</microcodeVersion>
index 51d83b9f47cfe092c01dcb7d8831dfedcac377c1..68ccaf62192fb3dc259ccc03bceec2d892958ab6 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5000000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>61700241</microcodeVersion>
index 4e6aec6fdad773bf03428494f46a4fd99b9cfea0..3dd413926360b2bc99b4d2db5e79f009d6a25f5b 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5000000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>42900241</microcodeVersion>
index 850dda922b5a9051f39b0e8e36a518229b9d843e..5993348d6b923b510fa27ef8e5ff5d6a933e9a06 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5000000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>0</microcodeVersion>
index 7dd3e9ae898c88bc1bcdc803259ace2c798e2924..9467e4cfebc7ca83b71f8d3e7cbe479fc7a451f2 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5000000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>43100241</microcodeVersion>
index 5b4b9d4b5bef6af61f0be94d93df1a057a21846a..a4838def4dfb02a0c6966b0849669eb4790f48c2 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5001000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>0</microcodeVersion>
index 71ae857c8ff6b0c0678c4bc7137a3702a314ee0f..12bb9a1b0f965f76d7156574a310b27aa3a1fd42 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5001000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>43100242</microcodeVersion>
index 4417f03f132c609e3fed4200004ec135ceda8283..d88f7c989a41fd828f5bcb1d0efea8a8be5ccbe7 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>61700243</microcodeVersion>
index f5d072b6c645a47d35f0fa903572a3d7d62a1fd1..673d8b38ad5f9a8ab27df449f28f59ac4c7211d6 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>42900243</microcodeVersion>
index c12477a55c7aac899c1e7e230b8bf5bbbc54e922..da2320fd69f49a7acd07abb411f3b641af8c71a9 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>0</microcodeVersion>
index 53ed7fa31277cfad52f57499555f0ca87576ac7c..a54b9bb09602d5b01a557505d4887fda25f1f1fa 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>39100243</microcodeVersion>
index 1f6b2de2a1d2efb8451eabc7582faea2bd54b944..2fee135b1e15ee8cce09654f157e610e3d46a2ef 100644 (file)
   <flag name='vnc-opts'/>
   <flag name='audiodev'/>
   <flag name='blockdev-backup'/>
+  <flag name='rotation-rate'/>
   <version>5002000</version>
   <kvmVersion>0</kvmVersion>
   <microcodeVersion>43100243</microcodeVersion>
index 555b6b5317388dc7a96169d179f30f6392e0389a..f260c60d5a7c5aaf4c8ca2038e7ddd94d69154e0 100644 (file)
   <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 (file)
index 0000000..1ee9642
--- /dev/null
@@ -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 (file)
index 0000000..0a810e5
--- /dev/null
@@ -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>
index 3439f34ef182d57507820476102d804c699a91b5..ea98f0e6a8651ef8f67fc6ea9966655873c88b3f 100644 (file)
@@ -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 (file)
index 0000000..2b639c8
--- /dev/null
@@ -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>
index 4e7cce21c6ea091f69007a574c458a7a542105ca..137f1871afc4004ac6bd87066ca5d0d3deb62517 100644 (file)
@@ -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);