From nobody Tue May 21 02:21:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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=1659444725; cv=none; d=zohomail.com; s=zohoarc; b=iqhxLD2N7eiY63CR7uzsaD+r7yOGFiUugdKfyVnhTkzhysq8xeG49YSOi9x7Y0DTewzgr3ToTGZRCq5GUC2mnJovHw918dah+Ob/SehgIWK34oHpX3o8krW9SxmjFlpX2HfVhxFX/z1xbd+qQIi09krGSEakHf6MWLZs/tzF61A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659444725; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=XN8rprCQN00qKjbJvcIyybrNKx50utA50DfLu7xamoQ=; b=ZNh8cnU+dE58ukjp8q9GidA9W9g8Cx1Zx11Tl4lepCI02WJ+GOvq7e+lKg+ZTauE2jrphesiKRxjMNN1ku2O5V9wvKETCXprRqUyTKtdaBagcGzG/8nFytRltmAw6JhDfet3b4p+YUQW6N8FVS9RHPUBBWXcveoZ/nk5LO9hQkg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1659444725425866.8078222842475; Tue, 2 Aug 2022 05:52:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-14-OvuTxgqePSew36EaL-m_YA-1; Tue, 02 Aug 2022 08:51:55 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4F394280D211; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C64C8141510F; Tue, 2 Aug 2022 12:51:51 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9F8181946A51; Tue, 2 Aug 2022 12:51:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 741DF1946A4A for ; Tue, 2 Aug 2022 12:51:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 4940D492CA2; Tue, 2 Aug 2022 12:51:51 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id CCC6D492C3B for ; Tue, 2 Aug 2022 12:51:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659444723; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=XN8rprCQN00qKjbJvcIyybrNKx50utA50DfLu7xamoQ=; b=LSL0QuvHOLSwMcsyvkzxfP91L6k4ecmaqWRWCWZkRTWi7g3wBkTdXL6i45PuOBKXHV2RIM kEqftAE1ieugt4+W60WqLBKhyZymHnQD+gPDy7qZ3wMs9f5tvS6Q8ddMUf2Ygsm2eqfUEp HwPsMLGOU+xKUQJoRHgIqIdgi5CKWMg= X-MC-Unique: OvuTxgqePSew36EaL-m_YA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/6] qemu: process: Remove 'retry' argument from qemuConnectMonitor Date: Tue, 2 Aug 2022 14:51:43 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 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: 1659444727550100003 Content-Type: text/plain; charset="utf-8" Both callers pass 'false' as the argument via a variable which is not modified. Remove the argument and pass 'false' directly. Signed-off-by: Peter Krempa Reviewed-by: Jonathon Jongsma --- src/qemu/qemu_process.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 137dcf5cf4..42a5b3f643 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1883,7 +1883,6 @@ static int qemuConnectMonitor(virQEMUDriver *driver, virDomainObj *vm, int asyncJob, - bool retry, qemuDomainLogContext *logCtxt, bool reconnect) { @@ -1907,7 +1906,7 @@ qemuConnectMonitor(virQEMUDriver *driver, mon =3D qemuMonitorOpen(vm, priv->monConfig, - retry, + false, timeout, virEventThreadGetContext(priv->eventThread), &monitorCallbacks); @@ -2345,12 +2344,10 @@ qemuProcessWaitForMonitor(virQEMUDriver *driver, int ret =3D -1; g_autoptr(GHashTable) info =3D NULL; qemuDomainObjPrivate *priv =3D vm->privateData; - bool retry =3D false; - VIR_DEBUG("Connect monitor to vm=3D%p name=3D'%s' retry=3D%d", - vm, vm->def->name, retry); + VIR_DEBUG("Connect monitor to vm=3D%p name=3D'%s'", vm, vm->def->name); - if (qemuConnectMonitor(driver, vm, asyncJob, retry, logCtxt, false) < = 0) + if (qemuConnectMonitor(driver, vm, asyncJob, logCtxt, false) < 0) goto cleanup; /* Try to get the pty path mappings again via the monitor. This is muc= h more @@ -8877,7 +8874,6 @@ qemuProcessReconnect(void *opaque) size_t i; unsigned int stopFlags =3D 0; bool jobStarted =3D false; - bool retry =3D false; bool tryMonReconn =3D false; virIdentitySetCurrent(data->identity); @@ -8916,13 +8912,12 @@ qemuProcessReconnect(void *opaque) if (qemuDomainObjStartWorker(obj) < 0) goto error; - VIR_DEBUG("Reconnect monitor to def=3D%p name=3D'%s' retry=3D%d", - obj, obj->def->name, retry); + VIR_DEBUG("Reconnect monitor to def=3D%p name=3D'%s'", obj, obj->def->= name); tryMonReconn =3D true; /* XXX check PID liveliness & EXE path */ - if (qemuConnectMonitor(driver, obj, VIR_ASYNC_JOB_NONE, retry, NULL, t= rue) < 0) + if (qemuConnectMonitor(driver, obj, VIR_ASYNC_JOB_NONE, NULL, true) < = 0) goto error; priv->machineName =3D qemuDomainGetMachineName(obj); --=20 2.36.1 From nobody Tue May 21 02:21:32 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=1659444725; cv=none; d=zohomail.com; s=zohoarc; b=DfHlTmBFHsjqIbwWiw5JRK7QU+LHBxfOKI3aRzBMttm8IMRwC0QSs3GeI1ZhcyYXY9mzujvUrJSrgBrg6RLO8VR0GAWLm0xWdaetpcCVPBublh98yClDv+v9a64QERnMoxEYFnCRx33n5BLFcShCOA7fBPB0VhNw0fgTbzH2/bc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659444725; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=l+V5Hl4sEk3kHGt4ReKFQ/Eu+lwbR+wKm4qnCfa9SvA=; b=jnzisbYqOT6hKX+FoGK9IedQZweA2kdgyDQb8ls6g6AB5ZrUcSsfCnm+UJYGms/O5zPVbCDhT4Kd2oBYaAHoR1H6CG0dEdwbeN9jMAcoRBUcdKdPxbBFEHPT33Te0eI7fALi3xbxY+YJz46oz4IhAOaug6dYG/F9/pBp1K3Wxvw= 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 1659444725378168.4446511277223; Tue, 2 Aug 2022 05:52:05 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-60-CY_GoExeMJeW-lBR8VJAjw-1; Tue, 02 Aug 2022 08:51:56 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C8C813C025BC; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id A67F3C28139; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4894E1946A6D; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 44CA01946A52 for ; Tue, 2 Aug 2022 12:51:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 19159492CA5; Tue, 2 Aug 2022 12:51:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 93EC0492C3B for ; Tue, 2 Aug 2022 12:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659444723; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=l+V5Hl4sEk3kHGt4ReKFQ/Eu+lwbR+wKm4qnCfa9SvA=; b=ekFCNBrh4OQjm+N2NrsPZipJzzaMTtA1/9Tz1tV9oYogWnjNHvmFsY9F2QMrp49m+dxbED QETf0SQVzJ/4wHcpp4gnHmqIEkRhOkJqGxILOE3Gn6Vw7uXgb2rOt8s7l/wsrdsp7E2QHJ 5/K64TXhsDWCHQhfdN1GpfiC9H2FpfU= X-MC-Unique: CY_GoExeMJeW-lBR8VJAjw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/6] qemu: monitor: Remove 'timeout' argument from qemuMonitorOpen Date: Tue, 2 Aug 2022 14:51:44 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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: 1659444727569100004 Content-Type: text/plain; charset="utf-8" The 'timeout' argument is used by 'qemuMonitorOpenUnix' only when the 'retry' argument is true. The callers of 'qemuMonitorOpen' only pass '0' for timeout when they call it with 'retry' true and use other values when 'retry' is false and thus ignored. This means we can remove the argument and simply have it set to the default value of QEMU_DEFAULT_MONITOR_WAIT. Signed-off-by: Peter Krempa Reviewed-by: Jonathon Jongsma --- src/qemu/qemu_monitor.c | 21 +++++---------------- src/qemu/qemu_monitor.h | 3 +-- src/qemu/qemu_process.c | 10 +--------- tests/qemumonitortestutils.c | 1 - 4 files changed, 7 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 6ebdeb46f3..91e9f76944 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -223,12 +223,12 @@ qemuMonitorDispose(void *obj) g_free(mon->domainName); } +#define QEMU_DEFAULT_MONITOR_WAIT 30 static int qemuMonitorOpenUnix(const char *monitor, pid_t cpid, - bool retry, - unsigned long long timeout) + bool retry) { struct sockaddr_un addr; VIR_AUTOCLOSE monfd =3D -1; @@ -250,7 +250,7 @@ qemuMonitorOpenUnix(const char *monitor, } if (retry) { - if (virTimeBackOffStart(&timebackoff, 1, timeout * 1000) < 0) + if (virTimeBackOffStart(&timebackoff, 1, QEMU_DEFAULT_MONITOR_WAIT= * 1000) < 0) return -1; while (virTimeBackOffWait(&timebackoff)) { ret =3D connect(monfd, (struct sockaddr *)&addr, sizeof(addr)); @@ -694,20 +694,13 @@ qemuMonitorOpenInternal(virDomainObj *vm, } -#define QEMU_DEFAULT_MONITOR_WAIT 30 - /** * qemuMonitorOpen: * @vm: domain object * @config: monitor configuration - * @timeout: number of seconds to add to default timeout * @cb: monitor event handles * - * Opens the monitor for running qemu. It may happen that it - * takes some time for qemu to create the monitor socket (e.g. - * because kernel is zeroing configured hugepages), therefore we - * wait up to default + timeout seconds for the monitor to show - * up after which a failure is claimed. + * Opens the monitor for running qemu. * * Returns monitor object, NULL on error. */ @@ -715,15 +708,12 @@ qemuMonitor * qemuMonitorOpen(virDomainObj *vm, virDomainChrSourceDef *config, bool retry, - unsigned long long timeout, GMainContext *context, qemuMonitorCallbacks *cb) { VIR_AUTOCLOSE fd =3D -1; qemuMonitor *ret =3D NULL; - timeout +=3D QEMU_DEFAULT_MONITOR_WAIT; - if (config->type !=3D VIR_DOMAIN_CHR_TYPE_UNIX) { virReportError(VIR_ERR_INTERNAL_ERROR, _("unable to handle monitor type: %s"), @@ -732,8 +722,7 @@ qemuMonitorOpen(virDomainObj *vm, } virObjectUnlock(vm); - fd =3D qemuMonitorOpenUnix(config->data.nix.path, - vm->pid, retry, timeout); + fd =3D qemuMonitorOpenUnix(config->data.nix.path, vm->pid, retry); virObjectLock(vm); if (fd < 0) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index b82f198285..2ef9118b84 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -409,10 +409,9 @@ struct _qemuMonitorCallbacks { qemuMonitor *qemuMonitorOpen(virDomainObj *vm, virDomainChrSourceDef *config, bool retry, - unsigned long long timeout, GMainContext *context, qemuMonitorCallbacks *cb) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5); + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4); void qemuMonitorWatchDispose(void); bool qemuMonitorWasDisposed(void); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 42a5b3f643..1cd55fe989 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1888,7 +1888,6 @@ qemuConnectMonitor(virQEMUDriver *driver, { qemuDomainObjPrivate *priv =3D vm->privateData; qemuMonitor *mon =3D NULL; - unsigned long long timeout =3D 0; if (qemuSecuritySetDaemonSocketLabel(driver->securityManager, vm->def)= < 0) { VIR_ERROR(_("Failed to set security context for monitor for %s"), @@ -1896,18 +1895,11 @@ qemuConnectMonitor(virQEMUDriver *driver, return -1; } - /* When using hugepages, kernel zeroes them out before - * handing them over to qemu. This can be very time - * consuming. Therefore, add a second to timeout for each - * 1GiB of guest RAM. */ - timeout =3D virDomainDefGetMemoryTotal(vm->def) / (1024 * 1024); - ignore_value(virTimeMillisNow(&priv->monStart)); mon =3D qemuMonitorOpen(vm, priv->monConfig, false, - timeout, virEventThreadGetContext(priv->eventThread), &monitorCallbacks); @@ -9501,7 +9493,7 @@ qemuProcessQMPConnectMonitor(qemuProcessQMP *proc) proc->vm->pid =3D proc->pid; - if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &monConfig, true, 0, + if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &monConfig, true, virEventThreadGetContext(proc->event= Thread), &callbacks))) return -1; diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index a5d716deee..50808f1fb5 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1110,7 +1110,6 @@ qemuMonitorTestNew(virDomainXMLOption *xmlopt, if (!(test->mon =3D qemuMonitorOpen(test->vm, &src, true, - 0, virEventThreadGetContext(test->event= Thread), &qemuMonitorTestCallbacks))) goto error; --=20 2.36.1 From nobody Tue May 21 02:21:32 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=1659444721; cv=none; d=zohomail.com; s=zohoarc; b=W01bHk+Iuq1bp2P9VJtg5D/E57RcQ/QD/jbwUa2iFbsr/TpqNwNx/IlkRO5beNd2eb2ewKFXGZKH8XrK9ejbYuBpEB4F6cB0O342xHKL7Sga0dt6W25x0YDHrKkUWSltWOUEKCd0O7/J9T5Px4yjd1mGRdfMwFFw+c7bSeMTSgM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659444721; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dgeq6BRrKp/uW2v1KGLu4UnNPHsIOPb1jJkEsc6RIxs=; b=migWuhwk/Rywj6r8oLF2PqhEUpZ0p1xgsAFfxjU3DZwYGdjcaVanye/XltjgANZmFNwe23P8cGoZ0t7qB/vKgTIDq2IvF7/dVE+Wa9oeEwwVnUfFXS6s7/ww8y4Xs6mnxjzR9oTPCuytneFIQ+/OEuDT6M1hwhXNH4GLhd4PKxM= 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 1659444721937356.09162958849447; Tue, 2 Aug 2022 05:52:01 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-132-rHo9IojeORWlgNu1Am2YuQ-1; Tue, 02 Aug 2022 08:51:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 730F518A651A; Tue, 2 Aug 2022 12:51:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5EA8E94580; Tue, 2 Aug 2022 12:51:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 350211946A50; Tue, 2 Aug 2022 12:51:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 248D01946A60 for ; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id E516D492C3B; Tue, 2 Aug 2022 12:51:52 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6FE9C492CA4 for ; Tue, 2 Aug 2022 12:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659444720; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=dgeq6BRrKp/uW2v1KGLu4UnNPHsIOPb1jJkEsc6RIxs=; b=NXXByJOz0yAiqYeWS+gB40+NalD/xzouUkCTysWKcdhkGHvVpOhpevBfujPQsLFXadupAA vsW95O2BaikNGh+k+LyaPYcH2NjlqoTaedqtN9KQnoeswr8vIiwIjaJ5l88OZRjlKENE2k VaI8JpDJskEAhWx7RtNJHYaB/62OG9o= X-MC-Unique: rHo9IojeORWlgNu1Am2YuQ-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/6] qemuMonitorTestNew: Call qemuMonitorOpen with 'retry' false Date: Tue, 2 Aug 2022 14:51:45 +0200 Message-Id: <75b9b3c73c39096a871814bd017e1364859d079b.1659444625.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 1659444723322100003 Content-Type: text/plain; charset="utf-8" The 'retry' argument makes the monitor connection opening re-try the connection in case the monitor socket doesn't exist or isn't properly listening. In case of the test code this can't happen because the socket is created and made listening in 'qemuMonitorCommonTestNew' which is called prior to calling 'qemuMonitorOpen'. We can thus avoit the code which attempts retries in monitor connection. Signed-off-by: Peter Krempa Reviewed-by: Jonathon Jongsma --- tests/qemumonitortestutils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 50808f1fb5..1ea8d72711 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1109,7 +1109,7 @@ qemuMonitorTestNew(virDomainXMLOption *xmlopt, test->qapischema =3D schema; if (!(test->mon =3D qemuMonitorOpen(test->vm, &src, - true, + false, virEventThreadGetContext(test->event= Thread), &qemuMonitorTestCallbacks))) goto error; --=20 2.36.1 From nobody Tue May 21 02:21:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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=1659444730; cv=none; d=zohomail.com; s=zohoarc; b=NYMd5BELsiV9LUJ9iauVMjBuurRT6wnU4Osi//Si61exJBOfVRUFWdlHbXOH8J7G9e8MRqTeerqyKzS1NKRPzefQDS4Vkzs3nr39UwSZmomuC9rSgQdz39cTO3tOaofAzkcgf8usICf3NpHNoEjBp4RPlSvhrs2hL3sHrvmDEMo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659444730; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nJg47SJLOSrFEqv6iEKWnutAJvXqUWK8S8VE/jJUHeg=; b=fbAt0aXDRcQjaX3Wb9BvWAdygaH1zvOS7s1pTWxkRfBXxFdN3QYv7hv45IZ6I0MwuqB7M//eAwLgo4lc5q18fN0YI2SKtAP8IG5dBd2+BoR//PMXg9WfRaVlOabjlME9EMrnUOYHU0cAMLROVjN/qFynOfiZAY/tgX40qhwsdKA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1659444730711479.970498705766; Tue, 2 Aug 2022 05:52:10 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-621-4JAblxwqPtubUmzutgv96g-1; Tue, 02 Aug 2022 08:51:57 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E670518A652A; Tue, 2 Aug 2022 12:51:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id D43F4C2812B; Tue, 2 Aug 2022 12:51:54 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AA2591946A64; Tue, 2 Aug 2022 12:51:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id D5DF31946A5E for ; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id BF5EA492C3B; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 46F60492CA5 for ; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659444728; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nJg47SJLOSrFEqv6iEKWnutAJvXqUWK8S8VE/jJUHeg=; b=YjfpP6Gnsxzz61vrFxekIiEu/NTGI28bU7MUZtAlS3i1z+W9GdRewWL8J75vqGBvN0PNii rJb/+xVyBmZalU92/sr32oQKtsLg3n5vN9+wFQm1ztJriwUL7E/Ci/+3lhhLnnwmvuNx1x xQwmm/4xU4KVQx61rWbLWTEgYubCa1w= X-MC-Unique: 4JAblxwqPtubUmzutgv96g-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/6] qemuProcessQMPConnectMonitor: Connect to probing monitor with 'retry' set to false Date: Tue, 2 Aug 2022 14:51:46 +0200 Message-Id: <02253b8aa14605b2d0ed976f252c9c0c736af1b0.1659444625.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 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: 1659444731369100009 Content-Type: text/plain; charset="utf-8" In 'qemuProcessQMPLaunch' qemu is very specifically launched using it's internal '-daemonize' flag (see comment in the function) to ensure that the monitor socket is ready and opened prior to attempting the monitor connection. This means we don't have to retry the connection to the monitor in qemuMonitorOpen as the socket will be already there. Signed-off-by: Peter Krempa Reviewed-by: Jonathon Jongsma --- src/qemu/qemu_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1cd55fe989..c51d704af8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -9493,7 +9493,7 @@ qemuProcessQMPConnectMonitor(qemuProcessQMP *proc) proc->vm->pid =3D proc->pid; - if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &monConfig, true, + if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &monConfig, false, virEventThreadGetContext(proc->event= Thread), &callbacks))) return -1; --=20 2.36.1 From nobody Tue May 21 02:21:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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=1659444723; cv=none; d=zohomail.com; s=zohoarc; b=lqhUtx3z6CHgdxgeh5fT+oQsp3I2qwgU0beRy/VDeWySnsUutNe/So25Ju/LEjPmq5a5Bq33CK+98gop54K9T9VbIWCvZcLsGHR6//pmxYA1iSap+t7q8kzvD4sBsLWRhi12NHQ/SHxdNffEar0rYBZ3R3FACXLxbYBO40p8ZLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659444723; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=a2hToMWr7gbxPQo0m4eFf4y9udicCEKPngXTQlSgS3s=; b=LfAgoj88VLcIq44TRGubMA8TEVcoyCYdOkGReop6kuOEZzr3Zr3hsc91+mWjpzS5xxQyEGtUk0V1M1ZYBAV9WI3VBmA20CjGqGKr0wqpBCBkeB0e7ASi8dsyOl9HSZyS5yc3KvppJ3gswoufDg1rHg3DBFN+31m6QhcmH9nUIYY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1659444723260737.7790088070873; Tue, 2 Aug 2022 05:52:03 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-ZaO8Y6FAOxSBCyA5Cuj7lw-1; Tue, 02 Aug 2022 08:52:00 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6C100801755; Tue, 2 Aug 2022 12:51:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5A26B1121314; Tue, 2 Aug 2022 12:51:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 30BBF1946A5D; Tue, 2 Aug 2022 12:51:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 16DED1946A50 for ; Tue, 2 Aug 2022 12:51:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id D08F5492C3B; Tue, 2 Aug 2022 12:51:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25EDE492CA8 for ; Tue, 2 Aug 2022 12:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659444722; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=a2hToMWr7gbxPQo0m4eFf4y9udicCEKPngXTQlSgS3s=; b=MVsdOAGtH/xLIcR51XiWnIY1XxHSwFt6w46Xho2Edmoi2DJZ8KqYx7ejKsUZ+pxGXF1COt KWWYY27FVpxl+flHCZF8qBRzp3TwrTP9uRnIlWQsrWvGuNEIF2PKekSG3zDG1N2CHVGi8J Za+iLXiXM+e08aLjLc2NGHxkk6ThXcQ= X-MC-Unique: ZaO8Y6FAOxSBCyA5Cuj7lw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/6] qemuMonitorOpenUnix: Remove 'retry' argument Date: Tue, 2 Aug 2022 14:51:47 +0200 Message-Id: <4440517d8f3ab4f2b6c1b4e49eebaec02cc708c5.1659444625.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: 1659444725477100001 Content-Type: text/plain; charset="utf-8" All callers now pass false for 'retry' we are guaranteed to have a monitor socket present. This means that the retry code can be removed. Signed-off-by: Peter Krempa Reviewed-by: Jonathon Jongsma --- src/qemu/qemu_monitor.c | 47 ++++++------------------------------ src/qemu/qemu_monitor.h | 1 - src/qemu/qemu_process.c | 3 +-- tests/qemumonitortestutils.c | 1 - 4 files changed, 8 insertions(+), 44 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 91e9f76944..ad5e121359 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -223,16 +223,12 @@ qemuMonitorDispose(void *obj) g_free(mon->domainName); } -#define QEMU_DEFAULT_MONITOR_WAIT 30 static int -qemuMonitorOpenUnix(const char *monitor, - pid_t cpid, - bool retry) +qemuMonitorOpenUnix(const char *monitor) { struct sockaddr_un addr; VIR_AUTOCLOSE monfd =3D -1; - virTimeBackOffVar timebackoff; int ret =3D -1; if ((monfd =3D socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { @@ -249,39 +245,11 @@ qemuMonitorOpenUnix(const char *monitor, return -1; } - if (retry) { - if (virTimeBackOffStart(&timebackoff, 1, QEMU_DEFAULT_MONITOR_WAIT= * 1000) < 0) - return -1; - while (virTimeBackOffWait(&timebackoff)) { - ret =3D connect(monfd, (struct sockaddr *)&addr, sizeof(addr)); - - if (ret =3D=3D 0) - break; - - if ((errno =3D=3D ENOENT || errno =3D=3D ECONNREFUSED) && - (!cpid || virProcessKill(cpid, 0) =3D=3D 0)) { - /* ENOENT : Socket may not have shown up yet - * ECONNREFUSED : Leftover socket hasn't been removed yet = */ - continue; - } - - virReportSystemError(errno, "%s", - _("failed to connect to monitor socket")); - return -1; - } - - if (ret !=3D 0) { - virReportSystemError(errno, "%s", - _("monitor socket did not show up")); - return -1; - } - } else { - ret =3D connect(monfd, (struct sockaddr *) &addr, sizeof(addr)); - if (ret < 0) { - virReportSystemError(errno, "%s", - _("failed to connect to monitor socket")); - return -1; - } + ret =3D connect(monfd, (struct sockaddr *) &addr, sizeof(addr)); + if (ret < 0) { + virReportSystemError(errno, "%s", + _("failed to connect to monitor socket")); + return -1; } ret =3D monfd; @@ -707,7 +675,6 @@ qemuMonitorOpenInternal(virDomainObj *vm, qemuMonitor * qemuMonitorOpen(virDomainObj *vm, virDomainChrSourceDef *config, - bool retry, GMainContext *context, qemuMonitorCallbacks *cb) { @@ -722,7 +689,7 @@ qemuMonitorOpen(virDomainObj *vm, } virObjectUnlock(vm); - fd =3D qemuMonitorOpenUnix(config->data.nix.path, vm->pid, retry); + fd =3D qemuMonitorOpenUnix(config->data.nix.path); virObjectLock(vm); if (fd < 0) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 2ef9118b84..742bfd4cdc 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -408,7 +408,6 @@ struct _qemuMonitorCallbacks { qemuMonitor *qemuMonitorOpen(virDomainObj *vm, virDomainChrSourceDef *config, - bool retry, GMainContext *context, qemuMonitorCallbacks *cb) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c51d704af8..d29da63242 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1899,7 +1899,6 @@ qemuConnectMonitor(virQEMUDriver *driver, mon =3D qemuMonitorOpen(vm, priv->monConfig, - false, virEventThreadGetContext(priv->eventThread), &monitorCallbacks); @@ -9493,7 +9492,7 @@ qemuProcessQMPConnectMonitor(qemuProcessQMP *proc) proc->vm->pid =3D proc->pid; - if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &monConfig, false, + if (!(proc->mon =3D qemuMonitorOpen(proc->vm, &monConfig, virEventThreadGetContext(proc->event= Thread), &callbacks))) return -1; diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index 1ea8d72711..db0f450e40 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -1109,7 +1109,6 @@ qemuMonitorTestNew(virDomainXMLOption *xmlopt, test->qapischema =3D schema; if (!(test->mon =3D qemuMonitorOpen(test->vm, &src, - false, virEventThreadGetContext(test->event= Thread), &qemuMonitorTestCallbacks))) goto error; --=20 2.36.1 From nobody Tue May 21 02:21:32 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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=1659444727; cv=none; d=zohomail.com; s=zohoarc; b=mULs5LIxvO5TL29KF++s7avtgmuAU4YhZaYetGEsRY57A0wRrCwRXoCS1RlGXi8HLXFwPnKiiODFtn67ZEiDDeiEq5mktFc+s0WoSZ7onjM2CBy5ComSiA9qKZJb4Esd1iVi8SoJ6dHa+z/XfHxFu1fzOZN1GoMFWziob2XIGkM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659444727; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bXnBKodO8my+YEz76nLSxCCBV0/5pP0R5F2A6eAoGmA=; b=EeUEuqcw8pff3qN0vNDmYpzAJJE2G67+g4yEXTkKmZ/JYMqUkDgXs2VdUadVt8uBRhMBCT8pD12ZvM7p8CjdtumLEBmtcdliQzJ82PIgpBo2ZGIrgJEPRtavUID6EB4dTQfBih1qJAi2UBeEX+0kWLdgBRtsDL24+K83oGI0F+E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1659444727749928.0636268859162; Tue, 2 Aug 2022 05:52:07 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-501-5cZIp7sYMCu71N2YS-__Cg-1; Tue, 02 Aug 2022 08:52:03 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0E92985A586; Tue, 2 Aug 2022 12:51:58 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B71112166B2C; Tue, 2 Aug 2022 12:51:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 9C7631946A4D; Tue, 2 Aug 2022 12:51:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id C5A451946A52 for ; Tue, 2 Aug 2022 12:51:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B1BA9492CA6; Tue, 2 Aug 2022 12:51:55 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 29E01492CA2 for ; Tue, 2 Aug 2022 12:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659444726; 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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=bXnBKodO8my+YEz76nLSxCCBV0/5pP0R5F2A6eAoGmA=; b=MHZNWGqmJTANkMccQij3zBqtwPdoVPbh/Fd8W8aWek7Uuujh3b+rxHzFcDuGubSjvHyUej sqhbCSGfX6+eYqvSQ1dVPWGNxyljlOMAOV+fjZLfyOmkTWbPd8CV5ljDupOGgJBk0lS9Hn HwSfb1u/LSGmvyzdVuHP66eiSKUDu3Y= X-MC-Unique: 5cZIp7sYMCu71N2YS-__Cg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/6] qemuMonitorOpenUnix: Don't overwrite 'ret' needlessly Date: Tue, 2 Aug 2022 14:51:48 +0200 Message-Id: <3715e7d368b0f6e7009dea9039418d27bc482d3c.1659444625.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: 1659444729390100007 Content-Type: text/plain; charset="utf-8" Directly check the return value of 'connect'. Unfortunately we can't remove it as we have to undo auto-closing of the socket on success. Signed-off-by: Peter Krempa Reviewed-by: Jonathon Jongsma --- src/qemu/qemu_monitor.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index ad5e121359..0c0b07d4a5 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -245,8 +245,7 @@ qemuMonitorOpenUnix(const char *monitor) return -1; } - ret =3D connect(monfd, (struct sockaddr *) &addr, sizeof(addr)); - if (ret < 0) { + if (connect(monfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { virReportSystemError(errno, "%s", _("failed to connect to monitor socket")); return -1; --=20 2.36.1