From nobody Mon Feb 9 20:09:41 2026 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=1661974437; cv=none; d=zohomail.com; s=zohoarc; b=n/zuSg5t0Ga6moC84noD54wNcermHuHJ1sC+jQy/ojjpTViQgXZl35WlamLE1OCl0Qxkh1uGYofqEWErBHmgpc/309TOHG2VSCSy/AMM1UNqcRP+RjfS+SQV/PZiuILmwgwGUbTomt8BRk9EDaWpXfWfQQqsjgyRGN7+1NB/PXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661974437; 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=N53T9nkyG6BC/qdsDJ+m/1Ahw3SaGzy6eDnMB5Lfwf4=; b=fhTjbrJDBNfmb7ultlLbav4lGu79p1gA3b6P5tVcNtZxTz86ialKc6SWP46xc4bxJX3tT6tZIgmO4ScgRfeagw4WxC3mNaiOVEvOsjU/oIYS3wuRTV2CoOQNp8VPkG8rNCcQTfu7Jfswg+5K/dC/fKRKrW9YcC8KmSbbTrSYnjU= 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 1661974437144907.1189299506708; Wed, 31 Aug 2022 12:33:57 -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-259-G2fLDWnMOvWdlk0hMQBb8w-1; Wed, 31 Aug 2022 15:33:52 -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 73FF38039BB; Wed, 31 Aug 2022 19:33:49 +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 591D1141512E; Wed, 31 Aug 2022 19:33:49 +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 B4E731946A62; Wed, 31 Aug 2022 19:33:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id CBC601946A40 for ; Wed, 31 Aug 2022 18:41:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B097E2166B2B; Wed, 31 Aug 2022 18:41:04 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.10.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 863FA2166B26; Wed, 31 Aug 2022 18:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661974436; 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=N53T9nkyG6BC/qdsDJ+m/1Ahw3SaGzy6eDnMB5Lfwf4=; b=WUJO8OSQhkK3Pt5QhlDO+OXpNS1NTgViAo+0hcXyhD5OgN5DO8f879cPr/DdF/Fu+4424J KIaLY2f0NGxGaH1gR339k8E2tR4HQCtCaV2n8IYJjRmhEjCop9iLSGSRACH6XXcrffa3N+ /0TLxn4nmx4ZnFLhn/mS6iL2JzuhyHU= X-MC-Unique: G2fLDWnMOvWdlk0hMQBb8w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v2 07/16] qemu: use file cache for nbdkit caps Date: Wed, 31 Aug 2022 13:40:52 -0500 Message-Id: <20220831184101.716362-8-jjongsma@redhat.com> In-Reply-To: <20220831184101.716362-1-jjongsma@redhat.com> References: <20220831184101.716362-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: , Cc: pkrempa@redhat.com 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: 1661974437721100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Switch to using the virFileCache implementation for nbdkit capabilities so that we have persistent caching and re-load capabilities whenever something changes. Signed-off-by: Jonathon Jongsma --- src/qemu/qemu_conf.h | 2 +- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_nbdkit.c | 24 ------------------------ src/qemu/qemu_nbdkit.h | 2 -- 4 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index d05c715400..414bcfb8a2 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -308,7 +308,7 @@ struct _virQEMUDriver { /* Immutable pointer, self-locking APIs */ virHashAtomic *migrationErrors; =20 - qemuNbdkitCaps *nbdkitCaps; + virFileCache *nbdkitCapsCache; }; =20 virQEMUDriverConfig *virQEMUDriverConfigNew(bool privileged, diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 943fa8621d..dce3ba1a32 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -833,7 +833,7 @@ qemuStateInitialize(bool privileged, goto error; =20 /* find whether nbdkit is available and query its capabilities */ - qemu_driver->nbdkitCaps =3D qemuQueryNbdkitCaps(); + qemu_driver->nbdkitCapsCache =3D qemuNbdkitCapsCacheNew(cfg->cacheDir); =20 /* If hugetlbfs is present, then we need to create a sub-directory wit= hin * it, since we can't assume the root mount point has permissions that diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c index ac498b948c..fc83f80f1f 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -225,30 +225,6 @@ qemuNbdkitCapsQuery(qemuNbdkitCaps *caps) } =20 =20 -qemuNbdkitCaps * -qemuQueryNbdkitCaps(void) -{ - qemuNbdkitCaps *caps =3D NULL; - g_autofree char *path =3D virFindFileInPath("nbdkit"); - - if (!path) - return NULL; - - if (!virFileIsExecutable(path)) { - virReportError(VIR_ERR_INTERNAL_ERROR, _("nbdkit '%s' is not execu= table"), - path); - return NULL; - } - - VIR_DEBUG("found nbdkit executable '%s'", path); - - caps =3D qemuNbdkitCapsNew(path); - qemuNbdkitCapsQuery(caps); - - return caps; -} - - bool qemuNbdkitCapsGet(qemuNbdkitCaps *nbdkitCaps, qemuNbdkitCapsFlags flag) diff --git a/src/qemu/qemu_nbdkit.h b/src/qemu/qemu_nbdkit.h index b65e76895b..3e34403d90 100644 --- a/src/qemu/qemu_nbdkit.h +++ b/src/qemu/qemu_nbdkit.h @@ -40,8 +40,6 @@ typedef enum { =20 VIR_ENUM_DECL(qemuNbdkitCaps); =20 -qemuNbdkitCaps* qemuQueryNbdkitCaps(void); - qemuNbdkitCaps* qemuNbdkitCapsNew(const char *path); =20 virFileCache* qemuNbdkitCapsCacheNew(const char *cachedir); --=20 2.37.1