]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Remove new lines from log messages
authorJiri Denemark <jdenemar@redhat.com>
Tue, 27 Oct 2015 18:14:01 +0000 (19:14 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 4 Nov 2015 12:09:35 +0000 (13:09 +0100)
VIR_DEBUG and VIR_WARN will automatically add a new line to the message,
having "\n" at the end or at the beginning of the message results in
empty lines.

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
13 files changed:
src/libvirt.c
src/nwfilter/nwfilter_dhcpsnoop.c
src/nwfilter/nwfilter_gentech_driver.c
src/nwfilter/nwfilter_learnipaddr.c
src/rpc/virnetsocket.c
src/util/virfile.c
src/util/virhash.c
src/util/virnetdevmacvlan.c
src/util/virprocess.c
src/xen/xend_internal.c
tests/virhostdevtest.c
tests/virnetsockettest.c
tests/virtimetest.c

index 2602dde803a67516ddd0d85a804a02becfcdecb6..25a004049a4029408f644584ca97252399f8900d 100644 (file)
@@ -1125,7 +1125,7 @@ do_open(const char *name,
                   "  server %s\n"
                   "  user %s\n"
                   "  port %d\n"
-                  "  path %s\n",
+                  "  path %s",
                   alias ? alias : name,
                   NULLSTR(ret->uri->scheme), NULLSTR(ret->uri->server),
                   NULLSTR(ret->uri->user), ret->uri->port,
index f05d4a86876c0c9b2c4567e5aab64a093403db2b..7dbf467fe8d90571f2ec43e8cc2eeba46a8b82f9 100644 (file)
@@ -1509,7 +1509,7 @@ virNWFilterDHCPSnoopThread(void *req0)
                     if (last_displayed_queue - time(0) > 10) {
                         last_displayed_queue = time(0);
                         VIR_WARN("Worker thread for interface '%s' has a "
-                                 "job queue that is too long\n",
+                                 "job queue that is too long",
                                  req->ifname);
                     }
                     continue;
@@ -2017,7 +2017,7 @@ static void
 virNWFilterSnoopJoinThreads(void)
 {
     while (virAtomicIntGet(&virNWFilterSnoopState.nThreads) != 0) {
-        VIR_WARN("Waiting for snooping threads to terminate: %u\n",
+        VIR_WARN("Waiting for snooping threads to terminate: %u",
                  virAtomicIntGet(&virNWFilterSnoopState.nThreads));
         usleep(1000 * 1000);
     }
index 701f8d825a6b95f111c3a5e2cb4f54458f682ac6..5a4cff142ef9cfe31d60b7864048e897a6db5754 100644 (file)
@@ -540,7 +540,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
             if (rc)
                 break;
         } else if (inc) {
-            VIR_DEBUG("Following filter %s\n", inc->filterref);
+            VIR_DEBUG("Following filter %s", inc->filterref);
             obj = virNWFilterObjFindByName(&driver->nwfilters, inc->filterref);
             if (obj) {
 
index 5b5505538f430bd6e31d6353ba8b3c073e654f8c..1adbadbbf888aa650f0811396c68885608594d60 100644 (file)
@@ -413,7 +413,7 @@ learnIPAddressThread(void *arg)
     handle = pcap_open_live(listen_if, BUFSIZ, 0, PKT_TIMEOUT_MS, errbuf);
 
     if (handle == NULL) {
-        VIR_DEBUG("Couldn't open device %s: %s\n", listen_if, errbuf);
+        VIR_DEBUG("Couldn't open device %s: %s", listen_if, errbuf);
         req->status = ENODEV;
         goto done;
     }
@@ -448,13 +448,13 @@ learnIPAddressThread(void *arg)
     filter = virBufferContentAndReset(&buf);
 
     if (pcap_compile(handle, &fp, filter, 1, 0) != 0) {
-        VIR_DEBUG("Couldn't compile filter '%s'.\n", filter);
+        VIR_DEBUG("Couldn't compile filter '%s'", filter);
         req->status = EINVAL;
         goto done;
     }
 
     if (pcap_setfilter(handle, &fp) != 0) {
-        VIR_DEBUG("Couldn't set filter '%s'.\n", filter);
+        VIR_DEBUG("Couldn't set filter '%s'", filter);
         req->status = EINVAL;
         pcap_freecode(&fp);
         goto done;
@@ -626,7 +626,7 @@ learnIPAddressThread(void *arg)
                                                    req->filtername,
                                                    req->filterparams);
             VIR_DEBUG("Result from applying firewall rules on "
-                      "%s with IP addr %s : %d\n", req->ifname, inetaddr, ret);
+                      "%s with IP addr %s : %d", req->ifname, inetaddr, ret);
         }
     } else {
         if (showError)
@@ -638,7 +638,7 @@ learnIPAddressThread(void *arg)
         techdriver->applyDropAllRules(req->ifname);
     }
 
-    VIR_DEBUG("pcap thread terminating for interface %s\n", req->ifname);
+    VIR_DEBUG("pcap thread terminating for interface %s", req->ifname);
 
     virNWFilterUnlockIface(req->ifname);
 
index 5e5f1ab25e739a99d770d97888564762b274242e..526d2919fb754e75bd5ac27b0a49251c755fc3db 100644 (file)
@@ -196,7 +196,7 @@ int virNetSocketCheckProtocols(bool *hasIPv4,
 
     freeaddrinfo(ai);
 
-    VIR_DEBUG("Protocols: v4 %d v6 %d\n", *hasIPv4, *hasIPv6);
+    VIR_DEBUG("Protocols: v4 %d v6 %d", *hasIPv4, *hasIPv6);
 
     ret = 0;
  cleanup:
index e5cf2c5e7c2375f7111a7908c2756851e4292474..f45e18f24666805cc1322d4c07512fb5f1da8f23 100644 (file)
@@ -681,7 +681,7 @@ static int virFileLoopDeviceOpen(char **dev_name)
     if (virFileLoopDeviceOpenLoopCtl(dev_name, &loop_fd) < 0)
         return -1;
 
-    VIR_DEBUG("Return from loop-control got fd %d\n", loop_fd);
+    VIR_DEBUG("Return from loop-control got fd %d", loop_fd);
 
     if (loop_fd >= 0)
         return loop_fd;
index bc90c449cd7d10ce7f68cfcb8c22811a34958176..fab621ba91ba38d5816c854b684004baf5351210 100644 (file)
@@ -287,7 +287,7 @@ virHashGrow(virHashTablePtr table, size_t size)
     VIR_FREE(oldtable);
 
 #ifdef DEBUG_GROW
-    VIR_DEBUG("virHashGrow : from %d to %d, %ld elems\n", oldsize,
+    VIR_DEBUG("virHashGrow : from %d to %d, %ld elems", oldsize,
               size, nbElem);
 #endif
 
index 89985b8f27131979619462e577588669222a7a72..de345e66f3c7334ed8e54ddf0326242c0ee80c88 100644 (file)
@@ -473,16 +473,16 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
     case RTM_DELLINK:
     case RTM_SETLINK:
     case RTM_GETLINK:
-        VIR_DEBUG(" IFINFOMSG\n");
-        VIR_DEBUG("        ifi_family = 0x%02x\n",
+        VIR_DEBUG(" IFINFOMSG");
+        VIR_DEBUG("        ifi_family = 0x%02x",
             ((struct ifinfomsg *)data)->ifi_family);
-        VIR_DEBUG("        ifi_type   = 0x%x\n",
+        VIR_DEBUG("        ifi_type   = 0x%x",
             ((struct ifinfomsg *)data)->ifi_type);
-        VIR_DEBUG("        ifi_index  = %i\n",
+        VIR_DEBUG("        ifi_index  = %i",
             ((struct ifinfomsg *)data)->ifi_index);
-        VIR_DEBUG("        ifi_flags  = 0x%04x\n",
+        VIR_DEBUG("        ifi_flags  = 0x%04x",
             ((struct ifinfomsg *)data)->ifi_flags);
-        VIR_DEBUG("        ifi_change = 0x%04x\n",
+        VIR_DEBUG("        ifi_change = 0x%04x",
             ((struct ifinfomsg *)data)->ifi_change);
     }
     /* DEBUG end */
@@ -544,23 +544,23 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
 
     if (tb[IFLA_IFNAME]) {
         ifname = (char *)RTA_DATA(tb[IFLA_IFNAME]);
-        VIR_DEBUG("IFLA_IFNAME = %s\n", ifname);
+        VIR_DEBUG("IFLA_IFNAME = %s", ifname);
     }
 
     if (tb[IFLA_OPERSTATE]) {
         rem = *(unsigned short *)RTA_DATA(tb[IFLA_OPERSTATE]);
-        VIR_DEBUG("IFLA_OPERSTATE = %d\n", rem);
+        VIR_DEBUG("IFLA_OPERSTATE = %d", rem);
     }
 
     if (tb[IFLA_VF_PORTS]) {
         struct nlattr *tb_vf_ports;
 
-        VIR_DEBUG("found IFLA_VF_PORTS\n");
+        VIR_DEBUG("found IFLA_VF_PORTS");
         nla_for_each_nested(tb_vf_ports, tb[IFLA_VF_PORTS], rem) {
 
-            VIR_DEBUG("iterating\n");
+            VIR_DEBUG("iterating");
             if (nla_type(tb_vf_ports) != IFLA_VF_PORT) {
-                VIR_DEBUG("not a IFLA_VF_PORT. skipping\n");
+                VIR_DEBUG("not a IFLA_VF_PORT. skipping");
                 continue;
             }
             if (nla_parse_nested(tb3, IFLA_PORT_MAX, tb_vf_ports,
@@ -600,7 +600,7 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
                 uuid = (unsigned char *)
                     RTA_DATA(tb3[IFLA_PORT_INSTANCE_UUID]);
                 instance2str(uuid, instance, sizeof(instance));
-                VIR_DEBUG("IFLA_PORT_INSTANCE_UUID = %s\n",
+                VIR_DEBUG("IFLA_PORT_INSTANCE_UUID = %s",
                           instance);
             }
 
@@ -615,7 +615,7 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
             }
 
             if (tb3[IFLA_PORT_RESPONSE]) {
-                VIR_DEBUG("IFLA_PORT_RESPONSE = %d\n", *(uint16_t *)
+                VIR_DEBUG("IFLA_PORT_RESPONSE = %d", *(uint16_t *)
                     RTA_DATA(tb3[IFLA_PORT_RESPONSE]));
             }
         }
index 43118f8903fe5ada0061d29d5a68688da8e13750..103c114b80a486a82057fe6f4442cd024fe5ffb4 100644 (file)
@@ -407,7 +407,7 @@ virProcessKillPainfully(pid_t pid, bool force)
 int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
 {
     size_t i;
-    VIR_DEBUG("Set process affinity on %lld\n", (long long)pid);
+    VIR_DEBUG("Set process affinity on %lld", (long long)pid);
 # ifdef CPU_ALLOC
     /* New method dynamically allocates cpu mask, allowing unlimted cpus */
     int numcpus = 1024;
index 62ce930293279cb8722eff72cc82baff553cc6b2..21d99e3cf6f3520bbbd1ccc5af74deb98e6c9c6d 100644 (file)
@@ -507,7 +507,7 @@ xend_op_ext(virConnectPtr xend, const char *path, const char *key, va_list ap)
         return -1;
 
     content = virBufferContentAndReset(&buf);
-    VIR_DEBUG("xend op: %s\n", content);
+    VIR_DEBUG("xend op: %s", content);
     ret = http2unix(xend_post(xend, path, content));
     VIR_FREE(content);
 
index 065b825a5558b5b54031b33eaa9ac8748d454184..faebdd4506220d89ede9ef9406f0efc9d5a0c5be 100644 (file)
@@ -169,14 +169,14 @@ testVirHostdevPreparePCIHostdevs_unmanaged(const void *oaque ATTRIBUTE_UNUSED)
     count2 = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
 
     /* Test normal functionality */
-    VIR_DEBUG("Test 0 hostdevs\n");
+    VIR_DEBUG("Test 0 hostdevs");
     if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                     NULL, 0, 0) < 0)
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
     /* Test unmanaged hostdevs */
-    VIR_DEBUG("Test >=1 unmanaged hostdevs\n");
+    VIR_DEBUG("Test >=1 unmanaged hostdevs");
     if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                     hostdevs, nhostdevs, 0) < 0)
         goto cleanup;
@@ -186,21 +186,21 @@ testVirHostdevPreparePCIHostdevs_unmanaged(const void *oaque ATTRIBUTE_UNUSED)
     /* Test conflict */
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
     count2 = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
-    VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again");
     if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                      &hostdevs[0], 1, 0))
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
     CHECK_LIST_COUNT(mgr->inactivePCIHostdevs, count2);
 
-    VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again");
     if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid,
                                      &hostdevs[1], 1, 0))
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
     CHECK_LIST_COUNT(mgr->inactivePCIHostdevs, count2);
 
-    VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again");
     if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid,
                                      &hostdevs[2], 1, 0))
         goto cleanup;
@@ -223,7 +223,7 @@ testVirHostdevReAttachPCIHostdevs_unmanaged(const void *oaque ATTRIBUTE_UNUSED)
 
     for (i = 0; i < nhostdevs; i++) {
         if (hostdevs[i]->managed != false) {
-            VIR_DEBUG("invalid test\n");
+            VIR_DEBUG("invalid test");
             return -1;
         }
     }
@@ -231,11 +231,11 @@ testVirHostdevReAttachPCIHostdevs_unmanaged(const void *oaque ATTRIBUTE_UNUSED)
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
     count2 = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
 
-    VIR_DEBUG("Test 0 hostdevs\n");
+    VIR_DEBUG("Test 0 hostdevs");
     virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0, NULL);
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test >=1 unmanaged hostdevs\n");
+    VIR_DEBUG("Test >=1 unmanaged hostdevs");
     virHostdevReAttachPCIDevices(mgr, drv_name, dom_name,
                                   hostdevs, nhostdevs, NULL);
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1 - 3);
@@ -261,7 +261,7 @@ testVirHostdevPreparePCIHostdevs_managed(const void *oaque ATTRIBUTE_UNUSED)
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
 
     /* Test normal functionality */
