[Qemu-devel] [PATCH v3 37/38] raw: Convert a warning to warn_report()

Markus Armbruster posted 38 patches 7 years ago
There is a newer version of this series
[Qemu-devel] [PATCH v3 37/38] raw: Convert a warning to warn_report()
Posted by Markus Armbruster 7 years ago
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 block/raw-format.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/block/raw-format.c b/block/raw-format.c
index 6f6dc99b2c..d65fd0ffce 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -29,6 +29,7 @@
 #include "qemu/osdep.h"
 #include "block/block_int.h"
 #include "qapi/error.h"
+#include "qemu/error-report.h"
 #include "qemu/option.h"
 
 typedef struct BDRVRawState {
@@ -436,14 +437,14 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
             bs->file->bs->supported_zero_flags);
 
     if (bs->probed && !bdrv_is_read_only(bs)) {
-        fprintf(stderr,
-                "WARNING: Image format was not specified for '%s' and probing "
-                "guessed raw.\n"
-                "         Automatically detecting the format is dangerous for "
-                "raw images, write operations on block 0 will be restricted.\n"
-                "         Specify the 'raw' format explicitly to remove the "
-                "restrictions.\n",
-                bs->file->bs->filename);
+        warn_report("Image format was not specified for '%s' and probing "
+                    "guessed raw",
+                    bs->file->bs->filename);
+        error_printf("Automatically detecting the format is dangerous for "
+                     "raw images, write\n"
+                     "operations on block 0 will be restricted.\n"
+                     "Specify the 'raw' format explicitly to remove the "
+                     "restrictions.\n");
     }
 
     ret = raw_read_options(options, bs, s, errp);
-- 
2.17.1


Re: [Qemu-devel] [PATCH v3 37/38] raw: Convert a warning to warn_report()
Posted by Eric Blake 7 years ago
On 10/16/18 12:41 PM, Markus Armbruster wrote:
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>   block/raw-format.c | 17 +++++++++--------
>   1 file changed, 9 insertions(+), 8 deletions(-)

Incomplete. tests/qemu-iotests/109.out needs updating:

> @@ -436,14 +437,14 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
>               bs->file->bs->supported_zero_flags);
>   
>       if (bs->probed && !bdrv_is_read_only(bs)) {
> -        fprintf(stderr,
> -                "WARNING: Image format was not specified for '%s' and probing "
> -                "guessed raw.\n"
> -                "         Automatically detecting the format is dangerous for "
> -                "raw images, write operations on block 0 will be restricted.\n"
> -                "         Specify the 'raw' format explicitly to remove the "
> -                "restrictions.\n",
> -                bs->file->bs->filename);
> +        warn_report("Image format was not specified for '%s' and probing "

as this changes s/WARNING/warning/

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Re: [Qemu-devel] [PATCH v3 37/38] raw: Convert a warning to warn_report()
Posted by Markus Armbruster 7 years ago
Eric Blake <eblake@redhat.com> writes:

> On 10/16/18 12:41 PM, Markus Armbruster wrote:
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>>   block/raw-format.c | 17 +++++++++--------
>>   1 file changed, 9 insertions(+), 8 deletions(-)
>
> Incomplete. tests/qemu-iotests/109.out needs updating:
>
>> @@ -436,14 +437,14 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
>>               bs->file->bs->supported_zero_flags);
>>         if (bs->probed && !bdrv_is_read_only(bs)) {
>> -        fprintf(stderr,
>> -                "WARNING: Image format was not specified for '%s' and probing "
>> -                "guessed raw.\n"
>> -                "         Automatically detecting the format is dangerous for "
>> -                "raw images, write operations on block 0 will be restricted.\n"
>> -                "         Specify the 'raw' format explicitly to remove the "
>> -                "restrictions.\n",
>> -                bs->file->bs->filename);
>> +        warn_report("Image format was not specified for '%s' and probing "
>
> as this changes s/WARNING/warning/

Not run by "make check-block"...  Will fix, thanks!