[PATCH v11 10/13] stream: skip filters when writing backing file name to QCOW2 header
Vladimir Sementsov-Ogievskiy
vsementsov at virtuozzo.com
Wed Oct 14 15:40:03 UTC 2020
14.10.2020 18:02, Max Reitz wrote:
> On 12.10.20 19:43, Andrey Shinkevich wrote:
>> Avoid writing a filter JSON-name to QCOW2 image when the backing file
>> is changed after the block stream job.
>>
>> Signed-off-by: Andrey Shinkevich <andrey.shinkevich at virtuozzo.com>
>> ---
>> block/stream.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/block/stream.c b/block/stream.c
>> index e0540ee..51462bd 100644
>> --- a/block/stream.c
>> +++ b/block/stream.c
>> @@ -65,6 +65,7 @@ static int stream_prepare(Job *job)
>> BlockDriverState *bs = blk_bs(bjob->blk);
>> BlockDriverState *unfiltered_bs = bdrv_skip_filters(bs);
>> BlockDriverState *base = bdrv_filter_or_cow_bs(s->above_base);
>> + BlockDriverState *base_unfiltered = bdrv_skip_filters(base);
>> Error *local_err = NULL;
>> int ret = 0;
>>
>> @@ -73,10 +74,10 @@ static int stream_prepare(Job *job)
>>
>> if (bdrv_cow_child(unfiltered_bs)) {
>> const char *base_id = NULL, *base_fmt = NULL;
>> - if (base) {
>> - base_id = s->backing_file_str;
>> - if (base->drv) {
>> - base_fmt = base->drv->format_name;
>> + if (base_unfiltered) {
>> + base_id = base_unfiltered->filename;
>
> I think you have to leave this querying s->backing_file_str, and instead
> change how qmp_block_stream() gets @base_name. block-stream has a
> backing-file parameter that can override the string that should be used
> here.
>
> (Or perhaps you can let qmp_block_stream() just set it to NULL if no
> backing-file parameter is passed and then fall back to
> base_unfiltered->filename only here. Probably better, actually, in case
> base_unfiltered is changed during the job run.)
>
Agree with the way in brackets.
If user set backing-file parameter we should handle it here.
If backing-file is not set, we should use dynamically calculated unfiltered base in stream_prepare().
--
Best regards,
Vladimir
More information about the libvir-list
mailing list