[PATCH 1/3] Make virNetClientStreamEventRemoveCallback's errors optional

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There will be new place for this function to be called, but we need
not to report error from there.  Since the virNetClientStream
structure is private, there is no way to check for st->cb from outside
this file, so we need to make the error reporting optional.  The
function name is already long enough to have yet another Quiet suffix
like some other functions do, plus it is only called from two places,
so just add bool for that.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
 src/remote/remote_driver.c   |  2 +-
 src/rpc/virnetclientstream.c | 10 +++++++---
 src/rpc/virnetclientstream.h |  3 ++-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index d27e96ffc2b7..968fdfba191c 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -5838,7 +5838,7 @@ remoteStreamEventRemoveCallback(virStreamPtr st)

     remoteDriverLock(priv);

-    ret = virNetClientStreamEventRemoveCallback(privst);
+    ret = virNetClientStreamEventRemoveCallback(privst, false);

     remoteDriverUnlock(priv);
     return ret;
diff --git a/src/rpc/virnetclientstream.c b/src/rpc/virnetclientstream.c
index a9bf271dc5ba..1f8456f59455 100644
--- a/src/rpc/virnetclientstream.c
+++ b/src/rpc/virnetclientstream.c
@@ -712,14 +712,18 @@ int virNetClientStreamEventUpdateCallback(virNetClientStreamPtr st,
     return ret;
 }

-int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st)
+int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st, bool quiet)
 {
     int ret = -1;

     virObjectLock(st);
     if (!st->cb) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       "%s", _("no stream callback registered"));
+        if (quiet) {
+            ret = 0;
+        } else {
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           "%s", _("no stream callback registered"));
+        }
         goto cleanup;
     }

diff --git a/src/rpc/virnetclientstream.h b/src/rpc/virnetclientstream.h
index c4e01bf1cab0..4f114849e4e9 100644
--- a/src/rpc/virnetclientstream.h
+++ b/src/rpc/virnetclientstream.h
@@ -79,7 +79,8 @@ int virNetClientStreamEventAddCallback(virNetClientStreamPtr st,

 int virNetClientStreamEventUpdateCallback(virNetClientStreamPtr st,
                                           int events);
-int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st);
+int virNetClientStreamEventRemoveCallback(virNetClientStreamPtr st,
+                                          bool quiet);

 bool virNetClientStreamEOF(virNetClientStreamPtr st)
     ATTRIBUTE_NONNULL(1);
-- 
2.13.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux