1. 15 4月, 2016 6 次提交
  2. 13 4月, 2016 8 次提交
    • S
      qemu-iotests: iotests.py: get rid of __all__ · 3ef3dcef
      Sascha Silbe 提交于
      The __all__ list contained a typo for as long as the iotests module
      existed. That typo prevented "from iotests import *" (which is the
      only case where iotests.__all__ is used at all) from ever working.
      
      The names used by iotests are highly prone to name collisions, so
      importing them all unconditionally is a bad idea anyway. Since __all__
      is not adding any value, let's just get rid of it.
      
      Fixes: f345cfd0 ("qemu-iotests: add iotests Python module")
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Reviewed-by: NBo Tu <tubo@linux.vnet.ibm.com>
      Message-id: 1459848109-29756-8-git-send-email-silbe@linux.vnet.ibm.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      3ef3dcef
    • S
      qemu-iotests: 068: don't require KVM · 9bf8027d
      Sascha Silbe 提交于
      None of the other test cases explicitly enable KVM and there's no
      obvious reason for 068 to require it. Drop this so all test cases can be
      executed in environments where KVM is not available (e.g. because the
      user doesn't have sufficient permissions to access /dev/kvm).
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Reviewed-by: NBo Tu <tubo@linux.vnet.ibm.com>
      Message-id: 1459848109-29756-6-git-send-email-silbe@linux.vnet.ibm.com
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      9bf8027d
    • S
      qemu-iotests: 148: properly skip test if quorum support is missing · 3f647b51
      Sascha Silbe 提交于
      qemu-iotests test case 148 already had some code for skipping the test
      if quorum support is missing, but it didn't work in all
      cases. TestQuorumEvents.setUp() gets run before the actual test class
      (which contains the skipping code) and tries to start qemu with a drive
      using the quorum driver. For some reason this works fine when using
      qcow2, but fails for raw.
      
      As the entire test case requires quorum, just check for availability
      before even starting the test suite. Introduce a verify_quorum()
      function in iotests.py for this purpose so future test cases can make
      use of it.
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Reviewed-by: NBo Tu <tubo@linux.vnet.ibm.com>
      Message-id: 1459848109-29756-5-git-send-email-silbe@linux.vnet.ibm.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      3f647b51
    • S
      qemu-iotests: iotests.VM: remove qtest socket on error · c1c71e49
      Sascha Silbe 提交于
      On error, VM.launch() cleaned up the monitor unix socket, but left the
      qtest unix socket behind. This caused the remaining sub-tests to fail
      with EADDRINUSE:
      
      +======================================================================
      +ERROR: testQuorum (__main__.TestFifoQuorumEvents)
      +----------------------------------------------------------------------
      +Traceback (most recent call last):
      +  File "148", line 63, in setUp
      +    self.vm.launch()
      +  File "/home6/silbe/qemu/tests/qemu-iotests/iotests.py", line 247, in launch
      +    self._qmp.accept()
      +  File "/home6/silbe/qemu/tests/qemu-iotests/../../scripts/qmp/qmp.py", line 141, in accept
      +    return self.__negotiate_capabilities()
      +  File "/home6/silbe/qemu/tests/qemu-iotests/../../scripts/qmp/qmp.py", line 57, in __negotiate_capabilities
      +    raise QMPConnectError
      +QMPConnectError
      +
      +======================================================================
      +ERROR: testQuorum (__main__.TestQuorumEvents)
      +----------------------------------------------------------------------
      +Traceback (most recent call last):
      +  File "148", line 63, in setUp
      +    self.vm.launch()
      +  File "/home6/silbe/qemu/tests/qemu-iotests/iotests.py", line 244, in launch
      +    self._qtest = qtest.QEMUQtestProtocol(self._qtest_path, server=True)
      +  File "/home6/silbe/qemu/tests/qemu-iotests/../../scripts/qtest.py", line 33, in __init__
      +    self._sock.bind(self._address)
      +  File "/usr/lib64/python2.7/socket.py", line 224, in meth
      +    return getattr(self._sock,name)(*args)
      +error: [Errno 98] Address already in use
      
      Fix this by cleaning up both the monitor socket and the qtest socket iff
      they exist.
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Reviewed-by: NBo Tu <tubo@linux.vnet.ibm.com>
      Message-id: 1459848109-29756-4-git-send-email-silbe@linux.vnet.ibm.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      c1c71e49
    • S
      qemu-iotests: fix 051 on non-PC architectures · 1759386b
      Sascha Silbe 提交于
      Commit 61de4c68 [block: Remove BDRV_O_CACHE_WB] updated the reference
      output for PCs, but neglected to do the same for the generic reference
      output file. Fix 051 on all non-PC architectures by applying the same
      change to the generic output file.
      
      Fixes: 61de4c68 ("block: Remove BDRV_O_CACHE_WB")
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Reviewed-by: NBo Tu <tubo@linux.vnet.ibm.com>
      Message-id: 1459848109-29756-3-git-send-email-silbe@linux.vnet.ibm.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      1759386b
    • S
      qemu-iotests: check: don't place files with predictable names in /tmp · 0145b4e1
      Sascha Silbe 提交于
      Placing files with predictable or even hard-coded names in /tmp is a
      security risk and can prevent or disturb operation on a multi-user
      machine. Place them inside the "scratch" directory instead, as we
      already do for most other test-related files.
      Signed-off-by: NSascha Silbe <silbe@linux.vnet.ibm.com>
      Reviewed-by: NBo Tu <tubo@linux.vnet.ibm.com>
      Message-id: 1459848109-29756-2-git-send-email-silbe@linux.vnet.ibm.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      0145b4e1
    • M
      iotests: Make 150 use qemu-img map instead of du · 1fd06db0
      Max Reitz 提交于
      The actual on-disk size of a file does not only depend on factors qemu
      can control. Thus, we should not depend on this to determine whether a
      file has indeed been fully allocated. Instead, use qemu-img map and hope
      that if an area is referenced, it is indeed allocated, too.
      
      Also, limit the supported image formats to raw and qcow2 because the
      actual qemu-img map output may depend on the image format.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Tested-by: NPaolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      1fd06db0
    • P
      iotests: fix the broken 026.nocache output · af74e865
      Pavel Butsykin 提交于
      This patch fixes longstanding issue with 026 iotest. Unfortunately,
      this test contains 2 versions of the correct output, one for cached
      writes and one for non-cached ones. People tends to fix only one
      version of output of the test and thus noncached version becomes
      broken. Unfortunately, it is default in tests/check-block.sh
      
      The following problematic commits were made:
          commit 3b5e14c7
          Author: Max Reitz <mreitz@redhat.com>
          Date:   Tue Dec 2 18:32:51 2014 +0100
          qcow2: Flushing the caches in qcow2_close may fail
      
          commit a069e2f1
          Author: John Snow <jsnow@redhat.com>
          Date:   Fri Feb 6 16:26:17 2015 -0500
          blkdebug: fix "once" rule
      
          commit b106ad91
          Author: Kevin Wolf <kwolf@redhat.com>
          Date:   Fri Mar 28 18:06:31 2014 +0100
          qcow2: Don't rely on free_cluster_index in alloc_refcount_block()
      Signed-off-by: NPavel Butsykin <pbutsykin@virtuozzo.com>
      Signed-off-by: NDenis V. Lunev <den@openvz.org>
      CC: Max Reitz <mreitz@redhat.com>
      CC: John Snow <jsnow@redhat.com>
      CC: Kevin Wolf <kwolf@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      af74e865
  3. 08 4月, 2016 3 次提交
  4. 05 4月, 2016 3 次提交
  5. 30 3月, 2016 15 次提交
    • M
      iotests: Test qemu-img convert -S 0 behavior · f4e732a0
      Max Reitz 提交于
      Passing -S 0 to qemu-img convert should result in all source data being
      copied to the output, even if that source data is known to be 0. The
      output image should therefore have exactly the same size on disk as an
      image which we explicitly filled with data.
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      f4e732a0
    • M
      qemu-img: Fix preallocation with -S 0 for convert · aad15de4
      Max Reitz 提交于
      When passing -S 0 to qemu-img convert, the target image is supposed to
      be fully allocated. Right now, this is not the case if the source image
      contains areas which bdrv_get_block_status() reports as being zero.
      
      This patch changes a zeroed area's status from BLK_ZERO to BLK_DATA
      before invoking convert_write() if -S 0 has been specified. In addition,
      the check whether convert_read() actually needs to do anything
      (basically only if the current area is a BLK_DATA area) is pulled out of
      that function to the caller.
      
      If -S 0 has been specified, zeroed areas need to be written as data to
      the output, thus they then have to be accounted when calculating the
      progress made.
      
      This patch changes the reference output for iotest 122; contrary to what
      it assumed, -S 0 really should allocate everything in the output, not
      just areas that are filled with zeros (as opposed to being zeroed).
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Reviewed-by: NFam Zheng <famz@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      aad15de4
    • K
      block: Remove BDRV_O_CACHE_WB · 61de4c68
      Kevin Wolf 提交于
      The previous patches have successively made blk->enable_write_cache the
      true source for the information whether a writethrough mode must be
      implemented. The corresponding BDRV_O_CACHE_WB is only useless baggage
      we're carrying around, so now's the time to remove it.
      
      At the same time, we remove the 'cache.writeback' option parsing on the
      BDS level as the only effect was setting the BDRV_O_CACHE_WB flag.
      
      This change requires test cases that explicitly enabled the option to
      drop it. Other than that and the change of the error message when
      writethrough is enabled on the BDS level (from "Can't set writethrough
      mode" to "doesn't support the option"), there should be no change in
      behaviour.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      61de4c68
    • K
      qemu-io: Use bdrv_parse_cache_mode() in reopen_f() · 19dbecdc
      Kevin Wolf 提交于
      We must forbid changing the WCE flag in bdrv_reopen() in the same patch,
      as otherwise the behaviour would change so that the flag takes
      precedence over the explicitly specified option.
      
      The correct value of the WCE flag depends on the BlockBackend user (e.g.
      guest device) and isn't a decision that the QMP client makes, so this
      change is what we want.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      19dbecdc
    • K
      block/qapi: Use blk_enable_write_cache() · c83f9fba
      Kevin Wolf 提交于
      Now that WCE is handled on the BlockBackend level, the flag is
      meaningless for BDSes. As the schema requires us to fill the field,
      we return an enabled write cache for them.
      
      Note that this means that querying the BlockBackend name may return
      writethrough as the cache information, whereas querying the node-name of
      the root of that same BlockBackend will return writeback.
      
      This may appear odd at first, but it actually makes sense because it
      correctly repesents the layer that implements the WCE handling. This
      becomes more apparent when you consider nodes that are the root node of
      multiple BlockBackends, where each BB can have its own WCE setting.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      c83f9fba
    • K
      block: Move enable_write_cache to BB level · bfd18d1e
      Kevin Wolf 提交于
      Whether a write cache is used or not is a decision that concerns the
      user (e.g. the guest device) rather than the backend. It was already
      logically part of the BB level as bdrv_move_feature_fields() always kept
      it on top of the BDS tree; with this patch, the core of it (the actual
      flag and the additional flushes) is also implemented there.
      
      Direct callers of bdrv_open() must pass BDRV_O_CACHE_WB now if bs
      doesn't have a BlockBackend attached.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      bfd18d1e
    • D
      block: an interoperability test for luks vs dm-crypt/cryptsetup · 6278ae03
      Daniel P. Berrange 提交于
      It is important that the QEMU luks implementation retains 100%
      compatibility with the reference implementation provided by
      the combination of the linux kernel dm-crypt module and cryptsetup
      userspace tools.
      
      There is a matrix of tests to be performed with different sets
      of encryption settings. For each matrix entry, two tests will
      be performed. One will create a LUKS image with the cryptsetup
      tool and then do I/O with both cryptsetup & qemu-io. The other
      will create the image with qemu-img and then again do I/O with
      both cryptsetup and qemu-io.
      
      The new I/O test 149 performs interoperability testing between
      QEMU and the reference implementation. Such testing inherantly
      requires elevated privileges, so to this this the user must have
      configured passwordless sudo access. The test will automatically
      skip if sudo is not available.
      
      The test has to be run explicitly thus:
      
          cd tests/qemu-iotests
          ./check -luks 149
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      6278ae03
    • D
      block: move encryption deprecation warning into qcow code · e6ff69bf
      Daniel P. Berrange 提交于
      For a couple of releases we have been warning
      
        Encrypted images are deprecated
        Support for them will be removed in a future release.
        You can use 'qemu-img convert' to convert your image to an unencrypted one.
      
      This warning was issued by system emulators, qemu-img, qemu-nbd
      and qemu-io. Such a broad warning was issued because the original
      intention was to rip out all the code for dealing with encryption
      inside the QEMU block layer APIs.
      
      The new block encryption framework used for the LUKS driver does
      not rely on the unloved block layer API for encryption keys,
      instead using the QOM 'secret' object type. It is thus no longer
      appropriate to warn about encryption unconditionally.
      
      When the qcow/qcow2 drivers are converted to use the new encryption
      framework too, it will be practical to keep AES-CBC support present
      for use in qemu-img, qemu-io & qemu-nbd to allow for interoperability
      with older QEMU versions and liberation of data from existing encrypted
      qcow2 files.
      
      This change moves the warning out of the generic block code and
      into the qcow/qcow2 drivers. Further, the warning is set to only
      appear when running the system emulators, since qemu-img, qemu-io,
      qemu-nbd are expected to support qcow2 encryption long term now that
      the maint burden has been eliminated.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      e6ff69bf
    • D
      tests: add output filter to python I/O tests helper · a2d1c8fd
      Daniel P. Berrange 提交于
      Add a 'log' method to iotests.py which prints messages to
      stdout, with optional filtering of data. Port over some
      standard filters already present in the shell common.filter
      code to be usable in python too.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      a2d1c8fd
    • D
      tests: refactor python I/O tests helper main method · c6a92369
      Daniel P. Berrange 提交于
      The iotests.py helper provides a main() method for running
      tests via the python unit test framework. Not all tests
      will want to use this, so refactor it to split the testing
      of compatible formats and platforms into separate helper
      methods
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      c6a92369
    • D
      tests: redirect stderr to stdout for iotests · 491e5e85
      Daniel P. Berrange 提交于
      The python I/O tests helper for running qemu-img/qemu-io
      setup stdout to be captured to a pipe, but left stderr
      untouched. As a result, if something failed in qemu-img/
      qemu-io, data written to stderr would get output directly
      and not line up with data on the test stdout due to
      buffering.  If we explicitly redirect stderr to the same
      pipe as stdout, things are much clearer when they go
      wrong.
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      491e5e85
    • K
      block: Reject writethrough mode except at the root · 73ac451f
      Kevin Wolf 提交于
      Writethrough mode is going to become a BlockBackend feature rather than
      a BDS one, so forbid it in places where we won't be able to support it
      when the code finally matches the envisioned design.
      
      We only allowed setting the cache mode of non-root nodes after the 2.5
      release, so we're still free to make this change.
      
      The target of block jobs is now always opened in a writeback mode
      because it doesn't have a BlockBackend attached. This makes more sense
      anyway because block jobs know when to flush. If the graph is modified
      on job completion, the original cache mode moves to the new root, so
      for the guest device writethough always stays enabled if it was
      configured this way.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      73ac451f
    • K
      block: Make backing files always writeback · b8816a43
      Kevin Wolf 提交于
      First of all, we're generally not writing to backing files, but when we
      do, it's in the context of block jobs which know very well when to flush
      the image.
      Signed-off-by: NKevin Wolf <kwolf@redhat.com>
      Reviewed-by: NEric Blake <eblake@redhat.com>
      b8816a43
    • Z
      tests/test-filter-redirector: Add unit test for filter-redirector · 9fd3c5d5
      Zhang Chen 提交于
      In this unit test,we will test the filter redirector function.
      
      Case 1, tx traffic flow:
      
      qemu side              | test side
                             |
      +---------+            |  +-------+
      | backend <---------------+ sock0 |
      +----+----+            |  +-------+
           |                 |
      +----v----+  +-------+ |
      |  rd0    +->+chardev| |
      +---------+  +---+---+ |
                       |     |
      +---------+      |     |
      |  rd1    <------+     |
      +----+----+            |
           |                 |
      +----v----+            |  +-------+
      |  rd2    +--------------->sock1  |
      +---------+            |  +-------+
                             +
      
      a. we(sock0) inject packet to qemu socket backend
      b. backend pass packet to filter redirector0(rd0)
      c. rd0 redirect packet to out_dev(chardev) which is connected with
      filter redirector1's(rd1) in_dev
      d. rd1 read this packet from in_dev, and pass to next filter redirector2(rd2)
      e. rd2 redirect packet to rd2's out_dev which is connected with an opened socketed(sock1)
      f. we read packet from sock1 and compare to what we inject
      
      Start qemu with:
      
      "-netdev socket,id=qtest-bn0,fd=%d "
      "-device rtl8139,netdev=qtest-bn0,id=qtest-e0 "
      "-chardev socket,id=redirector0,path=%s,server,nowait "
      "-chardev socket,id=redirector1,path=%s,server,nowait "
      "-chardev socket,id=redirector2,path=%s,nowait "
      "-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
      "queue=tx,outdev=redirector0 "
      "-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
      "queue=tx,indev=redirector2 "
      "-object filter-redirector,id=qtest-f2,netdev=qtest-bn0,"
      "queue=tx,outdev=redirector1 "
      
      --------------------------------------
      Case 2, rx traffic flow
      qemu side              | test side
                             |
      +---------+            |  +-------+
      | backend +---------------> sock1 |
      +----^----+            |  +-------+
           |                 |
      +----+----+  +-------+ |
      |  rd0    +<-+chardev| |
      +---------+  +---+---+ |
                       ^     |
      +---------+      |     |
      |  rd1    +------+     |
      +----^----+            |
           |                 |
      +----+----+            |  +-------+
      |  rd2    <---------------+sock0  |
      +---------+            |  +-------+
      
      a. we(sock0) insert packet to filter redirector2(rd2)
      b. rd2 pass packet to filter redirector1(rd1)
      c. rd1 redirect packet to out_dev(chardev) which is connected with
         filter redirector0's(rd0) in_dev
      d. rd0 read this packet from in_dev, and pass ti to qemu backend which is
         connected with an opened socketed(sock1)
      e. we read packet from sock1 and compare to what we inject
      
      Start qemu with:
      
      "-netdev socket,id=qtest-bn0,fd=%d "
      "-device rtl8139,netdev=qtest-bn0,id=qtest-e0 "
      "-chardev socket,id=redirector0,path=%s,server,nowait "
      "-chardev socket,id=redirector1,path=%s,server,nowait "
      "-chardev socket,id=redirector2,path=%s,nowait "
      "-object filter-redirector,id=qtest-f0,netdev=qtest-bn0,"
      "queue=rx,outdev=redirector0 "
      "-object filter-redirector,id=qtest-f1,netdev=qtest-bn0,"
      "queue=rx,indev=redirector2 "
      "-object filter-redirector,id=qtest-f2,netdev=qtest-bn0,"
      "queue=rx,outdev=redirector1 "
      Signed-off-by: NZhang Chen <zhangchen.fnst@cn.fujitsu.com>
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: NLi Zhijian <lizhijian@cn.fujitsu.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      9fd3c5d5
    • Z
      tests/test-filter-mirror:add filter-mirror unit test · 06809ecf
      Zhang Chen 提交于
      In this unit test we will test the mirror function.
      
      start qemu with:
            -netdev socket,id=qtest-bn0,fd=sockfd
            -device e1000,netdev=qtest-bn0,id=qtest-e0
            -chardev socket,id=mirror0,path=/tmp/filter-mirror-test.sock,server,nowait
            -object filter-mirror,id=qtest-f0,netdev=qtest-bn0,queue=tx,outdev=mirror0
      
      We inject packet to netdev socket id = qtest-bn0,
      filter-mirror will copy and mirror the packet to mirror0.
      we read packet from mirror0 and then compare to what we injected.
      Signed-off-by: NZhang Chen <zhangchen.fnst@cn.fujitsu.com>
      Signed-off-by: NWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: NJason Wang <jasowang@redhat.com>
      06809ecf
  6. 29 3月, 2016 2 次提交
  7. 23 3月, 2016 3 次提交