[vhostmd PATCH 1/3] Remove read_metrics() from the libmetrics constructor.

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

 



The metrics disk can be opened with the first get_metrics() request.

---
This implements option 1 from the previously discussed solutions for
the change of the libmetrics constructor.
The virtio transport does not fill the mdisk struct and get_metric()
will not provide any result, as it's already the case for the
xenstore transport.

 libmetrics/libmetrics.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/libmetrics/libmetrics.c b/libmetrics/libmetrics.c
index 36c7f5f..14da343 100644
--- a/libmetrics/libmetrics.c
+++ b/libmetrics/libmetrics.c
@@ -422,6 +422,9 @@ retry:
 error:
    if (dir)
        closedir(dir);
+
+   libmsg("%s(): Unable to read metrics disk\n", __func__);
+
    return -1;
 }
 
@@ -641,10 +644,7 @@ void __attribute__ ((constructor)) libmetrics_init(void)
    if (mdisk_alloc() == NULL) 
       goto error;
 
-   if (read_mdisk(mdisk) != 0) {
-      libmsg("%s(): Unable to read metrics disk\n", __func__);
-      goto error;
-   }
+   mdisk->sum = 0;
    return;
 
 error:
@@ -664,7 +664,7 @@ int dump_metrics(const char *dest_file)
 {
     FILE *fp;
 
-    if (mdisk == NULL) {
+    if (mdisk == NULL || read_mdisk(mdisk)) {
         errno = ENOMEDIUM;
         return -1;
     }
-- 
2.17.2 (Apple Git-113)

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux