From nobody Tue Feb 10 00:58:04 2026 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=1666303170; cv=none; d=zohomail.com; s=zohoarc; b=XswO2Cuuzn9meO6zI2poSlmT7Jpf6TXl53lNA83FQ0AZjtVFG0q2lNnCeOU1+RfPmh1jiTxrSvR3vG/Y01cDg8008c29hL3VYQItzxP1X1rvJIjeajMZh5T30IIhUOdx1dU7C6NbzW6jqIj/9J+5pIMk7EnwxxNh6I3/WZEAtdU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666303170; 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=425IlyOXdQ9gpKDG502def87+RORjWsZ/wYn4U+jybQ=; b=R2PfPn4YyNb9E6tmR6s+7jllP5nQgytYFkcFz8cfhe9XCjVdmzVV+40FZhi5RABoNcVujI3pdjDTBpxnIbbeUeOqp7Ao1zSAdTr8U4mUN413iZRqzAZ4Xc/xkw51VcbMeuf0EE7d+xjORIhU1XQf74DnSLeqYtVzJmj82y7eGvA= 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 1666303170968913.9232384191442; Thu, 20 Oct 2022 14:59:30 -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-350-7VlEVsQoMyWMpPe-g6FbCw-1; Thu, 20 Oct 2022 17:59:27 -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 97518857020; Thu, 20 Oct 2022 21:59:20 +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 814CFC15BA5; Thu, 20 Oct 2022 21:59:20 +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 D74AF1946A46; Thu, 20 Oct 2022 21:59:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ADC571946587 for ; Thu, 20 Oct 2022 21:59:13 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A1BD74047AA; Thu, 20 Oct 2022 21:59:13 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.18.111]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 80C864047A7 for ; Thu, 20 Oct 2022 21:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666303170; 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=425IlyOXdQ9gpKDG502def87+RORjWsZ/wYn4U+jybQ=; b=PzKTl0y5f/MnlsaoGgNkJVFtxdjMdHAFKMj2dSwcfZfObG1F7IFd3Azbm+CGBq9ZzLJiq0 mYBDzvKkS1Zqf5dCZr/ILe2PEwggVJEq58SYGuhi6CQTgvxfVxtJel7D5Ktzqc1PJGllLt u/An2AmM3WQ2vAt8q/4s1Kxu2FW7UPI= X-MC-Unique: 7VlEVsQoMyWMpPe-g6FbCw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v3 03/18] qemu: expand nbdkit capabilities Date: Thu, 20 Oct 2022 16:58:54 -0500 Message-Id: <20221020215909.1751428-4-jjongsma@redhat.com> In-Reply-To: <20221020215909.1751428-1-jjongsma@redhat.com> References: <20221020215909.1751428-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 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 3.1 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: 1666303172365100006 Content-Type: text/plain; charset="utf-8"; x-default="true" In order to add caching of the nbdkit capabilities, we will need to compare against file modification times, etc. So look up this information when creating the nbdkit caps. Add a nbdkit_moddir build option to allow the builder to specify the location to look for nbdkit plugins and filters. Signed-off-by: Jonathon Jongsma Reviewed-by: Peter Krempa --- meson.build | 6 ++++++ meson_options.txt | 1 + src/qemu/qemu_nbdkit.c | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) diff --git a/meson.build b/meson.build index 93de355430..e4581e74dd 100644 --- a/meson.build +++ b/meson.build @@ -1731,6 +1731,12 @@ if not get_option('driver_qemu').disabled() qemu_dbus_daemon_path =3D '/usr/bin/dbus-daemon' endif conf.set_quoted('QEMU_DBUS_DAEMON', qemu_dbus_daemon_path) + + nbdkit_moddir =3D get_option('nbdkit_moddir') + if nbdkit_moddir =3D=3D '' + nbdkit_moddir =3D libdir / 'nbdkit' + endif + conf.set_quoted('NBDKIT_MODDIR', nbdkit_moddir) endif endif =20 diff --git a/meson_options.txt b/meson_options.txt index 861c5577d2..d5ea4376e0 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -71,6 +71,7 @@ option('driver_vbox', type: 'feature', value: 'auto', des= cription: 'VirtualBox X option('vbox_xpcomc_dir', type: 'string', value: '', description: 'Locatio= n of directory containing VirtualBox XPCOMC library') option('driver_vmware', type: 'feature', value: 'auto', description: 'VMwa= re driver') option('driver_vz', type: 'feature', value: 'auto', description: 'Virtuozz= o driver') +option('nbdkit_moddir', type: 'string', value: '', description: 'set the d= irectory where nbdkit modules are located') =20 option('secdriver_apparmor', type: 'feature', value: 'auto', description: = 'use AppArmor security driver') option('apparmor_profiles', type: 'feature', value: 'auto', description: '= install apparmor profiles') diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c index 7a7248c1ef..5de1021d89 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -41,6 +41,9 @@ =20 VIR_LOG_INIT("qemu.nbdkit"); =20 +#define NBDKIT_PLUGINDIR NBDKIT_MODDIR "/plugins" +#define NBDKIT_FILTERDIR NBDKIT_MODDIR "/filters" + VIR_ENUM_IMPL(qemuNbdkitCaps, QEMU_NBDKIT_CAPS_LAST, /* 0 */ @@ -54,6 +57,11 @@ struct _qemuNbdkitCaps { =20 char *path; char *version; + time_t ctime; + time_t libvirtCtime; + time_t pluginDirMtime; + time_t filterDirMtime; + unsigned int libvirtVersion; =20 virBitmap *flags; }; @@ -178,9 +186,41 @@ qemuNbdkitCapsNew(const char *path) } =20 =20 +static time_t +qemuNbdkitGetDirMtime(const char *moddir) +{ + struct stat st; + + if (stat(moddir, &st) < 0) { + VIR_DEBUG("Failed to stat nbdkit module directory '%s': %s", + moddir, + g_strerror(errno)); + return 0; + } + + return st.st_mtime; +} + + G_GNUC_UNUSED static void qemuNbdkitCapsQuery(qemuNbdkitCaps *caps) { + struct stat st; + + if (stat(caps->path, &st) < 0) { + VIR_DEBUG("Failed to stat nbdkit binary '%s': %s", + caps->path, + g_strerror(errno)); + caps->ctime =3D 0; + return; + } + + caps->ctime =3D st.st_ctime; + caps->filterDirMtime =3D qemuNbdkitGetDirMtime(NBDKIT_FILTERDIR); + caps->pluginDirMtime =3D qemuNbdkitGetDirMtime(NBDKIT_PLUGINDIR); + caps->libvirtCtime =3D virGetSelfLastChanged(); + caps->libvirtVersion =3D LIBVIR_VERSION_NUMBER; + qemuNbdkitCapsQueryPlugins(caps); qemuNbdkitCapsQueryFilters(caps); qemuNbdkitCapsQueryVersion(caps); --=20 2.37.3