All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query
@ 2015-12-12  1:25 John Snow
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 1/4] block/qapi: do not redundantly print "actual path" John Snow
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: John Snow @ 2015-12-12  1:25 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, John Snow, qemu-devel, mreitz

Max: Did you have in mind something like this?

v2:
 - Fix qemu-img from now choking when it gets a partial response.

________________________________________________________________________________

For convenience, this branch is available at:
https://github.com/jnsnow/qemu.git branch block-allow-partial-query
https://github.com/jnsnow/qemu/tree/block-allow-partial-query

This version is tagged block-allow-partial-query-v2:
https://github.com/jnsnow/qemu/releases/tag/block-allow-partial-query-v2

John Snow (4):
  block/qapi: do not redundantly print "actual path"
  block/qapi: always report full_backing_filename
  qemu-img: abort when full_backing_filename not present
  block/qapi: allow best-effort query

 block/qapi.c               | 18 +++++++++++-------
 qemu-img.c                 |  5 ++++-
 tests/qemu-iotests/043.out |  2 ++
 tests/qemu-iotests/110.out |  5 ++++-
 4 files changed, 21 insertions(+), 9 deletions(-)

-- 
2.4.3

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 1/4] block/qapi: do not redundantly print "actual path"
  2015-12-12  1:25 [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query John Snow
@ 2015-12-12  1:25 ` John Snow
  2015-12-14 15:17   ` Max Reitz
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename John Snow
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: John Snow @ 2015-12-12  1:25 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, John Snow, qemu-devel, mreitz

If it happens to match the backing path, that was the actual path.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/qapi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/block/qapi.c b/block/qapi.c
index 267f147..01569da 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -676,7 +676,9 @@ void bdrv_image_info_dump(fprintf_function func_fprintf, void *f,
 
     if (info->has_backing_filename) {
         func_fprintf(f, "backing file: %s", info->backing_filename);
-        if (info->has_full_backing_filename) {
+        if (info->has_full_backing_filename &&
+            (strcmp(info->backing_filename,
+                    info->full_backing_filename) != 0)) {
             func_fprintf(f, " (actual path: %s)", info->full_backing_filename);
         }
         func_fprintf(f, "\n");
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename
  2015-12-12  1:25 [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query John Snow
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 1/4] block/qapi: do not redundantly print "actual path" John Snow
@ 2015-12-12  1:25 ` John Snow
  2015-12-14 16:36   ` Max Reitz
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 3/4] qemu-img: abort when full_backing_filename not present John Snow
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: John Snow @ 2015-12-12  1:25 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, John Snow, qemu-devel, mreitz

Always report full_backing_filename, even if it's the same as
backing_filename. In the next patch, full_backing_filename may be
omitted if it cannot be generated instead of allowing e.g. drive_query
to abort if it runs into this scenario.

The presence or absence of the "full" field becomes useful information.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/qapi.c               | 7 ++++---
 tests/qemu-iotests/043.out | 2 ++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/block/qapi.c b/block/qapi.c
index 01569da..0e6b333 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -251,9 +251,10 @@ void bdrv_query_image_info(BlockDriverState *bs,
             return;
         }
 
-        if (strcmp(backing_filename, backing_filename2) != 0) {
-            info->full_backing_filename =
-                        g_strdup(backing_filename2);
+        /* Always report the full_backing_filename if present, even if it's the
+         * same as backing_filename. That they are same is useful info. */
+        if (backing_filename2) {
+            info->full_backing_filename = g_strdup(backing_filename2);
             info->has_full_backing_filename = true;
         }
 
diff --git a/tests/qemu-iotests/043.out b/tests/qemu-iotests/043.out
index 33f8cc3..b37d2a3 100644
--- a/tests/qemu-iotests/043.out
+++ b/tests/qemu-iotests/043.out
@@ -44,6 +44,7 @@ cluster_size: 65536
         "filename": "TEST_DIR/t.IMGFMT",
         "cluster-size": 65536,
         "format": "IMGFMT",
+        "full-backing-filename": "TEST_DIR/t.IMGFMT.2.base",
         "backing-filename": "TEST_DIR/t.IMGFMT.2.base",
         "dirty-flag": false
     },
@@ -52,6 +53,7 @@ cluster_size: 65536
         "filename": "TEST_DIR/t.IMGFMT.2.base",
         "cluster-size": 65536,
         "format": "IMGFMT",
+        "full-backing-filename": "TEST_DIR/t.IMGFMT.1.base",
         "backing-filename": "TEST_DIR/t.IMGFMT.1.base",
         "dirty-flag": false
     },
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 3/4] qemu-img: abort when full_backing_filename not present
  2015-12-12  1:25 [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query John Snow
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 1/4] block/qapi: do not redundantly print "actual path" John Snow
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename John Snow
@ 2015-12-12  1:25 ` John Snow
  2015-12-14 16:39   ` Max Reitz
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 4/4] block/qapi: allow best-effort query John Snow
  2015-12-14 17:13 ` [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query Max Reitz
  4 siblings, 1 reply; 13+ messages in thread
From: John Snow @ 2015-12-12  1:25 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, John Snow, qemu-devel, mreitz

...But only if we have the backing_filename. It means something Scary
happened and we can't really be quite exactly sure if we can trust the
backing_filename.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 qemu-img.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/qemu-img.c b/qemu-img.c
index 033011c..272bb0b 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -2040,7 +2040,10 @@ static ImageInfoList *collect_image_info_list(const char *filename,
             if (info->has_full_backing_filename) {
                 filename = info->full_backing_filename;
             } else if (info->has_backing_filename) {
-                filename = info->backing_filename;
+                error_report("Could not determine absolute backing filename,"
+                             " but backing filename '%s' present",
+                             info->backing_filename);
+                goto err;
             }
             if (info->has_backing_filename_format) {
                 fmt = info->backing_filename_format;
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [Qemu-devel] [PATCH v2 4/4] block/qapi: allow best-effort query
  2015-12-12  1:25 [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query John Snow
                   ` (2 preceding siblings ...)
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 3/4] qemu-img: abort when full_backing_filename not present John Snow
@ 2015-12-12  1:25 ` John Snow
  2015-12-14 16:50   ` Max Reitz
  2015-12-14 17:13 ` [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query Max Reitz
  4 siblings, 1 reply; 13+ messages in thread
From: John Snow @ 2015-12-12  1:25 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, John Snow, qemu-devel, mreitz

For more complex BDS trees that can be created under normal circumstances,
we lose the ability to issue query commands because of our inability to
re-construct the absolute filename.

Instead, omit this field when it is a problem and present as much information
as we can.

This will change the expected output in iotest 110, where we will now see a
json filename and the lack of an absolute filename instead of an error.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 block/qapi.c               | 7 ++++---
 tests/qemu-iotests/110.out | 5 ++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/block/qapi.c b/block/qapi.c
index 0e6b333..f581c48 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -245,10 +245,11 @@ void bdrv_query_image_info(BlockDriverState *bs,
         info->has_backing_filename = true;
         bdrv_get_full_backing_filename(bs, backing_filename2, PATH_MAX, &err);
         if (err) {
-            error_propagate(errp, err);
-            qapi_free_ImageInfo(info);
+            /* Can't reconstruct the full backing filename, so we must omit
+             * this field and apply a Best Effort to this query. */
             g_free(backing_filename2);
-            return;
+            backing_filename2 = NULL;
+            error_free(err);
         }
 
         /* Always report the full_backing_filename if present, even if it's the
diff --git a/tests/qemu-iotests/110.out b/tests/qemu-iotests/110.out
index 0270980..425485f 100644
--- a/tests/qemu-iotests/110.out
+++ b/tests/qemu-iotests/110.out
@@ -11,7 +11,10 @@ backing file: t.IMGFMT.base (actual path: TEST_DIR/t.IMGFMT.base)
 
 === Non-reconstructable filename ===
 
-qemu-img: Cannot use relative backing file names for 'json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}}'
+image: json:{"driver": "IMGFMT", "file": {"set-state.0.event": "read_aio", "image": {"driver": "file", "filename": "TEST_DIR/t.IMGFMT"}, "driver": "blkdebug", "set-state.0.new_state": 42}}
+file format: IMGFMT
+virtual size: 64M (67108864 bytes)
+backing file: t.IMGFMT.base
 
 === Backing name is always relative to the backed image ===
 
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 1/4] block/qapi: do not redundantly print "actual path"
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 1/4] block/qapi: do not redundantly print "actual path" John Snow
@ 2015-12-14 15:17   ` Max Reitz
  0 siblings, 0 replies; 13+ messages in thread
