From nobody Sun May 5 08:57:51 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=nutanix.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1641300222428725.9999354300967; Tue, 4 Jan 2022 04:43:42 -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-153-59cVVajzOmSXj_llwhvLNg-1; Tue, 04 Jan 2022 07:43:37 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5546A190B2B1; Tue, 4 Jan 2022 12:43:32 +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 2534474EAD; Tue, 4 Jan 2022 12:43:32 +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 9F7194A7C8; Tue, 4 Jan 2022 12:43:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 204ChTX9014328 for ; Tue, 4 Jan 2022 07:43:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 655341402403; Tue, 4 Jan 2022 12:43:29 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5FBF5140EBFE for ; Tue, 4 Jan 2022 12:43:29 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 431EE1064FAE for ; Tue, 4 Jan 2022 12:43:29 +0000 (UTC) Received: from mx0b-002c1b01.pphosted.com (mx0b-002c1b01.pphosted.com [148.163.155.12]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-42-_fiSFeXfNFCoVdd_eLqgMg-1; Tue, 04 Jan 2022 07:43:27 -0500 Received: from pps.filterd (m0127841.ppops.net [127.0.0.1]) by mx0b-002c1b01.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 204BlnXf016218 for ; Tue, 4 Jan 2022 04:43:27 -0800 Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2109.outbound.protection.outlook.com [104.47.58.109]) by mx0b-002c1b01.pphosted.com (PPS) with ESMTPS id 3dbyd422xd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 04 Jan 2022 04:43:26 -0800 Received: from SJ0PR02MB8564.namprd02.prod.outlook.com (2603:10b6:a03:3f6::16) by BYAPR02MB5991.namprd02.prod.outlook.com (2603:10b6:a03:118::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4844.15; Tue, 4 Jan 2022 12:43:25 +0000 Received: from SJ0PR02MB8564.namprd02.prod.outlook.com ([fe80::5916:1188:53ed:2065]) by SJ0PR02MB8564.namprd02.prod.outlook.com ([fe80::5916:1188:53ed:2065%2]) with mapi id 15.20.4844.016; Tue, 4 Jan 2022 12:43:25 +0000 X-MC-Unique: 59cVVajzOmSXj_llwhvLNg-1 X-MC-Unique: _fiSFeXfNFCoVdd_eLqgMg-1 From: Rohit Kumar To: libvir-list@redhat.com Subject: [PATCH v3] Add VM info to improve error log message for qemu monitor Date: Tue, 4 Jan 2022 04:43:11 -0800 Message-Id: <20220104124311.719228-1-rohit.kumar3@nutanix.com> X-ClientProxiedBy: SJ0PR03CA0367.namprd03.prod.outlook.com (2603:10b6:a03:3a1::12) To SJ0PR02MB8564.namprd02.prod.outlook.com (2603:10b6:a03:3f6::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3de22130-027a-4271-c66a-08d9cf7fcc77 X-MS-TrafficTypeDiagnostic: BYAPR02MB5991:EE_ X-Microsoft-Antispam-PRVS: x-proofpoint-crosstenant: true X-MS-Oob-TLC-OOBClassifiers: OLM:669 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: tpWBXQjK0NaWC8tD06tS+EQ9ZdX03WelLlzC2Gj3yh+NFkuPYBTAFrVwW9STFIv1MT7HVu8FYGvhOd4vnaWUV/eTbwqKsqlbdep3ULeenN50M2cnmOsOOxmyUcdIA5DJJjYWW76lFZm3U1DVhDlppsiUBJgphGRgf+Pc91hQ9MWzXugarl2L6O+QlntiWrAE7nKDULqYBbkSn6IQ4z2+R5LDyu6H4ydzWI6Oqu1QmgfPapWtWY2aWZe0Ga0c52TcfW27WBBc+y6bM5McndyYJfG2D21CLuWenw+yOtsA3Qqb2XXLa4qkW08FKE+OQ61VRSr/dwk52J2SIvX1MakHcbVedMFC1rUsF48Ukl9Bhf5PBQiD4YOxY8cZCFUlH7h8/c29AhIYT3/f9MEL2YTvGy0L3JhNL4fPnXrL/kkyZB9r2f+ZMidzfn61yXe/h3OvFW+Om6skXJpNZkd6Ml2aIpSHJpSPNpNlwx7VqHRIKs+3z0N0OQa8YlIYxq4iJ/xnOWPKQwnmcxa6AfsoN3RlBxiIvmkM16NDK+scBwM2Hu/tMSCaw3U31Wkuw9/NZXEKg+MtwxlXxt0YdITmPHi44TOCHpgDw0+fG4/iONrTcopoXEp85dVSIf3Z/Nz1dItnEaTKYQ6nWrk7krOlljBTfJ7l+1DhzxKA1MM8wbEIQkCGj5xKifrChVFtjcKieo9YgiRkthLfXBZX1yoKEuQUDQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR02MB8564.namprd02.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(15650500001)(107886003)(2616005)(36756003)(1076003)(6512007)(52116002)(6666004)(6486002)(26005)(83380400001)(86362001)(5660300002)(316002)(6506007)(8676002)(508600001)(8936002)(2906002)(186003)(66946007)(38100700002)(4326008)(38350700002)(66476007)(6916009)(66556008); DIR:OUT; SFP:1102 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?qgRRRQcojqhLP58t/fVGK2ldxAParzQWAc1v7GLIyucYoVepZHyyrIQV+vGS?= =?us-ascii?Q?PpMP0uTyCZIvM8g3dLG3c/49p+uxftqqCiUre9RhHjVwsEfCEt8jkHRSZ84H?= =?us-ascii?Q?xWGXuin3nXU0POqTuuL7j5zE9AaJd6CmXqiRcpPDLggMe3ue+/4a//89bo7Z?= =?us-ascii?Q?TF8/CyU58BRbNV0Qt3+m3F52PuuHAoqSR67TMuc+CqQAEZg+ts0mr5ZwxW6N?= =?us-ascii?Q?u20IQcH68Cn8/zKT09akzoITbWSEldYf8LCe4/fZhxnc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UPrxOzt11yl0UHGyMR+YGGMsWBlh37tGgFNt?= =?us-ascii?Q?ooTOHW2naKzm7xO78vHfdwPxtUTqOJMSZgjAFKv7T0rBq7Gw+VMUim+Bl9mI?= =?us-ascii?Q?6d7J8JhH8hKv/2VH695JfQWsAj6/ScUUB0DqZ6rlRuqv6E/gqbbmbIhSGKZG?= =?us-ascii?Q?+kbCMFjlZTUrt4QMLwk8dVuvKnmqlSOSdhhrFkRnky3C9wAX0dyP1Yt+nTqA?= =?us-ascii?Q?UdQH/3bY0vMqTgYkI2+uDDy36wHf+EqJI3P5/zTxeLkHyqq8DAAc/1FL3xPa?= =?us-ascii?Q?Rlno7Sq3S1dVJz3oR/5HhNq9cuaZaemE08RyaOvbwGTNHPdLasMvgbcpzXmO?= =?us-ascii?Q?O1Hvdy/1t1YkInat6y3BY79rjbruvpoUnL4pWGXWKzrh7AXuxvMAmoYhef/4?= =?us-ascii?Q?+n7bnwq5tgqbF6ASBVcREUQkaaL0HLEcSX8QaUMRKwNe46ETrXB7jfdqnbrN?= =?us-ascii?Q?WNjzVYp6Wt5Fg3LrK7Kw6TcPQ02okuPkl9boSp8F/FH9AiJ8jeD8lYamn1mg?= =?us-ascii?Q?Jdx2MlXR2jzSPwAXjhXkFAjBVQU=3D?= X-OriginatorOrg: nutanix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3de22130-027a-4271-c66a-08d9cf7fcc77 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR02MB8564.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jan 2022 12:43:24.9395 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bb047546-786f-4de1-bd75-24e5b6f79043 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: H4NFfdkXziNuHTIgaVWc/7EJJHUpCl3hg2Bs8tau1VgTvB5sVnLJmlnaAoqhZgwbNg6Gur39fvUyl869IsNAVyaY5G2j/NAzdaVL8YcIYkI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR02MB5991 X-Proofpoint-ORIG-GUID: hx2kG3uWbaoOUOiG0nsdEndh7lMV2dI7 X-Proofpoint-GUID: hx2kG3uWbaoOUOiG0nsdEndh7lMV2dI7 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205, Aquarius:18.0.790, Hydra:6.0.425, FMLib:17.11.62.513 definitions=2022-01-04_05,2022-01-04_01,2021-12-02_01 X-Proofpoint-Spam-Reason: safe X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-loop: libvir-list@redhat.com Cc: prachatos.mitra@nutanix.com, Rohit Kumar , prerna.saxena@nutanix.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.79 on 10.5.11.15 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-ZM-MESSAGEID: 1641300223288100001 Content-Type: text/plain; charset="utf-8" This change adds the domain name in the error and debug logs during monitor IO processing so that we may infer which VM experienced errors such as IO or socket hangup. This may help in debugging monitor IO errors. Signed-off-by: Rohit Kumar Reviewed-by: Ani Sinha Reviewed-by: Peter Krempa --- src/qemu/qemu_monitor.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index dda6ae9796..2b4582578a 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -80,6 +80,7 @@ struct _qemuMonitor { GSource *watch; =20 virDomainObj *vm; + char *domainName; =20 qemuMonitorCallbacks *cb; void *callbackOpaque; @@ -243,6 +244,7 @@ qemuMonitorDispose(void *obj) virCondDestroy(&mon->notify); g_free(mon->buffer); g_free(mon->balloonpath); + g_free(mon->domainName); } =20 =20 @@ -583,8 +585,8 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, =20 if (!error && !mon->goteof && cond & G_IO_ERR) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Invalid file descriptor while waiting for mo= nitor")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid file descriptor while waiting for mo= nitor (vm=3D'%s')"), mon->domainName); mon->goteof =3D true; } } @@ -609,13 +611,14 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, virResetLastError(); } else { if (virGetLastErrorCode() =3D=3D VIR_ERR_OK && !mon->goteof) - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Error while processing monitor IO")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Error while processing monitor IO (vm=3D= '%s')"), mon->domainName); virCopyLastError(&mon->lastError); virResetLastError(); } =20 - VIR_DEBUG("Error on monitor %s", NULLSTR(mon->lastError.message)); + VIR_DEBUG("Error on monitor %s mon=3D%p vm=3D%p name=3D%s", + NULLSTR(mon->lastError.message), mon, mon->vm, mon->doma= inName); /* If IO process resulted in an error & we have a message, * then wakeup that waiter */ if (mon->msg && !mon->msg->finished) { @@ -636,7 +639,8 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, /* Make sure anyone waiting wakes up now */ virCondSignal(&mon->notify); virObjectUnlock(mon); - VIR_DEBUG("Triggering EOF callback"); + VIR_DEBUG("Triggering EOF callback mon=3D%p vm=3D%p name=3D%s", + mon, mon->vm, mon->domainName); (eofNotify)(mon, vm, mon->callbackOpaque); virObjectUnref(mon); } else if (error) { @@ -646,7 +650,8 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, /* Make sure anyone waiting wakes up now */ virCondSignal(&mon->notify); virObjectUnlock(mon); - VIR_DEBUG("Triggering error callback"); + VIR_DEBUG("Triggering error callback mon=3D%p vm=3D%p name=3D%s", + mon, mon->vm, mon->domainName); (errorNotify)(mon, vm, mon->callbackOpaque); virObjectUnref(mon); } else { @@ -694,6 +699,7 @@ qemuMonitorOpenInternal(virDomainObj *vm, mon->fd =3D fd; mon->context =3D g_main_context_ref(context); mon->vm =3D virObjectRef(vm); + mon->domainName =3D g_strdup(NULLSTR(vm->def->name)); mon->waitGreeting =3D true; mon->cb =3D cb; mon->callbackOpaque =3D opaque; @@ -935,14 +941,14 @@ qemuMonitorSend(qemuMonitor *mon, =20 /* Check whether qemu quit unexpectedly */ if (mon->lastError.code !=3D VIR_ERR_OK) { - VIR_DEBUG("Attempt to send command while error is set %s", - NULLSTR(mon->lastError.message)); + VIR_DEBUG("Attempt to send command while error is set %s mon=3D%p = vm=3D%p name=3D%s", + NULLSTR(mon->lastError.message), mon, mon->vm, mon->doma= inName); virSetError(&mon->lastError); return -1; } if (mon->goteof) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("End of file from qemu monitor")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("End of file from qemu monitor (vm=3D'%s')"), mon= ->domainName); return -1; } =20 @@ -955,15 +961,15 @@ qemuMonitorSend(qemuMonitor *mon, =20 while (!mon->msg->finished) { if (virCondWait(&mon->notify, &mon->parent.lock) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to wait on monitor condition")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to wait on monitor condition (vm=3D'%= s')"), mon->domainName); goto cleanup; } } =20 if (mon->lastError.code !=3D VIR_ERR_OK) { - VIR_DEBUG("Send command resulted in error %s", - NULLSTR(mon->lastError.message)); + VIR_DEBUG("Send command resulted in error %s mon=3D%p vm=3D%p name= =3D%s", + NULLSTR(mon->lastError.message), mon, mon->vm, mon->doma= inName); virSetError(&mon->lastError); goto cleanup; } --=20 2.25.1