-    VIR_DEBUG("Test >=1 hostdevs\n");
+    VIR_DEBUG("Test >=1 hostdevs");
     if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                      hostdevs, nhostdevs, 0) < 0)
         goto cleanup;
@@ -269,19 +269,19 @@ testVirHostdevPreparePCIHostdevs_managed(const void *oaque ATTRIBUTE_UNUSED)
 
     /* Test conflict */
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
-    VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again");
     if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                       &hostdevs[0], 1, 0))
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again");
     if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid,
                                       &hostdevs[1], 1, 0))
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again");
     if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid,
                                       &hostdevs[2], 1, 0))
         goto cleanup;
@@ -303,18 +303,18 @@ testVirHostdevReAttachPCIHostdevs_managed(const void *oaque ATTRIBUTE_UNUSED)
 
     for (i = 0; i < nhostdevs; i++) {
         if (hostdevs[i]->managed != true) {
-            VIR_DEBUG("invalid test\n");
+            VIR_DEBUG("invalid test");
             return -1;
         }
     }
 
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
 
-    VIR_DEBUG("Test 0 hostdevs\n");
+    VIR_DEBUG("Test 0 hostdevs");
     virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0, NULL);
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test >=1 hostdevs\n");
+    VIR_DEBUG("Test >=1 hostdevs");
     virHostdevReAttachPCIDevices(mgr, drv_name, dom_name,
                                   hostdevs, nhostdevs, NULL);
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1 - 3);
@@ -392,13 +392,13 @@ testVirHostdevUpdateActivePCIHostdevs(const void *oaque ATTRIBUTE_UNUSED)
 
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
 