From: Max Reitz @ 2015-12-14 15:17 UTC (permalink / raw)
  To: John Snow, qemu-block; +Cc: kwolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

On 12.12.2015 02:25, John Snow wrote:
> If it happens to match the backing path, that was the actual path.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  block/qapi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename John Snow
@ 2015-12-14 16:36   ` Max Reitz
  2015-12-14 16:38     ` John Snow
  0 siblings, 1 reply; 13+ messages in thread
From: Max Reitz @ 2015-12-14 16:36 UTC (permalink / raw)
  To: John Snow, qemu-block; +Cc: kwolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2254 bytes --]

On 12.12.2015 02:25, John Snow wrote:
> Always report full_backing_filename, even if it's the same as
> backing_filename. In the next patch, full_backing_filename may be
> omitted if it cannot be generated instead of allowing e.g. drive_query
> to abort if it runs into this scenario.
> 
> The presence or absence of the "full" field becomes useful information.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  block/qapi.c               | 7 ++++---
>  tests/qemu-iotests/043.out | 2 ++
>  2 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/block/qapi.c b/block/qapi.c
> index 01569da..0e6b333 100644
> --- a/block/qapi.c
> +++ b/block/qapi.c
> @@ -251,9 +251,10 @@ void bdrv_query_image_info(BlockDriverState *bs,
>              return;
>          }
>  
> -        if (strcmp(backing_filename, backing_filename2) != 0) {
> -            info->full_backing_filename =
> -                        g_strdup(backing_filename2);
> +        /* Always report the full_backing_filename if present, even if it's the
> +         * same as backing_filename. That they are same is useful info. */
> +        if (backing_filename2) {

Is there a reason for this non-NULL check? Because it always is non-NULL
right now.

Max

> +            info->full_backing_filename = g_strdup(backing_filename2);
>              info->has_full_backing_filename = true;
>          }
>  
> diff --git a/tests/qemu-iotests/043.out b/tests/qemu-iotests/043.out
> index 33f8cc3..b37d2a3 100644
> --- a/tests/qemu-iotests/043.out
> +++ b/tests/qemu-iotests/043.out
> @@ -44,6 +44,7 @@ cluster_size: 65536
>          "filename": "TEST_DIR/t.IMGFMT",
>          "cluster-size": 65536,
>          "format": "IMGFMT",
> +        "full-backing-filename": "TEST_DIR/t.IMGFMT.2.base",
>          "backing-filename": "TEST_DIR/t.IMGFMT.2.base",
>          "dirty-flag": false
>      },
> @@ -52,6 +53,7 @@ cluster_size: 65536
>          "filename": "TEST_DIR/t.IMGFMT.2.base",
>          "cluster-size": 65536,
>          "format": "IMGFMT",
> +        "full-backing-filename": "TEST_DIR/t.IMGFMT.1.base",
>          "backing-filename": "TEST_DIR/t.IMGFMT.1.base",
>          "dirty-flag": false
>      },
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename
  2015-12-14 16:36   ` Max Reitz
@ 2015-12-14 16:38     ` John Snow
  2015-12-14 16:39       ` Max Reitz
  0 siblings, 1 reply; 13+ messages in thread
From: John Snow @ 2015-12-14 16:38 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: kwolf, qemu-devel



On 12/14/2015 11:36 AM, Max Reitz wrote:
> On 12.12.2015 02:25, John Snow wrote:
>> Always report full_backing_filename, even if it's the same as
>> backing_filename. In the next patch, full_backing_filename may be
>> omitted if it cannot be generated instead of allowing e.g. drive_query
>> to abort if it runs into this scenario.
>>
>> The presence or absence of the "full" field becomes useful information.
>>
>> Signed-off-by: John Snow <jsnow@redhat.com>
>> ---
>>  block/qapi.c               | 7 ++++---
>>  tests/qemu-iotests/043.out | 2 ++
>>  2 files changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/block/qapi.c b/block/qapi.c
>> index 01569da..0e6b333 100644
>> --- a/block/qapi.c
>> +++ b/block/qapi.c
>> @@ -251,9 +251,10 @@ void bdrv_query_image_info(BlockDriverState *bs,
>>              return;
>>          }
>>  
>> -        if (strcmp(backing_filename, backing_filename2) != 0) {
>> -            info->full_backing_filename =
>> -                        g_strdup(backing_filename2);
>> +        /* Always report the full_backing_filename if present, even if it's the
>> +         * same as backing_filename. That they are same is useful info. */
>> +        if (backing_filename2) {
> 
> Is there a reason for this non-NULL check? Because it always is non-NULL
> right now.
> 
> Max
> 

No, I was just being convenient with re-ordering patches. It can be NULL
by the end of the set. I'll clean it if there's other work to do.

>> +            info->full_backing_filename = g_strdup(backing_filename2);
>>              info->has_full_backing_filename = true;
>>          }
>>  
>> diff --git a/tests/qemu-iotests/043.out b/tests/qemu-iotests/043.out
>> index 33f8cc3..b37d2a3 100644
>> --- a/tests/qemu-iotests/043.out
>> +++ b/tests/qemu-iotests/043.out
>> @@ -44,6 +44,7 @@ cluster_size: 65536
>>          "filename": "TEST_DIR/t.IMGFMT",
>>          "cluster-size": 65536,
>>          "format": "IMGFMT",
>> +        "full-backing-filename": "TEST_DIR/t.IMGFMT.2.base",
>>          "backing-filename": "TEST_DIR/t.IMGFMT.2.base",
>>          "dirty-flag": false
>>      },
>> @@ -52,6 +53,7 @@ cluster_size: 65536
>>          "filename": "TEST_DIR/t.IMGFMT.2.base",
>>          "cluster-size": 65536,
>>          "format": "IMGFMT",
>> +        "full-backing-filename": "TEST_DIR/t.IMGFMT.1.base",
>>          "backing-filename": "TEST_DIR/t.IMGFMT.1.base",
>>          "dirty-flag": false
>>      },
>>
> 
> 

-- 
—js

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename
  2015-12-14 16:38     ` John Snow
