diff mbox

discard rbd error output when not relevant in qemu-iotests

Message ID 1388363614-25411-1-git-send-email-loic@dachary.org
State New
Headers show

Commit Message

Loic Dachary Dec. 30, 2013, 12:33 a.m. UTC
Stash the rbd stderr and stdout because it also contains human readable
progress messages : Removing image: 3% complete... in addition to
potential error messages.

Display the stashed output if rbd exits on error.

Signed-off-by: Loic Dachary <loic@dachary.org>
---
 tests/qemu-iotests/common.rc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Benoît Canet Dec. 30, 2013, 12:39 a.m. UTC | #1
Le Monday 30 Dec 2013 à 01:33:34 (+0100), Loic Dachary a écrit :
> Stash the rbd stderr and stdout because it also contains human readable
> progress messages : Removing image: 3% complete... in addition to
> potential error messages.
> 
> Display the stashed output if rbd exits on error.
> 
> Signed-off-by: Loic Dachary <loic@dachary.org>
> ---
>  tests/qemu-iotests/common.rc | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index 28ba0d9..af66bbd 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -189,7 +189,11 @@ _cleanup_test_img()
>              ;;
>  
>          rbd)
> -            rbd rm "$TEST_DIR/t.$IMGFMT" > /dev/null
> +            if ! rbd rm "$TEST_DIR/t.$IMGFMT" > $TEST_DIR/rbd.out 2>&1
> +            then
> +                cat $TEST_DIR/rbd.out
> +            fi
> +            rm $TEST_DIR/rbd.out
>              ;;
>  
>          sheepdog)

Hi Loïc,

Maybe you could filter by modifying _filter_qemu_io.

Best regards

Benoît
> -- 
> 1.8.3.2
> 
>
Loic Dachary Dec. 30, 2013, 12:50 a.m. UTC | #2
Hi Benoît,

If I understand correctly common.filter is designed to transform the output and remove variance. In the case of rbd displaying the progress of removal, it is something we probably want to get rid of entirely. Please let me know if I'm missing something and I'll update the patch according to your suggestion.

Cheers

On 30/12/2013 01:39, Benoît Canet wrote:
> Le Monday 30 Dec 2013 à 01:33:34 (+0100), Loic Dachary a écrit :
>> Stash the rbd stderr and stdout because it also contains human readable
>> progress messages : Removing image: 3% complete... in addition to
>> potential error messages.
>>
>> Display the stashed output if rbd exits on error.
>>
>> Signed-off-by: Loic Dachary <loic@dachary.org>
>> ---
>>  tests/qemu-iotests/common.rc | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
>> index 28ba0d9..af66bbd 100644
>> --- a/tests/qemu-iotests/common.rc
>> +++ b/tests/qemu-iotests/common.rc
>> @@ -189,7 +189,11 @@ _cleanup_test_img()
>>              ;;
>>  
>>          rbd)
>> -            rbd rm "$TEST_DIR/t.$IMGFMT" > /dev/null
>> +            if ! rbd rm "$TEST_DIR/t.$IMGFMT" > $TEST_DIR/rbd.out 2>&1
>> +            then
>> +                cat $TEST_DIR/rbd.out
>> +            fi
>> +            rm $TEST_DIR/rbd.out
>>              ;;
>>  
>>          sheepdog)
> 
> Hi Loïc,
> 
> Maybe you could filter by modifying _filter_qemu_io.
> 
> Best regards
> 
> Benoît
>> -- 
>> 1.8.3.2
>>
>>
> 
> 
>
Stefan Hajnoczi Jan. 6, 2014, 2:23 a.m. UTC | #3
On Mon, Dec 30, 2013 at 01:33:34AM +0100, Loic Dachary wrote:
> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> index 28ba0d9..af66bbd 100644
> --- a/tests/qemu-iotests/common.rc
> +++ b/tests/qemu-iotests/common.rc
> @@ -189,7 +189,11 @@ _cleanup_test_img()
>              ;;
>  
>          rbd)
> -            rbd rm "$TEST_DIR/t.$IMGFMT" > /dev/null