-    VIR_DEBUG("Test 0 hostdevs\n");
+    VIR_DEBUG("Test 0 hostdevs");
     if (virHostdevUpdateActivePCIDevices(mgr, NULL, 0,
                                          drv_name, dom_name) < 0)
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test >=1 hostdevs\n");
+    VIR_DEBUG("Test >=1 hostdevs");
     if (virHostdevUpdateActivePCIDevices(mgr, hostdevs, nhostdevs,
                                          drv_name, dom_name) < 0)
         goto cleanup;
@@ -432,7 +432,7 @@ mymain(void)
 
 # define DO_TEST(fnc)                                   \
     do {                                                \
-        VIR_DEBUG("\nTesting: %s", #fnc);                 \
+        VIR_DEBUG("Testing: %s", #fnc);                 \
         if (virtTestRun(#fnc, fnc, NULL) < 0)           \
             ret = -1;                                   \
     } while (0)
index ce9eeabc9e52e852f7b83a06d151007afba9ae0a..5786870a82ef292bf7d7a168f71b0e41a31cf74b 100644 (file)
@@ -105,7 +105,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
         break;
     }
 
-    VIR_DEBUG("Choose port %d\n", *freePort);
+    VIR_DEBUG("Choose port %d", *freePort);
 
     ret = 0;
 
index 9ab38aebf8b44b20c1bf06cb817eed611f03e4fe..49040d32c95c894dc0e4c6b23e5c83e060031ef5 100644 (file)
@@ -92,7 +92,7 @@ testTimeLocalOffset(const void *args)
         return -1;
 
     if (data->offset != actual) {
-        VIR_DEBUG("Expect Offset %ld got %ld\n",
+        VIR_DEBUG("Expect Offset %ld got %ld",
                   data->offset, actual);
         return -1;
     }