@ 2015-12-14 16:39       ` Max Reitz
  0 siblings, 0 replies; 13+ messages in thread
From: Max Reitz @ 2015-12-14 16:39 UTC (permalink / raw)
  To: John Snow, qemu-block; +Cc: kwolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 2705 bytes --]

On 14.12.2015 17:38, John Snow wrote:
> 
> 
> On 12/14/2015 11:36 AM, Max Reitz wrote:
>> On 12.12.2015 02:25, John Snow wrote:
>>> Always report full_backing_filename, even if it's the same as
>>> backing_filename. In the next patch, full_backing_filename may be
>>> omitted if it cannot be generated instead of allowing e.g. drive_query
>>> to abort if it runs into this scenario.
>>>
>>> The presence or absence of the "full" field becomes useful information.
>>>
>>> Signed-off-by: John Snow <jsnow@redhat.com>
>>> ---
>>>  block/qapi.c               | 7 ++++---
>>>  tests/qemu-iotests/043.out | 2 ++
>>>  2 files changed, 6 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/block/qapi.c b/block/qapi.c
>>> index 01569da..0e6b333 100644
>>> --- a/block/qapi.c
>>> +++ b/block/qapi.c
>>> @@ -251,9 +251,10 @@ void bdrv_query_image_info(BlockDriverState *bs,
>>>              return;
>>>          }
>>>  
>>> -        if (strcmp(backing_filename, backing_filename2) != 0) {
>>> -            info->full_backing_filename =
>>> -                        g_strdup(backing_filename2);
>>> +        /* Always report the full_backing_filename if present, even if it's the
>>> +         * same as backing_filename. That they are same is useful info. */
>>> +        if (backing_filename2) {
>>
>> Is there a reason for this non-NULL check? Because it always is non-NULL
>> right now.
>>
>> Max
>>
> 
> No, I was just being convenient with re-ordering patches. It can be NULL
> by the end of the set. I'll clean it if there's other work to do.

Oh, OK, that's fine then.

Reviewed-by: Max Reitz <mreitz@redhat.com>

> 
>>> +            info->full_backing_filename = g_strdup(backing_filename2);
>>>              info->has_full_backing_filename = true;
>>>          }
>>>  
>>> diff --git a/tests/qemu-iotests/043.out b/tests/qemu-iotests/043.out
>>> index 33f8cc3..b37d2a3 100644
>>> --- a/tests/qemu-iotests/043.out
>>> +++ b/tests/qemu-iotests/043.out
>>> @@ -44,6 +44,7 @@ cluster_size: 65536
>>>          "filename": "TEST_DIR/t.IMGFMT",
>>>          "cluster-size": 65536,
>>>          "format": "IMGFMT",
>>> +        "full-backing-filename": "TEST_DIR/t.IMGFMT.2.base",
>>>          "backing-filename": "TEST_DIR/t.IMGFMT.2.base",
>>>          "dirty-flag": false
>>>      },
>>> @@ -52,6 +53,7 @@ cluster_size: 65536
>>>          "filename": "TEST_DIR/t.IMGFMT.2.base",
>>>          "cluster-size": 65536,
>>>          "format": "IMGFMT",
>>> +        "full-backing-filename": "TEST_DIR/t.IMGFMT.1.base",
>>>          "backing-filename": "TEST_DIR/t.IMGFMT.1.base",
>>>          "dirty-flag": false
>>>      },
>>>
>>
>>
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 3/4] qemu-img: abort when full_backing_filename not present
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 3/4] qemu-img: abort when full_backing_filename not present John Snow
@ 2015-12-14 16:39   ` Max Reitz
  0 siblings, 0 replies; 13+ messages in thread
