qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3] block: output more error messages if failed to create temporary snapshot
@ 2012-09-05 13:24 riegamaths
  2012-09-05 15:40 ` Paolo Bonzini
  2012-09-07 13:12 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: riegamaths @ 2012-09-05 13:24 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, Dunrong Huang

From: Dunrong Huang <riegamaths@gmail.com>

If we failed to create temporary snapshot, the error message did not match
with the error, for example:

$ TMPDIR=/tmp/bad_path qemu-system-x86_64 -enable-kvm debian.qcow2 -snapshot
qemu-system-x86_64: -enable-kvm: could not open disk image /home/mathslinux/Images/debian.qcow2: No such file or directory

Indeed, the file which cant be created is /tmp/bad_path/vl.xxxxxx,  not
debian.qcow2. so the error message makes users feel confused.

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
---
v1 -> v2:
   Output error message only if fd < 0
v2 -> v3:
   Output error message in the caller of get_tmp_filename()
 block.c | 2 ++
 1 个文件被修改,插入 2 行(+)

diff --git a/block.c b/block.c
index 470bdcc..074987e 100644
--- a/block.c
+++ b/block.c
@@ -764,6 +764,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
 
         ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
         if (ret < 0) {
+            fprintf(stderr, "Could not create temporary snapshot %s: %s\n",
+                    tmp_filename, strerror(errno));
             return ret;
         }
 
-- 
1.7.12

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

* Re: [Qemu-devel] [PATCH v3] block: output more error messages if failed to create temporary snapshot
  2012-09-05 13:24 [Qemu-devel] [PATCH v3] block: output more error messages if failed to create temporary snapshot riegamaths
@ 2012-09-05 15:40 ` Paolo Bonzini
  2012-09-07 13:12 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2012-09-05 15:40 UTC (permalink / raw)
  To: riegamaths; +Cc: qemu-trivial, qemu-devel

Il 05/09/2012 15:24, riegamaths@gmail.com ha scritto:
> From: Dunrong Huang <riegamaths@gmail.com>
> 
> If we failed to create temporary snapshot, the error message did not match
> with the error, for example:
> 
> $ TMPDIR=/tmp/bad_path qemu-system-x86_64 -enable-kvm debian.qcow2 -snapshot
> qemu-system-x86_64: -enable-kvm: could not open disk image /home/mathslinux/Images/debian.qcow2: No such file or directory
> 
> Indeed, the file which cant be created is /tmp/bad_path/vl.xxxxxx,  not
> debian.qcow2. so the error message makes users feel confused.
> 
> Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
> ---
> v1 -> v2:
>    Output error message only if fd < 0
> v2 -> v3:
>    Output error message in the caller of get_tmp_filename()
>  block.c | 2 ++
>  1 个文件被修改,插入 2 行(+)
> 
> diff --git a/block.c b/block.c
> index 470bdcc..074987e 100644
> --- a/block.c
> +++ b/block.c
> @@ -764,6 +764,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
>  
>          ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
>          if (ret < 0) {
> +            fprintf(stderr, "Could not create temporary snapshot %s: %s\n",
> +                    tmp_filename, strerror(errno));
>              return ret;
>          }
>  
> 

Looks good.

Paolo

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

* Re: [Qemu-devel] [PATCH v3] block: output more error messages if failed to create temporary snapshot
  2012-09-05 13:24 [Qemu-devel] [PATCH v3] block: output more error messages if failed to create temporary snapshot riegamaths
  2012-09-05 15:40 ` Paolo Bonzini
@ 2012-09-07 13:12 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2012-09-07 13:12 UTC (permalink / raw)
  To: riegamaths; +Cc: qemu-trivial, qemu-devel

Am 05.09.2012 15:24, schrieb riegamaths@gmail.com:
> From: Dunrong Huang <riegamaths@gmail.com>
> 
> If we failed to create temporary snapshot, the error message did not match
> with the error, for example:
> 
> $ TMPDIR=/tmp/bad_path qemu-system-x86_64 -enable-kvm debian.qcow2 -snapshot
> qemu-system-x86_64: -enable-kvm: could not open disk image /home/mathslinux/Images/debian.qcow2: No such file or directory
> 
> Indeed, the file which cant be created is /tmp/bad_path/vl.xxxxxx,  not
> debian.qcow2. so the error message makes users feel confused.
> 
> Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
> ---
> v1 -> v2:
>    Output error message only if fd < 0
> v2 -> v3:
>    Output error message in the caller of get_tmp_filename()
>  block.c | 2 ++
>  1 个文件被修改,插入 2 行(+)
> 
> diff --git a/block.c b/block.c
> index 470bdcc..074987e 100644
> --- a/block.c
> +++ b/block.c
> @@ -764,6 +764,8 @@ int bdrv_open(BlockDriverState *bs, const char *filename, int flags,
>  
>          ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
>          if (ret < 0) {
> +            fprintf(stderr, "Could not create temporary snapshot %s: %s\n",
> +                    tmp_filename, strerror(errno));

This should be strerror(-ret). Also consider using error_report()
instead of fprintf().

>              return ret;
>          }
>  

Kevin

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

end of thread, other threads:[~2012-09-07 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 13:24 [Qemu-devel] [PATCH v3] block: output more error messages if failed to create temporary snapshot riegamaths
2012-09-05 15:40 ` Paolo Bonzini
2012-09-07 13:12 ` Kevin Wolf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).