Skip to content
Permalink
Branch: block
Commits on Feb 25, 2019
  1. iotests: Skip 211 on insufficient memory

    XanClic committed Feb 18, 2019
    VDI keeps the whole bitmap in memory, and the maximum size (which is
    tested here) is 2 GB.  This may not be available on all machines, and it
    rarely is available when running a 32 bit build.
    
    Fix this by making VM.run_job() return the error string if an error
    occurred, and checking whether that contains "Could not allocate bmap"
    in 211.  If so, the test is skipped.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Message-id: 20190218180646.30282-1-mreitz@redhat.com
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  2. vmdk: false positive of compat6 with hwversion not set

    yuchenlin authored and XanClic committed Feb 21, 2019
    In vmdk_co_create_opts, when it finds hw_version is undefined, it will
    set it to 4, which misleading the compat6 and hwversion in
    vmdk_co_do_create. Simply set hw_version to NULL after free, let
    the logic in vmdk_co_do_create to decide the value of hw_version.
    
    This bug can be reproduced by:
    
    $ qemu-img convert -O vmdk -o subformat=streamOptimized,compat6
    /home/yuchenlin/syno.qcow2 /home/yuchenlin/syno.vmdk
    
    qemu-img: /home/yuchenlin/syno.vmdk: error while converting vmdk:
    compat6 cannot be enabled with hwversion set
    
    Signed-off-by: yuchenlin <yuchenlin@synology.com>
    Message-id: 20190221110805.28239-1-yuchenlin@synology.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  3. iotests: add LUKS payload overhead to 178 qemu-img measure test

    Stefan Hajnoczi authored and XanClic committed Feb 18, 2019
    The previous patch includes the LUKS payload overhead into the qemu-img
    measure calculation for qcow2.  Update qemu-iotests 178 to exercise this
    new code path.
    
    Reviewed-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-id: 20190218104525.23674-3-stefanha@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  4. qcow2: include LUKS payload overhead in qemu-img measure

    Stefan Hajnoczi authored and XanClic committed Feb 18, 2019
    LUKS encryption reserves clusters for its own payload data.  The size of
    this area must be included in the qemu-img measure calculation so that
    we arrive at the correct minimum required image size.
    
    (Ab)use the qcrypto_block_create() API to determine the payload
    overhead.  We discard the payload data that qcrypto thinks will be
    written to the image.
    
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Max Reitz <mreitz@redhat.com>
    Message-id: 20190218104525.23674-2-stefanha@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  5. iotests.py: s/_/-/g on keys in qmp_log()

    XanClic committed Feb 10, 2019
    This follows what qmp() does, so the output will correspond to the
    actual QMP command.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Message-id: 20190210145736.1486-11-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  6. iotests: Let 045 be run concurrently

    XanClic committed Feb 10, 2019
    Adding a telnet monitor for no real purpose on a fixed port is not so
    great.  Just use a null monitor instead.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Message-id: 20190210145736.1486-10-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  7. iotests: Filter SSH paths

    XanClic committed Feb 10, 2019
    8908b25 has implemented filtering of
    remote paths for NFS, but forgot SSH.  This patch takes care of that.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Message-id: 20190210145736.1486-9-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  8. iotests.py: Filter filename in any string value

    XanClic committed Feb 10, 2019
    filter_qmp_testfiles() currently filters the filename only for specific
    keys.  However, there are more keys that take filenames (such as
    block-commit's @top and @base, or ssh's @path), and it does not make
    sense to list them all here.  "$TEST_DIR/$PID-" should have enough
    entropy not to appear anywhere randomly.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Message-id: 20190210145736.1486-8-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  9. iotests.py: Add is_str()

    XanClic committed Feb 10, 2019
    On Python 2.x, strings are not always unicode strings.  This function
    checks whether a given value is a plain string, or a unicode string (if
    there is a difference).
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Message-id: 20190210145736.1486-7-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  10. iotests: Fix 207 to use QMP filters for qmp_log

    XanClic committed Feb 10, 2019
    Fixes: 08fcd61
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Message-id: 20190210145736.1486-6-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  11. iotests: Fix 232 for LUKS

    XanClic committed Feb 10, 2019
    With IMGOPTSSYNTAX, $TEST_IMG is useless for this test (it only tests
    the file-posix protocol driver).  Therefore, if $TEST_IMG_FILE is set,
    use that instead.
    
    Because this test requires the file protocol, $TEST_IMG_FILE will always
    be set if $IMGOPTSSYNTAX is true.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Message-id: 20190210145736.1486-5-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  12. iotests: Remove superfluous rm from 232

    XanClic committed Feb 10, 2019
    This test creates no such file.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Message-id: 20190210145736.1486-4-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  13. iotests: Fix 237 for Python 2.x

    XanClic committed Feb 10, 2019
    math.ceil() returns an integer on Python 3.x, but a float on Python 2.x.
    range() always needs integers, so we need an explicit conversion on 2.x
    (which does not hurt on 3.x).
    
    It is not quite clear whether we want to support Python 2.x for any
    prolonged time, but this may as well be fixed along with the other
    issues some iotests have right now.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
    Message-id: 20190210145736.1486-3-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  14. iotests: Re-add filename filters

    XanClic committed Feb 10, 2019
    A previous commit removed the default filters for qmp_log with the
    intention to make them explicit; but this happened only for test 206.
    There are more tests (for more exotic image formats than qcow2) which
    require the filename filter, though.
    
    Note that 237 is still broken for Python 2.x, which is fixed in the next
    commit.
    
    Fixes: f8ca860
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: John Snow <jsnow@redhat.com>
    Message-id: 20190210145736.1486-2-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  15. iotests: Test json:{} filenames of internal BDSs

    XanClic committed Feb 1, 2019
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Message-id: 20190201192935.18394-32-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  16. block: BDS options may lack the "driver" option

    XanClic committed Feb 1, 2019
    When BDSs are created by qemu itself (e.g. as filters in block jobs),
    they may not have a "driver" option in their options QDict.  When
    generating a json:{} filename, however, it must always be present.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-31-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  17. block/null: Generate filename even with latency-ns

    XanClic committed Feb 1, 2019
    While we cannot represent the latency-ns option in a filename, it is not
    a strong option so not being able to should not stop us from generating
    a filename nonetheless.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-30-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  18. block/curl: Implement bdrv_refresh_filename()

    XanClic committed Feb 1, 2019
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-29-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  19. block/curl: Harmonize option defaults

    XanClic committed Feb 1, 2019
    Both of the defaults we currently have in the curl driver are named
    based on a slightly different schema, let's unify that and call both
    CURL_BLOCK_OPT_${NAME}_DEFAULT.
    
    While at it, we can add a macro for the third option for which a default
    exists, namely "sslverify".
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-28-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  20. block/nvme: Fix bdrv_refresh_filename()

    XanClic committed Feb 1, 2019
    Currently, nvme's bdrv_refresh_filename() is an exact copy of null's
    implementation.  However, for null, "null-co://" and "null-aio://" are
    indeed valid filenames -- for nvme, they are not, as a device address is
    still required.
    
    The correct implementation should generate a filename of the form
    "nvme://[PCI address]/[namespace]" (as the comment above
    nvme_parse_filename() describes).
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-27-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  21. block: Do not copy exact_filename from format file

    XanClic committed Feb 1, 2019
    If a format BDS's file BDS is in turn a format BDS, we cannot simply use
    the same filename, because when opening a BDS tree based on a filename
    alone, qemu will create only one format node on top of one protocol node
    (disregarding a potential backing file).
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-26-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  22. block: Purify .bdrv_refresh_filename()

    XanClic committed Feb 1, 2019
    Currently, BlockDriver.bdrv_refresh_filename() is supposed to both
    refresh the filename (BDS.exact_filename) and set BDS.full_open_options.
    Now that we have generic code in the central bdrv_refresh_filename() for
    creating BDS.full_open_options, we can drop the latter part from all
    BlockDriver.bdrv_refresh_filename() implementations.
    
    This also means that we can drop all of the existing default code for
    this from the global bdrv_refresh_filename() itself.
    
    Furthermore, we now have to call BlockDriver.bdrv_refresh_filename()
    after having set BDS.full_open_options, because the block driver's
    implementation should now be allowed to depend on BDS.full_open_options
    being set correctly.
    
    Finally, with this patch we can drop the @options parameter from
    BlockDriver.bdrv_refresh_filename(); also, add a comment on this
    function's purpose in block/block_int.h while touching its interface.
    
    This completely obsoletes blklogwrite's implementation of
    .bdrv_refresh_filename().
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Message-id: 20190201192935.18394-25-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  23. block: Generically refresh runtime options

    XanClic committed Feb 1, 2019
    Instead of having every block driver which implements
    bdrv_refresh_filename() copy all of the strong runtime options over to
    bs->full_open_options, implement this process generically in
    bdrv_refresh_filename().
    
    This patch only adds this new generic implementation, it does not remove
    the old functionality. This is done in a follow-up patch.
    
    With this patch, some superfluous information (that should never have
    been there) may be removed from some JSON filenames, as can be seen in
    the change to iotests 110's and 228's reference outputs.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Message-id: 20190201192935.18394-24-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  24. block: Add BlockDriver.bdrv_gather_child_options

    XanClic committed Feb 1, 2019
    Some follow-up patches will rework the way bs->full_open_options is
    refreshed in bdrv_refresh_filename(). The new implementation will remove
    the need for the block drivers' bdrv_refresh_filename() implementations
    to set bs->full_open_options; instead, it will be generic and use static
    information from each block driver.
    
    However, by implementing bdrv_gather_child_options(), block drivers will
    still be able to override the way the full_open_options of their
    children are incorporated into their own.
    
    We need to implement this function for VMDK because we have to prevent
    the generic implementation from gathering the options of all children:
    It is not possible to specify options for the extents through the
    runtime options.
    
    For quorum, the child names that would be used by the generic
    implementation and the ones that we actually (currently) want to use
    differ. See quorum_gather_child_options() for more information.
    
    Note that both of these are cases which are not ideal: In case of VMDK
    it would probably be nice to be able to specify options for all extents.
    In case of quorum, the current runtime option structure is simply broken
    and needs to be fixed (but that is left for another patch).
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-23-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  25. block: Add strong_runtime_opts to BlockDriver

    XanClic committed Feb 1, 2019
    This new field can be set by block drivers to list the runtime options
    they accept that may influence the contents of the respective BDS. As of
    a follow-up patch, this list will be used by the common
    bdrv_refresh_filename() implementation to decide which options to put
    into BDS.full_open_options (and consequently whether a JSON filename has
    to be created), thus freeing the drivers of having to implement that
    logic themselves.
    
    Additionally, this patch adds the field to all of the block drivers that
    need it and sets it accordingly.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-22-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  26. iotests: Add quorum case to test 110

    XanClic committed Feb 1, 2019
    Test 110 tests relative backing filenames for complex BDS trees.  Now
    that the originally supposedly failing test passes, let us add a new
    failing test: Quorum can never work automatically (without detecting
    whether all child nodes have the same base directory, but that would be
    rather inconsistent behavior).
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-21-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  27. block: Use bdrv_dirname() for relative filenames

    XanClic committed Feb 1, 2019
    bdrv_get_full_backing_filename_from_filename() breaks down when it comes
    to JSON filenames. Using bdrv_dirname() as the basis is better because
    since we have BDS, we can descend through the BDS tree to the protocol
    layer, which gives us a greater probability of finding a non-JSON name;
    also, bdrv_dirname() is more correct as it allows block drivers to
    override the generation of that directory name in a protocol-specific
    way.
    
    We still need to keep bdrv_get_full_backing_filename_from_filename(),
    though, because it has valid callers which need it during image creation
    when no BDS is available yet.
    
    This makes a test case in qemu-iotest 110, which was supposed to fail,
    work. That is actually good, but we need to change the reference output
    (and the comment in 110) accordingly.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-20-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  28. block/nfs: Implement bdrv_dirname()

    XanClic committed Feb 1, 2019
    While the basic idea is obvious and could be handled by the default
    bdrv_dirname() implementation, we cannot generate a directory name if
    the gid or uid are set, so we have to explicitly return NULL in those
    cases.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-19-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  29. block/nbd: Make bdrv_dirname() return NULL

    XanClic committed Feb 1, 2019
    The generic bdrv_dirname() implementation would be able to generate some
    form of directory name for many NBD nodes, but it would be always wrong.
    Therefore, we have to explicitly make it an error (until NBD has some
    form of specification for export paths, if it ever will).
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Message-id: 20190201192935.18394-18-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  30. quorum: Make bdrv_dirname() return NULL

    XanClic committed Feb 1, 2019
    While the common implementation for bdrv_dirname() should return NULL
    for quorum BDSs already (because they do not have a file node and their
    exact_filename field should be empty), there is no reason not to make
    that explicit.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-17-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  31. blkverify: Make bdrv_dirname() return NULL

    XanClic committed Feb 1, 2019
    blkverify's BDSs have a file BDS, but we do not want this to be
    preferred over the raw node. There is no way to decide between the two
    (and not really a reason to, either), so just return NULL in blkverify's
    implementation of bdrv_dirname().
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Eric Blake <eblake@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-16-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  32. block: Add bdrv_dirname()

    XanClic committed Feb 1, 2019
    This function may be implemented by block drivers to derive a directory
    name from a BDS. Concatenating this g_free()-able string with a relative
    filename must result in a valid (not necessarily existing) filename, so
    this is a function that should generally be not implemented by format
    drivers, because this is protocol-specific.
    
    If a BDS's driver does not implement this function, bdrv_dirname() will
    fall through to the BDS's file if it exists. If it does not, the
    exact_filename field will be used to generate a directory name.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-15-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  33. block: Fix bdrv_find_backing_image()

    XanClic committed Feb 1, 2019
    bdrv_find_backing_image() should use bdrv_get_full_backing_filename() or
    bdrv_make_absolute_filename() instead of trying to do what those
    functions do by itself.
    
    path_combine_deprecated() can now be dropped, so let's do that.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-14-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  34. block: Add bdrv_make_absolute_filename()

    XanClic committed Feb 1, 2019
    This is a general function for making a filename that is relative to a
    certain BDS absolute.
    
    It calls bdrv_get_full_backing_filename_from_filename() for now, but
    that will be changed in a follow-up patch.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-13-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
  35. block: bdrv_get_full_backing_filename's ret. val.

    XanClic committed Feb 1, 2019
    Make bdrv_get_full_backing_filename() return an allocated string instead
    of placing the result in a caller-provided buffer.
    
    Signed-off-by: Max Reitz <mreitz@redhat.com>
    Reviewed-by: Alberto Garcia <berto@igalia.com>
    Message-id: 20190201192935.18394-12-mreitz@redhat.com
    Signed-off-by: Max Reitz <mreitz@redhat.com>
Older
You can’t perform that action at this time.