From: Max Reitz @ 2015-12-14 16:39 UTC (permalink / raw)
  To: John Snow, qemu-block; +Cc: kwolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 389 bytes --]

On 12.12.2015 02:25, John Snow wrote:
> ...But only if we have the backing_filename. It means something Scary
> happened and we can't really be quite exactly sure if we can trust the
> backing_filename.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  qemu-img.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 4/4] block/qapi: allow best-effort query
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 4/4] block/qapi: allow best-effort query John Snow
@ 2015-12-14 16:50   ` Max Reitz
  0 siblings, 0 replies; 13+ messages in thread
From: Max Reitz @ 2015-12-14 16:50 UTC (permalink / raw)
  To: John Snow, qemu-block; +Cc: kwolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

On 12.12.2015 02:25, John Snow wrote:
> For more complex BDS trees that can be created under normal circumstances,
> we lose the ability to issue query commands because of our inability to
> re-construct the absolute filename.
> 
> Instead, omit this field when it is a problem and present as much information
> as we can.
> 
> This will change the expected output in iotest 110, where we will now see a
> json filename and the lack of an absolute filename instead of an error.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>
> ---
>  block/qapi.c               | 7 ++++---
>  tests/qemu-iotests/110.out | 5 ++++-
>  2 files changed, 8 insertions(+), 4 deletions(-)

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query
  2015-12-12  1:25 [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query John Snow
                   ` (3 preceding siblings ...)
  2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 4/4] block/qapi: allow best-effort query John Snow
