From nobody Fri Apr 19 02:37:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1575363398; cv=none; d=zohomail.com; s=zohoarc; b=IXl+/GebBDBuxukGPeTd6qJz1hLbbQeLoOh4OQl+3g5Jhseczldbfgj3FMReNHmasbpSIFqWE3zVmOzeRdyr/QTeFCQFDgSAaRCVmnm+Rm6Vjpyl2FsEepH+nQoIrUWJ2vCyBfBn5flmxpYHZCMPfVzWMDf78RoLToxU1TTL62Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575363398; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=2UD63rZsqvvO8jG4S3d7ScrylrzpxqndpJiqDT+Cmb8=; b=GnSyaq1EcPmxITs3elkCLchOai7ba/cjt8j/OdXehRmuxjnBikVjo7as1QnVcUhaScWG6R4OMPVNUs8iEF3ZKwgSrX84SjC+1957WPufZwMwMDmMG1gL9QACaBuci5VIAl6m+cGzu79dZAmwH7hB/Qs+qi1G2By7p0nKKT2vABw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1575363398269741.7697583940452; Tue, 3 Dec 2019 00:56:38 -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-61-ikTryxzONj6S_lYP0YJmdg-1; Tue, 03 Dec 2019 03:56:35 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 30AF41803693; Tue, 3 Dec 2019 08:56:30 +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 B19B71001281; Tue, 3 Dec 2019 08:56:29 +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 6685818089CF; Tue, 3 Dec 2019 08:56:29 +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 xB38uSVi032218 for ; Tue, 3 Dec 2019 03:56:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 75D2BF77DB; Tue, 3 Dec 2019 08:56:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 71DE6F77D7 for ; Tue, 3 Dec 2019 08:56:26 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.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 4E0161859165 for ; Tue, 3 Dec 2019 08:56:26 +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-259-iYKojLZqMASQdUyv333ayg-1; Tue, 03 Dec 2019 03:56:19 -0500 Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ic3yj-00018u-Gw; Tue, 03 Dec 2019 08:56:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575363397; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=2UD63rZsqvvO8jG4S3d7ScrylrzpxqndpJiqDT+Cmb8=; b=fq7mtYfv/GJomIsDUIZc87shEId2lKgFY2SZJWBwnBy9Yb4QG1wqlOFmYBPJej3cbdbdlf A78/xHVJxWNQABuzDc04RouXhttpk1JjS/WX9ZJ6U08U/UdAvPTO/pomRVnFKtbYsZnd8g SPS0k7cNtlxcxDQa4iftXe3RzL4cmtM= From: Christian Ehrhardt To: libvir-list@redhat.com Date: Tue, 3 Dec 2019 09:56:15 +0100 Message-Id: <20191203085615.4016-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 X-MC-Unique: iYKojLZqMASQdUyv333ayg-1 X-MC-Unique: ikTryxzONj6S_lYP0YJmdg-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 xB38uSVi032218 X-loop: libvir-list@redhat.com Cc: Doug Smythies , Christian Ehrhardt Subject: [libvirt] [PATCH] tools: skip libvirt-guests fast if libvirtd is not active 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.22 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The most common operation of libvirt-guests is to manage the local libvirtd. But users might have disabled that and while we are After=3Dlibvirtd for ordering we are not Requiring it.. OTOH adding that or any harder dependency might affect our ordering. But if people have disabled libvirt they will do a full retry loop until timeout. Lets check if the local service is active at all and skip fast if it is not. Fixes: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1854653 Reported-by: Doug Smythies Signed-off-by: Christian Ehrhardt Tested-by: Doug Smythies --- tools/libvirt-guests.sh.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/libvirt-guests.sh.in b/tools/libvirt-guests.sh.in index 4bc6e866f0..5a9930ee2f 100644 --- a/tools/libvirt-guests.sh.in +++ b/tools/libvirt-guests.sh.in @@ -90,6 +90,14 @@ test_connect() { uri=3D$1 =20 + if [ "x$uri" =3D xdefault ]; then + # Default config is most common and for the local libvirtd + # Check if it is active before wasting time in connect loop + if ! systemctl -q is-active libvirtd; then + return 1 + fi + fi + i=3D${CONNECT_RETRIES} while [ $i -gt 0 ]; do run_virsh "$uri" connect 2>/dev/null --=20 2.24.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list