diff mbox

[v2,22/35] libxl/libxl_netbuffer.c: used LOG*D functions

Message ID 20161117173617.6697-23-cbosdonnat@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Cedric Bosdonnat Nov. 17, 2016, 5:36 p.m. UTC
From: Cedric Bosdonnat <cbosdonnat@suse.com>

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
---
 tools/libxl/libxl_netbuffer.c | 43 ++++++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 19 deletions(-)
diff mbox

Patch

diff --git a/tools/libxl/libxl_netbuffer.c b/tools/libxl/libxl_netbuffer.c
index 5c7e8a2..323cdd8 100644
--- a/tools/libxl/libxl_netbuffer.c
+++ b/tools/libxl/libxl_netbuffer.c
@@ -48,15 +48,15 @@  int init_subkind_nic(libxl__checkpoint_devices_state *cds)
 
     rs->nlsock = nl_socket_alloc();
     if (!rs->nlsock) {
-        LOG(ERROR, "cannot allocate nl socket");
+        LOGD(ERROR, dss->domid, "cannot allocate nl socket");
         rc = ERROR_FAIL;
         goto out;
     }
 
     ret = nl_connect(rs->nlsock, NETLINK_ROUTE);
     if (ret) {
-        LOG(ERROR, "failed to open netlink socket: %s",
-            nl_geterror(ret));
+        LOGD(ERROR, dss->domid, "failed to open netlink socket: %s",
+             nl_geterror(ret));
         rc = ERROR_FAIL;
         goto out;
     }
@@ -64,8 +64,8 @@  int init_subkind_nic(libxl__checkpoint_devices_state *cds)
     /* get list of all qdiscs installed on network devs. */
     ret = rtnl_qdisc_alloc_cache(rs->nlsock, &rs->qdisc_cache);
     if (ret) {
-        LOG(ERROR, "failed to allocate qdisc cache: %s",
-            nl_geterror(ret));
+        LOGD(ERROR, dss->domid, "failed to allocate qdisc cache: %s",
+             nl_geterror(ret));
         rc = ERROR_FAIL;
         goto out;
     }
@@ -162,7 +162,8 @@  static int init_qdisc(libxl__checkpoint_devices_state *cds,
      */
     ret = nl_cache_refill(rs->nlsock, rs->qdisc_cache);
     if (ret) {
-        LOG(ERROR, "cannot refill qdisc cache: %s", nl_geterror(ret));
+        LOGD(ERROR, cds->domid,
+             "cannot refill qdisc cache: %s", nl_geterror(ret));
         rc = ERROR_FAIL;
         goto out;
     }
@@ -170,7 +171,8 @@  static int init_qdisc(libxl__checkpoint_devices_state *cds,
     /* get a handle to the REMUS_IFB interface */
     ret = rtnl_link_get_kernel(rs->nlsock, 0, remus_nic->ifb, &ifb);
     if (ret) {
-        LOG(ERROR, "cannot obtain handle for %s: %s", remus_nic->ifb,
+        LOGD(ERROR, cds->domid,
+             "cannot obtain handle for %s: %s", remus_nic->ifb,
             nl_geterror(ret));
         rc = ERROR_FAIL;
         goto out;
@@ -178,7 +180,8 @@  static int init_qdisc(libxl__checkpoint_devices_state *cds,
 
     ifindex = rtnl_link_get_ifindex(ifb);
     if (!ifindex) {
-        LOG(ERROR, "interface %s has no index", remus_nic->ifb);
+        LOGD(ERROR, cds->domid,
+             "interface %s has no index", remus_nic->ifb);
         rc = ERROR_FAIL;
         goto out;
     }
@@ -196,13 +199,15 @@  static int init_qdisc(libxl__checkpoint_devices_state *cds,
         const char *tc_kind = rtnl_tc_get_kind(TC_CAST(qdisc));
         /* Sanity check: Ensure that the root qdisc is a plug qdisc. */
         if (!tc_kind || strcmp(tc_kind, "plug")) {
-            LOG(ERROR, "plug qdisc is not installed on %s", remus_nic->ifb);
+            LOGD(ERROR, cds->domid,
+                 "plug qdisc is not installed on %s", remus_nic->ifb);
             rc = ERROR_FAIL;
             goto out;
         }
         remus_nic->qdisc = qdisc;
     } else {
-        LOG(ERROR, "Cannot get qdisc handle from ifb %s", remus_nic->ifb);
+        LOGD(ERROR, cds->domid,
+             "Cannot get qdisc handle from ifb %s", remus_nic->ifb);
         rc = ERROR_FAIL;
         goto out;
     }
@@ -366,8 +371,8 @@  static void netbuf_setup_script_cb(libxl__egc *egc,
         goto out;
 
     if (!(*ifb)) {
-        LOG(ERROR, "Cannot get ifb dev name for domain %u dev %s",
-            domid, vif);
+        LOGD(ERROR, domid, "Cannot get ifb dev name for domain %u dev %s",
+             domid, vif);
         rc = ERROR_FAIL;
         goto out;
     }
@@ -382,8 +387,8 @@  static void netbuf_setup_script_cb(libxl__egc *egc,
         goto out;
 
     if (hotplug_error) {
-        LOG(ERROR, "netbuf script %s setup failed for vif %s: %s",
-            rs->netbufscript, vif, hotplug_error);
+        LOGD(ERROR, domid, "netbuf script %s setup failed for vif %s: %s",
+             rs->netbufscript, vif, hotplug_error);
         rc = ERROR_FAIL;
         goto out;
     }
@@ -393,7 +398,7 @@  static void netbuf_setup_script_cb(libxl__egc *egc,
         goto out;
     }
 
-    LOG(DEBUG, "%s will buffer packets from vif %s", *ifb, vif);
+    LOGD(DEBUG, domid, "%s will buffer packets from vif %s", *ifb, vif);
     rc = init_qdisc(cds, remus_nic);
 
 out:
@@ -475,10 +480,10 @@  static int remus_netbuf_op(libxl__remus_device_nic *remus_nic,
 
 out:
     if (rc)
-        LOG(ERROR, "Remus: cannot do netbuf op %s on %s:%s",
-            ((buffer_op == tc_buffer_start) ?
-            "start_new_epoch" : "release_prev_epoch"),
-            remus_nic->ifb, nl_geterror(ret));
+        LOGD(ERROR, cds-> domid, "Remus: cannot do netbuf op %s on %s:%s",
+             ((buffer_op == tc_buffer_start) ?
+             "start_new_epoch" : "release_prev_epoch"),
+             remus_nic->ifb, nl_geterror(ret));
     return rc;
 }