@ 2015-12-14 17:13 ` Max Reitz
  2015-12-14 17:23   ` John Snow
  4 siblings, 1 reply; 13+ messages in thread
From: Max Reitz @ 2015-12-14 17:13 UTC (permalink / raw)
  To: John Snow, qemu-block; +Cc: kwolf, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 3125 bytes --]

On 12.12.2015 02:25, John Snow wrote:
> Max: Did you have in mind something like this?

What I had in mind was fixing the whole thing (the test case in 110
should actually work just fine, because you can easily determine the
base directory to be used). ;-)

I've been working on that myself anyway, so yes, regarding not aborting
block-status if some full backing filename cannot be reconstructed, this
looks good (by preventing qemu-img from resorting to the relative
filename when querying the backing chain).

There is a single thing I don't find quite perfect:

$ mkdir -p foo
$ ./qemu-img create -f qcow2 foo/base.qcow2 64M
$ ./qemu-img create -f qcow2 -b base.qcow2 foo/top.qcow2
$ ./qemu-img info foo/top.qcow2
[...]
backing file: base.qcow2 (actual path: foo/base.qcow2)
[...]

$ ./qemu-img info \
    "json:{'lazy-refcounts':true,'file.filename':'foo/top.qcow2'}"
[...]
backing file: base.qcow2
[...]

