[virt-tools-list] [vhostmd PATCH 1/3] Remove read_metrics() from the libmetrics constructor.
Jim Fehlig
jfehlig at suse.com
Fri Mar 15 17:24:04 UTC 2019
No need for the period in subject.
On 2/7/19 8:41 AM, Michael Trapp wrote:
> 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)) {
I changed this to
if (mdisk == NULL || read_mdisk(mdisk) < 0) {
and will push this patch.
Regards,
Jim
> errno = ENOMEDIUM;
> return -1;
> }
>
More information about the virt-tools-list
mailing list