diff mbox series

[PULL,2/2] net/vde: print error on vde_open() failure

Message ID 1522047629-27658-3-git-send-email-jasowang@redhat.com
State New
Headers show
Series [PULL,1/2] virtio_net: flush uncompleted TX on reset | expand

Commit Message

Jason Wang March 26, 2018, 7 a.m. UTC
From: Julia Suvorova via Qemu-devel <qemu-devel@nongnu.org>

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>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
 net/vde.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé March 26, 2018, 12:13 p.m. UTC | #1
Hi Jason,

On 03/26/2018 04:00 AM, Jason Wang wrote:
> From: Julia Suvorova via Qemu-devel <qemu-devel@nongnu.org>

This doesn't look right, shouldn't it be Julia Suvorova <jusual@mail.ru>?

> 
> 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>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
>  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;
>      }
>  
>
Eric Blake March 26, 2018, 2:20 p.m. UTC | #2
On 03/26/2018 07:13 AM, Philippe Mathieu-Daudé wrote:
> Hi Jason,
> 
> On 03/26/2018 04:00 AM, Jason Wang wrote:
>> From: Julia Suvorova via Qemu-devel <qemu-devel@nongnu.org>
> 
> This doesn't look right, shouldn't it be Julia Suvorova <jusual@mail.ru>?

Can patchew be taught to flag mails like this?  (The rewrite occurs when 
a sender's mail service is so strict that mailman has to rewrite the 
From: address to get it to the list without the mail being dropped to 
certain recipients; the sender can work around the problem by manually 
including a From: line in the body of the message that overrides the 
overwritten From: line from the headers).
diff mbox series

Patch

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;
     }