$ cd foo
$ ../qemu-img info top.qcow2
[...]
backing file: base.qcow2
[...]

Before this series, there was only one case where the actual path
information was missing: If it equals the raw relative filename. Now,
there are two cases: As can be seen in the last invokation, it still
will not be emitted if actual and raw filename are equal. But as you can
see in the second invokation, it will be hidden also if it simply cannot
be determined.

Therefore, if the actual path information is missing, the user cannot
determine[1] whether this is due to the actual path (relative to the
CWD) is equal to the (raw) relative path to the overlay; or whether this
is due to some error in determining the absolute filename.

[1] You can by testing whether --backing-chain emits an error. But that
is a bit crude.

I think we should put a note there if an error occurred while
determining the absolute backing filename.

(Doing that is pretty simple:
if (!info->has_full_backing_filename) {
    func_fprintf(f, " (cannot determine actual path)");
} else if (strcmp(...)) {
    func_fprintf(f, " (actual path: %s)", ...);
}
)

I think that should be an additional patch between 2 and 4.

Max

> 
> v2:
>  - Fix qemu-img from now choking when it gets a partial response.
> 
> ________________________________________________________________________________
> 
> For convenience, this branch is available at:
> https://github.com/jnsnow/qemu.git branch block-allow-partial-query
> https://github.com/jnsnow/qemu/tree/block-allow-partial-query
> 
> This version is tagged block-allow-partial-query-v2:
> https://github.com/jnsnow/qemu/releases/tag/block-allow-partial-query-v2
> 
> John Snow (4):
>   block/qapi: do not redundantly print "actual path"
>   block/qapi: always report full_backing_filename
>   qemu-img: abort when full_backing_filename not present
>   block/qapi: allow best-effort query
> 
>  block/qapi.c               | 18 +++++++++++-------
>  qemu-img.c                 |  5 ++++-
>  tests/qemu-iotests/043.out |  2 ++
>  tests/qemu-iotests/110.out |  5 ++++-
>  4 files changed, 21 insertions(+), 9 deletions(-)
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query
  2015-12-14 17:13 ` [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query Max Reitz
@ 2015-12-14 17:23   ` John Snow
  0 siblings, 0 replies; 13+ messages in thread
From: John Snow @ 2015-12-14 17:23 UTC (permalink / raw)
  To: Max Reitz, qemu-block; +Cc: kwolf, qemu-devel



On 12/14/2015 12:13 PM, Max Reitz wrote:
> On 12.12.2015 02:25, John Snow wrote:
>> Max: Did you have in mind something like this?
> 
> What I had in mind was fixing the whole thing (the test case in 110
> should actually work just fine, because you can easily determine the
> base directory to be used). ;-)
> 

Well, yes... though I figured there was some value in this bit alone --
assuming that the fixing of the filename strategy would take longer. You
understand this problem best AFAICT.

