[libvirt] [PATCH 8/8] Add tests for blkdeviotune

Eric Blake eblake at redhat.com
Wed Nov 23 19:55:29 UTC 2011


On 11/15/2011 02:02 AM, Lei Li wrote:
> Signed-off-by: Lei Li <lilei at linux.vnet.ibm.com>
> Signed-off-by: Zhi Yong Wu <wuzhy at linux.vnet.ibm.com>
> ---
>  .../qemuxml2argv-blkdeviotune.args                 |    4 ++
>  .../qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml |   36 ++++++++++++++++++++
>  tests/qemuxml2argvtest.c                           |    1 +
>  tests/qemuxml2xmltest.c                            |    1 +
>  4 files changed, 42 insertions(+), 0 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args
>  create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml

Yay - my favorite part of a good series - tests that prove it works.

Alas, these tests _didn't_ work, but caused 3 failures in 'make check'.
 Are you sure you tested these before submitting?

> 
> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args b/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args
> new file mode 100644
> index 0000000..6f34698
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args
> @@ -0,0 +1,4 @@
> +LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M \
> +pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor unix:/tmp/test-monitor, \
> +server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none -serial \
> +none -parallel none -usb

Where are the new iotune command line parameters?  Ah - they only show
up if qemu advertises -drive capability (hmm, wonder if that means we
should tweak something in qemu_command.c to error out if any non-zero
limits appear in pre-'-drive' qemu, or if we also need qemu_capabilities
to set a bit according to whether this feature works, to get a better
error message than what old qemu would give us).

> diff --git a/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml b/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
> new file mode 100644
> index 0000000..1fceef8
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
> @@ -0,0 +1,36 @@
> +<domain type='qemu'>

> +    <disk type='block' device='disk' snapshot='internal'>

Let's just focus on <iotune>, and leave snapshot to other tests.

> +      <driver name='qemu' type='qcow2' cache='none'/>
> +      <source dev='/dev/HostVG/QEMUGuest1'/>
> +      <target dev='hda' bus='ide'/>
> +      <iotune>
> +        <total_bytes_sec>5000</total_bytes_sec>
> +        <total_iops_sec>6000</total_iops_sec>
> +      <address type='drive' controller='0' bus='0' unit='0'/>

Missing an </iotune>.  I also realized that my tweak for 6/8 didn't
quite put the <interleave> in the rng in the right place, since I got a
verify failure for <address> being after instead of before <iotune>.

Here's what I'm squashing, once the rng stuff is fixed:

diff --git i/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args
w/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args
index 6f34698..9615290 100644
--- i/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args
+++ w/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.args
@@ -1,4 +1,7 @@
 LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu
-S -M \
-pc -m 214 -smp 1 -name QEMUGuest1 -nographic -monitor
unix:/tmp/test-monitor, \
-server,nowait -no-acpi -boot c -hda /dev/HostVG/QEMUGuest1 -net none
-serial \
-none -parallel none -usb
+pc -m 214 -smp 1 -name QEMUGuest1 -nographic -nodefaults \
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c \
+-drive file=/dev/HostVG/QEMUGuest1,if=none,id=drive-ide0-0-0,cache=off,\
+bps=5000,iops=6000 -device \
+ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 -usb \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3
diff --git i/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
w/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
index 1fceef8..48553e4 100644
--- i/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
+++ w/tests/qemuxml2argvdata/qemuxml2argv-blkdeviotune.xml
@@ -14,22 +14,16 @@
   <on_crash>destroy</on_crash>
   <devices>
     <emulator>/usr/bin/qemu</emulator>
-    <disk type='block' device='disk' snapshot='internal'>
+    <disk type='block' device='disk'>
       <driver name='qemu' type='qcow2' cache='none'/>
       <source dev='/dev/HostVG/QEMUGuest1'/>
       <target dev='hda' bus='ide'/>
       <iotune>
         <total_bytes_sec>5000</total_bytes_sec>
         <total_iops_sec>6000</total_iops_sec>
+      </iotune>
       <address type='drive' controller='0' bus='0' unit='0'/>
     </disk>
-    <disk type='block' device='cdrom' snapshot='no'>
-      <driver name='qemu' type='raw'/>
-      <source dev='/dev/HostVG/QEMUGuest2'/>
-      <target dev='hdc' bus='ide'/>
-      <readonly/>
-      <address type='drive' controller='0' bus='1' unit='0'/>
-    </disk>
     <controller type='ide' index='0'/>
     <memballoon model='virtio'/>
   </devices>
diff --git i/tests/qemuxml2argvtest.c w/tests/qemuxml2argvtest.c
index 27e8619..40ce00c 100644
--- i/tests/qemuxml2argvtest.c
+++ w/tests/qemuxml2argvtest.c
@@ -645,7 +645,8 @@ mymain(void)
     DO_TEST("blkiotune", false, QEMU_CAPS_NAME);
     DO_TEST("cputune", false, QEMU_CAPS_NAME);
     DO_TEST("numatune-memory", false, NONE);
-    DO_TEST("blkdeviotune", false, QEMU_CAPS_NAME);
+    DO_TEST("blkdeviotune", false, QEMU_CAPS_NAME, QEMU_CAPS_DEVICE,
+            QEMU_CAPS_DRIVE);

     DO_TEST("multifunction-pci-device", false,
             QEMU_CAPS_DRIVE, QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG,


-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111123/1a03e2a6/attachment-0001.sig>


More information about the libvir-list mailing list