From nobody Mon Feb 9 21:22:12 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=1661976606; cv=none; d=zohomail.com; s=zohoarc; b=IKom7fe/6Q3pTOmYoMOd0CZhpOhI1a5qgqnPhT4AEiQoy6rrFFUmAHMCUWsEEq4WZPUwXr+X/CL+VC/QV0pqa3XZqQF/LDPNwGVbK2SVhyjxMsVeCXRD5Yicbjhi+XjgPf4gp0Ju1M7bd/llsFeIkNwBZovKhcV3GP6MD4I4AXs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1661976606; 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=PJZOnoKBkND2y2hwFxBWOLfBNha1nxaxBSatsUzsPCM=; b=aM0Bp9hV8S3Hjo5trkdRmeD1zX5gSVv5IHRkFZCPBqhhDH/cGpOFi/J5yN+KGqycxjB9+agaUmVSl3B1Q/DMarIHhpwOIXozTo35JwLGsTdX4u0OOuX7wZ90b9g7RtC1HUR4h8QWdfnEQgIS7GNaOuWg0iWIRIzeazY3fPk4YyY= 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 1661976606227524.6936593685172; Wed, 31 Aug 2022 13:10:06 -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-50-Lqfzl0WgPWmFtQJVFu1IDA-1; Wed, 31 Aug 2022 16:10:01 -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 81DFF3804539; Wed, 31 Aug 2022 20:09:59 +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 E130A4C819; Wed, 31 Aug 2022 20:09:58 +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 BE0CF1946A45; Wed, 31 Aug 2022 20:09:58 +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 C906D1946A40 for ; Wed, 31 Aug 2022 18:41:03 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id AE6892166B2B; Wed, 31 Aug 2022 18:41:03 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.10.226]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86A152166B26; Wed, 31 Aug 2022 18:41:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661976605; 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=PJZOnoKBkND2y2hwFxBWOLfBNha1nxaxBSatsUzsPCM=; b=Vx2VwKPWftj53MH/Q17gE/BU/pJOvpcbpd4qIRjRGVm8wlau5u3xH8iAF+DbZIj+87LWoJ DGA5YFLDM85OlD+ifIux5vCu6/NutntNcOfXFQp+EK4UyF3TAhDMc4O6P3Qf1Ak2IX9UdD 2HrkCrDtnRM610DNHVxcaO7j2IvYMa8= X-MC-Unique: Lqfzl0WgPWmFtQJVFu1IDA-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v2 03/16] qemu: expand nbdkit capabilities Date: Wed, 31 Aug 2022 13:40:48 -0500 Message-Id: <20220831184101.716362-4-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.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: 1661976607885100001 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 --- meson.build | 6 ++++++ meson_options.txt | 1 + src/qemu/qemu_nbdkit.c | 39 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/meson.build b/meson.build index 0b3187ad88..2b0425f1f6 100644 --- a/meson.build +++ b/meson.build @@ -1744,6 +1744,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 5b43cdbd6b..382174bc03 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 f55f68299f..0ea1b754cd 100644 --- a/src/qemu/qemu_nbdkit.c +++ b/src/qemu/qemu_nbdkit.c @@ -42,6 +42,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 */ @@ -55,6 +58,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; }; @@ -177,9 +185,40 @@ qemuNbdkitCapsNew(const char *path) } =20 =20 +static time_t +getDirMtime(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; +} + + 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; + } else { + caps->ctime =3D st.st_ctime; + } + caps->filterDirMtime =3D getDirMtime(NBDKIT_FILTERDIR); + caps->pluginDirMtime =3D getDirMtime(NBDKIT_PLUGINDIR); + caps->libvirtCtime =3D virGetSelfLastChanged(); + caps->libvirtVersion =3D LIBVIR_VERSION_NUMBER; + qemuNbdkitCapsQueryPlugins(caps); qemuNbdkitCapsQueryFilters(caps); qemuNbdkitCapsQueryVersion(caps); --=20 2.37.1