> I've been working on that myself anyway, so yes, regarding not aborting
> block-status if some full backing filename cannot be reconstructed, this
> looks good (by preventing qemu-img from resorting to the relative
> filename when querying the backing chain).
> 

I look forward to a less confusing filename situation. :|

> There is a single thing I don't find quite perfect:
> 
> $ mkdir -p foo
> $ ./qemu-img create -f qcow2 foo/base.qcow2 64M
> $ ./qemu-img create -f qcow2 -b base.qcow2 foo/top.qcow2
> $ ./qemu-img info foo/top.qcow2
> [...]
> backing file: base.qcow2 (actual path: foo/base.qcow2)
> [...]
> 
> $ ./qemu-img info \
>     "json:{'lazy-refcounts':true,'file.filename':'foo/top.qcow2'}"
> [...]
> backing file: base.qcow2
> [...]
> 
> $ cd foo
> $ ../qemu-img info top.qcow2
> [...]
> backing file: base.qcow2
> [...]
> 
> Before this series, there was only one case where the actual path
> information was missing: If it equals the raw relative filename. Now,
> there are two cases: As can be seen in the last invokation, it still
> will not be emitted if actual and raw filename are equal. But as you can
> see in the second invokation, it will be hidden also if it simply cannot
> be determined.
> 

Tch, yes.

> Therefore, if the actual path information is missing, the user cannot
> determine[1] whether this is due to the actual path (relative to the
> CWD) is equal to the (raw) relative path to the overlay; or whether this
> is due to some error in determining the absolute filename.
> 
> [1] You can by testing whether --backing-chain emits an error. But that
> is a bit crude.
> 
> I think we should put a note there if an error occurred while
> determining the absolute backing filename.
> 
> (Doing that is pretty simple:
> if (!info->has_full_backing_filename) {
>     func_fprintf(f, " (cannot determine actual path)");
> } else if (strcmp(...)) {
>     func_fprintf(f, " (actual path: %s)", ...);
> }
> )
> 
> I think that should be an additional patch between 2 and 4.
> 
> Max
> 

Yes, thanks.

>>
>> v2:
>>  - Fix qemu-img from now choking when it gets a partial response.
>>
>> ________________________________________________________________________________
>>
>> For convenience, this branch is available at:
>> https://github.com/jnsnow/qemu.git branch block-allow-partial-query
>> https://github.com/jnsnow/qemu/tree/block-allow-partial-query
>>
>> This version is tagged block-allow-partial-query-v2:
>> https://github.com/jnsnow/qemu/releases/tag/block-allow-partial-query-v2
>>
>> John Snow (4):
>>   block/qapi: do not redundantly print "actual path"
>>   block/qapi: always report full_backing_filename
>>   qemu-img: abort when full_backing_filename not present
>>   block/qapi: allow best-effort query
>>
>>  block/qapi.c               | 18 +++++++++++-------
>>  qemu-img.c                 |  5 ++++-
>>  tests/qemu-iotests/043.out |  2 ++
>>  tests/qemu-iotests/110.out |  5 ++++-
>>  4 files changed, 21 insertions(+), 9 deletions(-)
>>
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-12-14 17:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-12  1:25 [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query John Snow
2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 1/4] block/qapi: do not redundantly print "actual path" John Snow
2015-12-14 15:17   ` Max Reitz
2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 2/4] block/qapi: always report full_backing_filename John Snow
2015-12-14 16:36   ` Max Reitz
2015-12-14 16:38     ` John Snow
2015-12-14 16:39       ` Max Reitz
2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 3/4] qemu-img: abort when full_backing_filename not present John Snow
2015-12-14 16:39   ` Max Reitz
2015-12-12  1:25 ` [Qemu-devel] [PATCH v2 4/4] block/qapi: allow best-effort query John Snow
2015-12-14 16:50   ` Max Reitz
2015-12-14 17:13 ` [Qemu-devel] [PATCH v2 0/4] block: allow partial info-block query Max Reitz
2015-12-14 17:23   ` John Snow

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.