stderr will be displayed.  Why isn't this enough?
Loic Dachary Jan. 6, 2014, 3:50 p.m. UTC | #4
On 06/01/2014 03:23, Stefan Hajnoczi wrote:
> On Mon, Dec 30, 2013 at 01:33:34AM +0100, Loic Dachary wrote:
>> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
>> index 28ba0d9..af66bbd 100644
>> --- a/tests/qemu-iotests/common.rc
>> +++ b/tests/qemu-iotests/common.rc
>> @@ -189,7 +189,11 @@ _cleanup_test_img()
>>              ;;
>>  
>>          rbd)
>> -            rbd rm "$TEST_DIR/t.$IMGFMT" > /dev/null
> 
> stderr will be displayed.  Why isn't this enough?
> 

Because the progress of the removal operation will be displayed on stderr. rbd outputs on stderr even when there is no error.

Happy new year !
Stefan Hajnoczi Jan. 8, 2014, 4:33 a.m. UTC | #5
On Mon, Jan 06, 2014 at 04:50:41PM +0100, Loic Dachary wrote:
> 
> 
> On 06/01/2014 03:23, Stefan Hajnoczi wrote:
> > On Mon, Dec 30, 2013 at 01:33:34AM +0100, Loic Dachary wrote:
> >> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
> >> index 28ba0d9..af66bbd 100644
> >> --- a/tests/qemu-iotests/common.rc
> >> +++ b/tests/qemu-iotests/common.rc
> >> @@ -189,7 +189,11 @@ _cleanup_test_img()
> >>              ;;
> >>  
> >>          rbd)
> >> -            rbd rm "$TEST_DIR/t.$IMGFMT" > /dev/null
> > 
> > stderr will be displayed.  Why isn't this enough?
> > 
> 
> Because the progress of the removal operation will be displayed on stderr. rbd outputs on stderr even when there is no error.

Is that a bug in the rbd tool which should be fixed?  Either by printing
progress to stdout or by adding a --quiet option?
Loic Dachary Jan. 8, 2014, 8:22 a.m. UTC | #6
On 08/01/2014 05:33, Stefan Hajnoczi wrote:
> On Mon, Jan 06, 2014 at 04:50:41PM +0100, Loic Dachary wrote:
>>
>>
>> On 06/01/2014 03:23, Stefan Hajnoczi wrote:
>>> On Mon, Dec 30, 2013 at 01:33:34AM +0100, Loic Dachary wrote:
>>>> diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
>>>> index 28ba0d9..af66bbd 100644
>>>> --- a/tests/qemu-iotests/common.rc
>>>> +++ b/tests/qemu-iotests/common.rc
>>>> @@ -189,7 +189,11 @@ _cleanup_test_img()
>>>>              ;;
>>>>  
>>>>          rbd)
>>>> -            rbd rm "$TEST_DIR/t.$IMGFMT" > /dev/null
>>>
>>> stderr will be displayed.  Why isn't this enough?
>>>
>>
>> Because the progress of the removal operation will be displayed on stderr. rbd outputs on stderr even when there is no error.
> 
> Is that a bug in the rbd tool which should be fixed?  Either by printing
> progress to stdout or by adding a --quiet option?

In my opinion, yes. But Josh may disagree ;-)
diff mbox

Patch

diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 28ba0d9..af66bbd 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -189,7 +189,11 @@  _cleanup_test_img()
             ;;
 
         rbd)
-            rbd rm "$TEST_DIR/t.$IMGFMT" > /dev/null
+            if ! rbd rm "$TEST_DIR/t.$IMGFMT" > $TEST_DIR/rbd.out 2>&1
+            then
+                cat $TEST_DIR/rbd.out
+            fi
+            rm $TEST_DIR/rbd.out
             ;;
 
         sheepdog)