From nobody Wed May 15 12:09:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1642506348; cv=none; d=zohomail.com; s=zohoarc; b=OfncB20HiyshV3ZaZW8iQwBM0+CtMGxE21tfaWPle20k4wD9eNB/9Kh3j9s8IXIIVmMrrn7gES+ySEbXu/vfkuLxnqZTh4k99P4aoH2yQkC+RB2mhqfAFGoLJZWoqrbdXhatLiFb/EQILcBmzudwjH9l0pWeiQkUq2pxcDNp8NI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1642506348; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=rc+ESS560EwdGEnR8VxqkSgPEzkF6sjWOmEf4UWKRWw=; b=NTujpPi+lEBmUkWeBDjAmpQ7M+hgIDnVDSpblNwIBQuuzo7suDnIMWUo3HASmJgp6O9jvBP0irtO03TIVWTSE3QAcq+xeYiCrvcG6WNH68XWs/PXbiZrTUB6OlL5KRKmc2txrKRjULUSXD+NPuKRSd1Jvqf7/8uJhF2CrVVBplQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1642506348624655.7693701815772; Tue, 18 Jan 2022 03:45:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-636-t3jjR0nOMoCmRF3s5789kQ-1; Tue, 18 Jan 2022 06:45:42 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E211D1083F87; Tue, 18 Jan 2022 11:45:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D9A626DC4; Tue, 18 Jan 2022 11:45:27 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 695F54BB7C; Tue, 18 Jan 2022 11:45:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20IBjNkb000416 for ; Tue, 18 Jan 2022 06:45:23 -0500 Received: by smtp.corp.redhat.com (Postfix) id 660DB519A7; Tue, 18 Jan 2022 11:45:23 +0000 (UTC) Received: from maggie.redhat.com (unknown [10.43.2.56]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3E00752DE for ; Tue, 18 Jan 2022 11:44:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642506345; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=rc+ESS560EwdGEnR8VxqkSgPEzkF6sjWOmEf4UWKRWw=; b=UBnnDzRPK3FSGspK56Wzfag/5xr1BjPYoDpuUgrsuGBCVnGappmcrxJj3lSKWw98InK3rP J36VGGtWoqNQt0hSpo4xo+7hd06iHRiQlafzweRZ4Tqbn1A88QBdd3skpH7FV3X9XiUYEx X0g2h5HrjRufZqOY2/CTq57VRYlERKc= X-MC-Unique: t3jjR0nOMoCmRF3s5789kQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] Revert "report error when virProcessGetStatInfo() is unable to parse data" Date: Tue, 18 Jan 2022 12:44:51 +0100 Message-Id: <1abecf2d6df2cf5f7e8bd70bea2bdcb52625e143.1642506267.git.mprivozn@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1642506349599100001 Content-Type: text/plain; charset="utf-8" This reverts commit 938382b60ae5bd1f83b5cb09e1ce68b9a88f679a. Turns out, the commit did more harm than good. It changed semantics on some public APIs. For instance, while qemuDomainGetInfo() previously did not returned an error it does now. While the calls to virProcessGetStatInfo() is guarded with virDomainObjIsActive() it doesn't necessarily mean that QEMU's PID is still alive. QEMU might be gone but we just haven't realized it (e.g. because the eof handler thread is waiting for a job). Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2041610 Signed-off-by: Michal Privoznik Reviewed-by: Andrea Bolognani --- src/ch/ch_driver.c | 2 ++ src/qemu/qemu_driver.c | 7 ++++++- src/util/virprocess.c | 8 ++------ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index 3cbc668489..53e0872207 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -1073,6 +1073,8 @@ chDomainHelperGetVcpus(virDomainObj *vm, if (virProcessGetStatInfo(&vcpuinfo->cpuTime, &vcpuinfo->cpu, NULL, vm->pid, vcpupid) < 0) { + virReportSystemError(errno, "%s", + _("cannot get vCPU placement & pCPU = time")); return -1; } } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e150b86cef..373cd62536 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -1357,6 +1357,8 @@ qemuDomainHelperGetVcpus(virDomainObj *vm, if (virProcessGetStatInfo(&vcpuinfo->cpuTime, &vcpuinfo->cpu, NULL, vm->pid, vcpupid) < 0) { + virReportSystemError(errno, "%s", + _("cannot get vCPU placement & pCPU t= ime")); return -1; } } @@ -2517,6 +2519,8 @@ qemuDomainGetInfo(virDomainPtr dom, if (virDomainObjIsActive(vm)) { if (virProcessGetStatInfo(&(info->cpuTime), NULL, NULL, vm->pid, 0) < 0) { + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("cannot read cputime for domain")); goto cleanup; } } @@ -10524,7 +10528,8 @@ qemuDomainMemoryStatsInternal(virQEMUDriver *driver, } =20 if (virProcessGetStatInfo(NULL, NULL, &rss, vm->pid, 0) < 0) { - virResetLastError(); + virReportError(VIR_ERR_OPERATION_FAILED, "%s", + _("cannot get RSS for domain")); } else { stats[ret].tag =3D VIR_DOMAIN_MEMORY_STAT_RSS; stats[ret].val =3D rss; diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 85d8c8e747..b559a4257e 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -1784,10 +1784,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime, virStrToLong_ullp(proc_stat[VIR_PROCESS_STAT_STIME], NULL, 10, &sy= stime) < 0 || virStrToLong_l(proc_stat[VIR_PROCESS_STAT_RSS], NULL, 10, &rss) < = 0 || virStrToLong_i(proc_stat[VIR_PROCESS_STAT_PROCESSOR], NULL, 10, &c= pu) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse process status data for pid '%d/%d'= "), - (int) pid, (int) tid); - return -1; + VIR_WARN("cannot parse process status data"); } =20 /* We got jiffies @@ -1884,8 +1881,7 @@ virProcessGetStatInfo(unsigned long long *cpuTime G_G= NUC_UNUSED, pid_t pid G_GNUC_UNUSED, pid_t tid G_GNUC_UNUSED) { - virReportSystemError(ENOSYS, "%s", - _("Process statistics data is not supported on th= is platform")); + errno =3D ENOSYS; return -1; } =20 --=20 2.34.1