• M
    block: driver should override flags in bdrv_open() · 53a29513
    Max Reitz 提交于
    The BDRV_O_PROTOCOL flag should have an impact only if no driver is
    specified explicitly. Therefore, if bdrv_open() is called with an
    explicit block driver argument (either through the options QDict or
    through the drv parameter) and that block driver is a protocol block
    driver, BDRV_O_PROTOCOL should be set; if it is a format block driver,
    BDRV_O_PROTOCOL should be unset.
    
    While there was code to unset the flag in case a format block driver
    has been selected, it only followed the bdrv_fill_options() function
    call whereas the flag in fact needs to be adjusted before it is used
    there.
    
    With that change, BDRV_O_PROTOCOL will always be set if the BDS should
    be a protocol driver; if the driver has been specified explicitly, the
    new code will set it; and bdrv_fill_options() will only "probe" a
    protocol driver if BDRV_O_PROTOCOL is set. The probing after
    bdrv_fill_options() cannot select a protocol driver.
    
    Thus, bdrv_open_image() to open BDS.file is never called if a protocol
    BDS is about to be created. With that change in turn it is impossible to
    call bdrv_open_common() with a protocol drv and file != NULL, which
    allows us to remove the bdrv_swap() call.
    
    This change breaks a test case in qemu-iotest 051:
    "-drive file=t.qcow2,file.driver=qcow2" now works because the explicitly
    specified "qcow2" overrides the BDRV_O_PROTOCOL which is automatically
    set for the "file" BDS (and the filename is just passed down).
    Therefore, this patch removes that test case.
    Signed-off-by: NMax Reitz <mreitz@redhat.com>
    Signed-off-by: NKevin Wolf <kwolf@redhat.com>
    53a29513
051 9.2 KB