All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] net/vde: print error on vde_open() failure
@ 2018-03-15 20:06 Julia Suvorova
  2018-03-16  9:24 ` Jason Wang
  2018-03-16 16:01 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Julia Suvorova @ 2018-03-15 20:06 UTC (permalink / raw)
  To: Jason Wang
  Cc: qemu-devel, Markus Armbruster, Stefan Hajnoczi, Jim Mussared,
	Joel Stanley, Julia Suvorova

Despite the fact that now when the initialization of vde fails, qemu
does not end silently, no informative error is printed. The patch
generates an error and pushes it through the calling function.

Related bug: https://bugs.launchpad.net/qemu/+bug/676029

Signed-off-by: Julia Suvorova <jusual@mail.ru>
---
 net/vde.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/vde.c b/net/vde.c
index e50e5d6..99189cc 100644
--- a/net/vde.c
+++ b/net/vde.c
@@ -30,6 +30,7 @@
 #include "qemu-common.h"
 #include "qemu/option.h"
 #include "qemu/main-loop.h"
+#include "qapi/error.h"
 
 typedef struct VDEState {
     NetClientState nc;
@@ -76,7 +77,7 @@ static NetClientInfo net_vde_info = {
 
 static int net_vde_init(NetClientState *peer, const char *model,
                         const char *name, const char *sock,
-                        int port, const char *group, int mode)
+                        int port, const char *group, int mode, Error **errp)
 {
     NetClientState *nc;
     VDEState *s;
@@ -92,6 +93,7 @@ static int net_vde_init(NetClientState *peer, const char *model,
 
     vde = vde_open(init_sock, (char *)"QEMU", &args);
     if (!vde){
+        error_setg_errno(errp, errno, "Could not open vde");
         return -1;
     }
 
@@ -112,7 +114,6 @@ static int net_vde_init(NetClientState *peer, const char *model,
 int net_init_vde(const Netdev *netdev, const char *name,
                  NetClientState *peer, Error **errp)
 {
-    /* FIXME error_setg(errp, ...) on failure */
     const NetdevVdeOptions *vde;
 
     assert(netdev->type == NET_CLIENT_DRIVER_VDE);
@@ -120,7 +121,7 @@ int net_init_vde(const Netdev *netdev, const char *name,
 
     /* missing optional values have been initialized to "all bits zero" */
     if (net_vde_init(peer, "vde", name, vde->sock, vde->port, vde->group,
-                     vde->has_mode ? vde->mode : 0700) == -1) {
+                     vde->has_mode ? vde->mode : 0700, errp) == -1) {
         return -1;
     }
 
-- 
2.1.4

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

* Re: [Qemu-devel] [PATCH] net/vde: print error on vde_open() failure
  2018-03-15 20:06 [Qemu-devel] [PATCH] net/vde: print error on vde_open() failure Julia Suvorova
@ 2018-03-16  9:24 ` Jason Wang
  2018-03-16 16:01 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Wang @ 2018-03-16  9:24 UTC (permalink / raw)
  To: Julia Suvorova
  Cc: Jim Mussared, Stefan Hajnoczi, qemu-devel, Markus Armbruster,
	Joel Stanley



On 2018年03月16日 04:06, Julia Suvorova via Qemu-devel wrote:
> Despite the fact that now when the initialization of vde fails, qemu
> does not end silently, no informative error is printed. The patch
> generates an error and pushes it through the calling function.
>
> Related bug: https://bugs.launchpad.net/qemu/+bug/676029
>
> Signed-off-by: Julia Suvorova <jusual@mail.ru>
> ---
>   net/vde.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/net/vde.c b/net/vde.c
> index e50e5d6..99189cc 100644
> --- a/net/vde.c
> +++ b/net/vde.c
> @@ -30,6 +30,7 @@
>   #include "qemu-common.h"
>   #include "qemu/option.h"
>   #include "qemu/main-loop.h"
> +#include "qapi/error.h"
>   
>   typedef struct VDEState {
>       NetClientState nc;
> @@ -76,7 +77,7 @@ static NetClientInfo net_vde_info = {
>   
>   static int net_vde_init(NetClientState *peer, const char *model,
>                           const char *name, const char *sock,
> -                        int port, const char *group, int mode)
> +                        int port, const char *group, int mode, Error **errp)
>   {
>       NetClientState *nc;
>       VDEState *s;
> @@ -92,6 +93,7 @@ static int net_vde_init(NetClientState *peer, const char *model,
>   
>       vde = vde_open(init_sock, (char *)"QEMU", &args);
>       if (!vde){
> +        error_setg_errno(errp, errno, "Could not open vde");
>           return -1;
>       }
>   
> @@ -112,7 +114,6 @@ static int net_vde_init(NetClientState *peer, const char *model,
>   int net_init_vde(const Netdev *netdev, const char *name,
>                    NetClientState *peer, Error **errp)
>   {
> -    /* FIXME error_setg(errp, ...) on failure */
>       const NetdevVdeOptions *vde;
>   
>       assert(netdev->type == NET_CLIENT_DRIVER_VDE);
> @@ -120,7 +121,7 @@ int net_init_vde(const Netdev *netdev, const char *name,
>   
>       /* missing optional values have been initialized to "all bits zero" */
>       if (net_vde_init(peer, "vde", name, vde->sock, vde->port, vde->group,
> -                     vde->has_mode ? vde->mode : 0700) == -1) {
> +                     vde->has_mode ? vde->mode : 0700, errp) == -1) {
>           return -1;
>       }
>   

Applied.

Thanks

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

* Re: [Qemu-devel] [PATCH] net/vde: print error on vde_open() failure
  2018-03-15 20:06 [Qemu-devel] [PATCH] net/vde: print error on vde_open() failure Julia Suvorova
  2018-03-16  9:24 ` Jason Wang
@ 2018-03-16 16:01 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2018-03-16 16:01 UTC (permalink / raw)
  To: Julia Suvorova
  Cc: Jason Wang, qemu-devel, Markus Armbruster, Jim Mussared, Joel Stanley

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

On Thu, Mar 15, 2018 at 11:06:32PM +0300, Julia Suvorova wrote:
> Despite the fact that now when the initialization of vde fails, qemu
> does not end silently, no informative error is printed. The patch
> generates an error and pushes it through the calling function.
> 
> Related bug: https://bugs.launchpad.net/qemu/+bug/676029
> 
> Signed-off-by: Julia Suvorova <jusual@mail.ru>
> ---
>  net/vde.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

end of thread, other threads:[~2018-03-16 16:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 20:06 [Qemu-devel] [PATCH] net/vde: print error on vde_open() failure Julia Suvorova
2018-03-16  9:24 ` Jason Wang
2018-03-16 16:01 ` Stefan Hajnoczi

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.