From nobody Tue May 14 10:08:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=canonical.com ARC-Seal: i=1; a=rsa-sha256; t=1576480878; cv=none; d=zohomail.com; s=zohoarc; b=ahlb1SMCW22fNFMqZusBxj6MjAghs/ozr5dvwo1E6+0tQRKTjvMuSUAvBK+ZylLK0ubWJ6dVdty4mRVoA9ZNP1Lstx1ZuiLphUFzRszKox2MKeKExIXe9rDqcZj0fHWXKY2bIGICw0YIF49f4zelHbFVaglLCCygn+OcAYlQoVo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576480878; h=Content-Type:Content-Transfer-Encoding:Cc: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=5mpgWSppiVfXW2ur5sxCW7fSHcdgFaTFT87lJJrdYsw=; b=HSCWaSIs54DqCoTJZwb7IpJNbAPASuG/mHouxy2+2k1zf+YSQFLeC9xUslkP4iz3wP+Hj4wSNMWvDcxNfkRS+k4WOnKsxhwxk9YUTmgXXTPUVgo8rVpCWkQZJUNalVGoKaiZOhNiT1Jzlk3rA3LkSUlC8J+BVEWOOwYxGSiXv58= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 157648087855035.41007883577606; Sun, 15 Dec 2019 23:21:18 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-80-65eZ9NAENCi5V3TaAbY5EQ-1; Mon, 16 Dec 2019 02:21:14 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4F5D3DB62; Mon, 16 Dec 2019 07:21:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1DE195C28D; Mon, 16 Dec 2019 07:21:09 +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 6A94A1808855; Mon, 16 Dec 2019 07:21:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xBG7L6nE025015 for ; Mon, 16 Dec 2019 02:21:06 -0500 Received: by smtp.corp.redhat.com (Postfix) id 67B4372905; Mon, 16 Dec 2019 07:21:06 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 618BD6D9C3 for ; Mon, 16 Dec 2019 07:21:04 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CCDBE800298 for ; Mon, 16 Dec 2019 07:21:04 +0000 (UTC) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-303-kK7YwVlpMt-06jZo5K3mAw-1; Mon, 16 Dec 2019 02:21:03 -0500 Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=Keschdeichel.fritz.box) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1igkgg-0008WV-2V; Mon, 16 Dec 2019 07:21:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576480877; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=5mpgWSppiVfXW2ur5sxCW7fSHcdgFaTFT87lJJrdYsw=; b=jB5Glv82J994fO6kM37939Ffeq66n7TikVds7TSqDj1Bw8KEwRdPuY6xIhjtzoDRT/AbOw gnUNedEFWLViKgrI30vH8R1cKYt6HT7Ioxlz9HxeiP+P4YO+lSxBd13RTBFcBVocbEEW6e 1lOIvsjPIJsh5kOp6jtSiRwbIzLFtdM= From: Christian Ehrhardt To: libvir-list@redhat.com Date: Mon, 16 Dec 2019 08:20:59 +0100 Message-Id: <20191216072059.16010-2-christian.ehrhardt@canonical.com> In-Reply-To: <20191216072059.16010-1-christian.ehrhardt@canonical.com> References: <20191216072059.16010-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 X-MC-Unique: kK7YwVlpMt-06jZo5K3mAw-1 X-MC-Unique: 65eZ9NAENCi5V3TaAbY5EQ-1 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id xBG7L6nE025015 X-loop: libvir-list@redhat.com Cc: Doug Smythies , Christian Ehrhardt Subject: [libvirt] [PATCH v2 1/1] tools: do not loop in libvirt-guests test_connect 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.16 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" These days libvirt is pretty reliable and even remote connections (not the default for libvirt-guests anyway) either work or fail but are uncommon to be flaky. On the other hand users might have disabled the service and while we are After=3Dlibvirtd for ordering we are not Requiring it. Adding that or any harder dependency might break our ordering. But if people have disabled libvirt they will do a full retry loop until timeout. Lets drop the loop to be much faster if a remote is not reachable. Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1854653 Reported-by: Doug Smythies Signed-off-by: Christian Ehrhardt --- tools/libvirt-guests.sh.in | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in index 4bc6e866f0..a881f6266e 100644 --- a/tools/libvirt-guests.sh.in +++ b/tools/libvirt-guests.sh.in @@ -37,8 +37,6 @@ SHUTDOWN_TIMEOUT=3D300 PARALLEL_SHUTDOWN=3D0 START_DELAY=3D0 BYPASS_CACHE=3D0 -CONNECT_RETRIES=3D10 -RETRIES_SLEEP=3D1 SYNC_TIME=3D0 =20 test -f "$sysconfdir"/sysconfig/libvirt-guests && @@ -90,19 +88,12 @@ test_connect() { uri=3D$1 =20 - i=3D${CONNECT_RETRIES} - while [ $i -gt 0 ]; do - run_virsh "$uri" connect 2>/dev/null - if [ $? -eq 0 ]; then - return 0; - fi - sleep ${RETRIES_SLEEP} - eval_gettext "Unable to connect to libvirt currently. Retrying .. = \$i" - i=3D$(($i-1)) - done - eval_gettext "Can't connect to \$uri. Skipping." - echo - return 1 + if run_virsh "$uri" connect 2>/dev/null; then + return 0; + else + eval_gettext "Can't connect to \$uri. Skipping." + return 1 + fi } =20 # list_guests URI PERSISTENT --=20 2.24.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list