summaryrefslogtreecommitdiff
path: root/tests/qemu-iotests
AgeCommit message (Collapse)Author
2016-04-12qemu-iotests: iotests.VM: remove qtest socket on errorSascha 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: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Bo Tu <tubo@linux.vnet.ibm.com> Message-id: 1459848109-29756-4-git-send-email-silbe@linux.vnet.ibm.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-04-12qemu-iotests: fix 051 on non-PC architecturesSascha 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: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Bo Tu <tubo@linux.vnet.ibm.com> Message-id: 1459848109-29756-3-git-send-email-silbe@linux.vnet.ibm.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-04-12qemu-iotests: check: don't place files with predictable names in /tmpSascha 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: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Bo Tu <tubo@linux.vnet.ibm.com> Message-id: 1459848109-29756-2-git-send-email-silbe@linux.vnet.ibm.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-04-12iotests: Make 150 use qemu-img map instead of duMax 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: Max Reitz <mreitz@redhat.com> Tested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-04-12iotests: fix the broken 026.nocache outputPavel 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 3b5e14c76a6bb142bf250ddf99e24a0ac8c7bc12 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 a069e2f1372a0a823ab506fc019852a2a652aa54 Author: John Snow <jsnow@redhat.com> Date: Fri Feb 6 16:26:17 2015 -0500 blkdebug: fix "once" rule commit b106ad9185f35fc4ad669555ad0e79e276083bd7 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: Pavel Butsykin <pbutsykin@virtuozzo.com> Signed-off-by: Denis 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: Kevin Wolf <kwolf@redhat.com>
2016-04-05qemu-iotests: 149: Use "/usr/bin/env python"Fam Zheng
Do the same as other scripts, to pick the correct interpreter between python2 and python3 from the environment. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1459504593-2692-1-git-send-email-famz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-03-30iotests: Test qemu-img convert -S 0 behaviorMax 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: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-30qemu-img: Fix preallocation with -S 0 for convertMax 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: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-30block: Remove BDRV_O_CACHE_WBKevin 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: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
2016-03-30qemu-io: Use bdrv_parse_cache_mode() in reopen_f()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: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
2016-03-30block/qapi: Use blk_enable_write_cache()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: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
2016-03-30block: Move enable_write_cache to BB levelKevin 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: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
2016-03-30block: an interoperability test for luks vs dm-crypt/cryptsetupDaniel 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: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-30block: move encryption deprecation warning into qcow codeDaniel 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: Daniel P. Berrange <berrange@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-30tests: add output filter to python I/O tests helperDaniel 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: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-30tests: refactor python I/O tests helper main methodDaniel 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: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-30tests: redirect stderr to stdout for iotestsDaniel 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: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-30block: Reject writethrough mode except at the rootKevin 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: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-03-30block: Make backing files always writebackKevin 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: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-03-28qemu-iotests: add no-op streaming testAlberto Garcia
This patch tests that in a partial block-stream operation, no data is ever copied from the base image. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 5272a2aa57bc0b3f981f8b3e0c813e58a88c974b.1458566441.git.berto@igalia.com Signed-off-by: Jeff Cody <jcody@redhat.com>
2016-03-28qemu-iotests: fix test_stream_partial()Alberto Garcia
This test is streaming to the top layer using the intermediate image as the base. This is a mistake since block-stream never copies data from the base image and its backing chain, so this is effectively a no-op. In addition to fixing the base parameter, this patch also writes some data to the intermediate image before the test, so there's something to copy and the test is meaningful. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 2efa304da38b32d47c120ce728568a589c5a3afc.1458566441.git.berto@igalia.com Signed-off-by: Jeff Cody <jcody@redhat.com>
2016-03-17iotests: Test QUORUM_REPORT_BAD in fifo modeAlberto Garcia
Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: c0a8dbfdbe939520cda5f661af6f1cd7b6b4df9d.1458034554.git.berto@igalia.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-03-17blockdev: Split monitor reference from BB creationMax Reitz
Before this patch, blk_new() automatically assigned a name to the new BlockBackend and considered it referenced by the monitor. This patch removes the implicit monitor_add_blk() call from blk_new() (and consequently the monitor_remove_blk() call from blk_delete(), too) and thus blk_new() (and related functions) no longer take a BB name argument. In fact, there is only a single point where blk_new()/blk_new_open() is called and the new BB is monitor-owned, and that is in blockdev_init(). Besides thus relieving us from having to invent names for all of the BBs we use in qemu-img, this fixes a bug where qemu cannot create a new image if there already is a monitor-owned BB named "image". If a BB and its BDS tree are created in a single operation, as of this patch the BDS tree will be created before the BB is given a name (whereas it was the other way around before). This results in minor change to the output of iotest 087, whose reference output is amended accordingly. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-17block: Drop BB name from bad option errorMax Reitz
The information which BB is concerned does not seem useful enough to justify its existence in most other place (which may be related to qemu printing the -drive parameter in question anyway, and for blockdev-add the attribution is naturally unambiguous). Furthermore, as of a future patch, bdrv_get_device_name(bs) will always return the empty string before bdrv_open_inherit() returns. Therefore, just dropping that information seems to be the best course of action. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-17qapi: Drop QERR_UNKNOWN_BLOCK_FORMAT_FEATUREMax Reitz
Just specifying a custom string is simpler in basically all places that used it, and in addition, specifying the BB or node name is something we generally do not do in other error messages when opening a BDS, so we should not do it here. This changes the output for iotest 036 (to the better, in my opinion), so the reference output needs to be changed accordingly. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-14iotests: Add test for QMP event ratesAlberto Garcia
This test verifies that the rate-limited QMP events are emitted at a maximum rate of 1 per second as defined in monitor_qapi_event_conf in monitor.c It also checks that QUORUM_REPORT_BAD events generated from different nodes are kept in separate queues so they don't mask each other. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 0dbd3ee88a59a6363042ad81cfb345037bfbf612.1457610443.git.berto@igalia.com [mreitz@redhat.com: Renamed test from 146 to 148] Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-03-14iotests: Correct 081's reference outputMax Reitz
The newly added type parameter for the QUORUM_REPORT_BAD event changed the output of iotest 081, so the reference should be amended accordingly. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 1457705687-27122-1-git-send-email-mreitz@redhat.com Reviewed-by: Alberto Garcia <berto@igalia.com>
2016-03-14block/vpc: add tests for image creation force_size parameterJeff Cody
Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-03-14block/vpc: tests for auto-detecting VPC and Hyper-V VHD imagesJeff Cody
This tests auto-detection, and overrides, of VHD image sizes created by Virtual PC, Hyper-V, and Disk2vhd. This adds three sample images: hyperv2012r2-dynamic.vhd.bz2 - dynamic VHD image created with Hyper-V virtualpc-dynamic.vhd.bz2 - dynamic VHD image created with Virtual PC d2v-zerofilled.vhd.bz2 - dynamic VHD image created with Disk2vhd Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-29iotests/124: Add cluster_size mismatch testJohn Snow
If a backing file isn't specified in the target image and the cluster_size is larger than the bitmap granularity, we run the risk of creating bitmaps with allocated clusters but empty/no data which will prevent the proper reading of the backup in the future. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Message-id: 1456433911-24718-4-git-send-email-jsnow@redhat.com Signed-off-by: Jeff Cody <jcody@redhat.com>
2016-02-29mirror: Rewrite mirror_iterationFam Zheng
The "pnum < nb_sectors" condition in deciding whether to actually copy data is unnecessarily strict, and the qiov initialization is unnecessarily for bdrv_aio_write_zeroes and bdrv_aio_discard. Rewrite mirror_iteration to fix both flaws. The output of iotests 109 is updated because we now report the offset and len slightly differently in mirroring progress. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 1454637630-10585-2-git-send-email-famz@redhat.com Signed-off-by: Jeff Cody <jcody@redhat.com>
2016-02-22qemu-iotests: 140: make description slightly more verboseSascha Silbe
Describe in a little more detail what the test is supposed to achieve. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-id: 1455827853-33477-3-git-send-email-silbe@linux.vnet.ibm.com Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-02-22qemu-iotests: 140: don't use IDE deviceSascha Silbe
IDE is only implemented by very few architectures (mostly PC). The test doesn't actually need a block device attached to the BlockBackend, so just drop it and adjust the reference output accordingly. Fixes: 16dee418 ("iotests: Add test for eject under NBD server") Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-id: 1455827853-33477-2-git-send-email-silbe@linux.vnet.ibm.com Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-02-22qemu-iotests: 067: ignore QMP eventsSascha Silbe
The relative ordering of "device_del" return value and the "DEVICE_DELETED" QMP event depends on the architecture being tested. On x86 unplugging virtio disks is asynchronous (=qdev_unplug()= → =hotplug_handler_unplug_request()=) while on s390x it is synchronous (=qdev_unplug()= → =hotplug_handler_unplug()=). This leads to the actual output on s390x consistently differing from the reference output (that was probably produced on x86). The easiest way to address this is to filter out QMP events in 067. The DEVICE_DELETED event is already getting explicitly tested by the Python-based test case 139, so the test coverage should be unaffected. Make use of the recently introduced _filter_qmp_events() to remove QMP events from the test case output and adjust the reference output accordingly. The tr / sed / tr trick used for filtering was suggested by Max Reitz <mreitz@redhat.com>. Signed-off-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Message-id: 1455886869-139916-2-git-send-email-silbe@linux.vnet.ibm.com Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-02-22qemu-iotests: Extend iotest 093 to test burstsAlberto Garcia
This patch adds a new test that checks that the burst settings ('iops_max', 'iops_max_length', etc.) of the throttling code work as expected. Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-22block: Fix -incoming with snapshot=onKevin Wolf
The BDRV_O_INACTIVE flag should only be set for images explicitly opened by the user. snapshot=on needs to create a new qcow2 image and write some metadata to it. This is not a problem because it can't come from the source, so there's no reason to mark it as BDRV_O_INACTIVE, even though it is opened while waiting for the migration to complete. This fixes an assertion failure when -incoming and snapshot=on are combined. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-16Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into stagingPeter Maydell
* Coverity fixes for IPMI and mptsas * qemu-char fixes from Daniel and Marc-André * Bug fixes that break qemu-iotests * Changes to fix reset from panicked state * checkpatch false positives for designated initializers * TLS support in the NBD servers and clients # gpg: Signature made Tue 16 Feb 2016 16:27:17 GMT using RSA key ID 78C7AE83 # gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" # gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" * remotes/bonzini/tags/for-upstream: (28 commits) nbd: enable use of TLS with nbd-server-start command nbd: enable use of TLS with qemu-nbd server nbd: enable use of TLS with NBD block driver nbd: implement TLS support in the protocol negotiation nbd: use "" as a default export name if none provided nbd: always query export list in fixed new style protocol nbd: allow setting of an export name for qemu-nbd server nbd: make client request fixed new style if advertised nbd: make server compliant with fixed newstyle spec nbd: invert client logic for negotiating protocol version nbd: convert to using I/O channels for actual socket I/O nbd: convert blockdev NBD server to use I/O channels for connection setup nbd: convert qemu-nbd server to use I/O channels for connection setup nbd: convert block client to use I/O channels for connection setup qemu-nbd: add support for --object command line arg qom: add helpers for UserCreatable object types ipmi: sensor number should not exceed MAX_SENSORS mptsas: fix wrong formula mptsas: fix memory leak mptsas: add missing va_end ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-02-16nbd: always query export list in fixed new style protocolDaniel P. Berrange
With the new style protocol, the NBD client will currenetly send NBD_OPT_EXPORT_NAME as the first (and indeed only) option it wants. The problem is that the NBD protocol spec does not allow for returning an error message with the NBD_OPT_EXPORT_NAME option. So if the server mandates use of TLS, the client will simply see an immediate connection close after issuing NBD_OPT_EXPORT_NAME which is not user friendly. To improve this situation, if we have the fixed new style protocol, we can sent NBD_OPT_LIST as the first option to query the list of server exports. We can check for our named export in this list and raise an error if it is not found, instead of going ahead and sending NBD_OPT_EXPORT_NAME with a name that we know will be rejected. This improves the error reporting both in the case that the server required TLS, and in the case that the client requested export name does not exist on the server. If the server does not support NBD_OPT_LIST, we just ignore that and carry on with NBD_OPT_EXPORT_NAME as before. Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1455129674-17255-12-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2016-02-16tests: Clean up includesPeter Maydell
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Tested-by: Eric Blake <eblake@redhat.com>
2016-02-08tests: Use Python 2.6 "except E as ..." syntaxMarkus Armbruster
PEP 8 calls for it, because it's forward compatible with Python 3. Supported since Python 2.6, which we require (commit fec2103). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <1450425164-24969-5-git-send-email-armbru@redhat.com>
2016-02-02block: qemu-iotests - add test for snapshot, commit, snapshot bugJeff Cody
Signed-off-by: Jeff Cody <jcody@redhat.com> Message-id: 2dbc05efba2f683cb3aaf71aaa9b776ebf7ec57c.1454376655.git.jcody@redhat.com Reviewed-by: Max Reitz <mreitz@redhat.com> [Moved test number from 143 to 144] Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-02-02iotests: Add "qemu-img map" test for VMDK extentsFam Zheng
Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1453780743-16806-17-git-send-email-famz@redhat.com Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2016-02-02iotests: Add test for block jobs and BDS ejectionMax Reitz
Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-02iotests: Add test for multiple BB on BDS treeMax Reitz
This adds a test for having multiple BlockBackends in one BDS tree. In this case, there is one BB for the protocol BDS and one BB for the format BDS in a simple two-BDS tree (with the protocol BDS and BB added first). When bdrv_close_all() is executed, no cached data from any BDS should be lost; the protocol BDS may not be closed until the format BDS is closed. Otherwise, metadata updates may be lost. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-02iotests: Add test for eject under NBD serverMax Reitz
This patch adds a test for ejecting the BlockBackend an NBD server is connected to (the NBD server is supposed to stop). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-02iotests: Add test for a nonexistent NBD exportMax Reitz
Trying to connect to a nonexistent NBD export should not crash the server. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-02iotests: Make redirecting qemu's stderr optionalMax Reitz
Redirecting qemu's stderr to stdout makes working with the stderr output difficult due to the other file descriptor magic performed in _launch_qemu ("ambiguous redirect"). Add an option which specifies whether stderr should be redirected to stdout or not (allowing for other modes to be added in the future). Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-02iotests: Make _filter_nbd support more URL typesMax Reitz
This function should support URLs of the "nbd://" format (without swallowing the export name), and for "nbd:///" URLs it should replace "?socket=$TEST_DIR" by "?socket=TEST_DIR" because putting the Unix socket files into the test directory makes sense. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-02iotests: Make _filter_nbd drop log linesMax Reitz
The NBD log lines ("/your/source/dir/nbd/xyz.c:function():line: error") should not be converted to empty lines but removed altogether. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-02iotests: Move _filter_nbd into common.filterMax Reitz
_filter_nbd can be useful for other NBD tests, too, therefore it should reside in common.filter. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>