From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 404CB1FF0AF for ; Fri, 06 Nov 2026 01:49:56 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 81D79215AE; Fri, 06 Nov 2026 01:49:44 +0100 (CET) From: Thomas Lamprecht To: pve-devel@lists.proxmox.com Subject: [PATCH v3 storage 04/76] storage: distinguish status-only activation in plugins Date: Fri, 6 Nov 2026 00:30:39 +0100 Message-ID: <20261105233336.2178064-5-t.lamprecht@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261105233336.2178064-1-t.lamprecht@proxmox.com> References: <20261105233336.2178064-1-t.lamprecht@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1793926177468 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.345 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) KAM_SHORT 0.001 Use of a URL Shortener for very short URL RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: XO6PS3TIAW4CU5G3YGIE3RWA3FX2XFIN X-Message-ID-Hash: XO6PS3TIAW4CU5G3YGIE3RWA3FX2XFIN X-MailFrom: t.lamprecht@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: pvestatd, the storage index API, and 'pvesm status' activate enabled storages to collect status. Plugins cannot distinguish this from activation for actual use, such as starting a guest. Waiting for a missing device can therefore stall every status pass, while skipping the wait can make guest startup fail immediately after boot. Mark status-only activation in the cache and pass it to check_connection() too, so plugins can choose whether to wait. Plugins that ignore the new information are unaffected. Bump APIVER and APIAGE for the plugin API extension. Signed-off-by: Thomas Lamprecht --- ApiChangeLog | 24 ++++++++++++++++++++++++ src/PVE/Storage.pm | 9 +++++---- src/PVE/Storage/Plugin.pm | 2 +- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/ApiChangeLog b/ApiChangeLog index e9fbcabe..83dda939 100644 --- a/ApiChangeLog +++ b/ApiChangeLog @@ -6,6 +6,30 @@ without breaking anything unaware of it.) Future changes should be documented in here. +## Version 17: + +* Pass the activation cache to the `check_connection()` plugin method + + Old signature of `check_connection()`: + + sub($plugin, $storeid, $scfg) + + New signature of `check_connection()`: + + sub($plugin, $storeid, $scfg, $cache) + + It is the cache of the activation that calls it, the same one the following + `activate_storage()` call gets. Plugins that do not need it can ignore the additional parameter. + +* Add the `status_only` flag to the activation cache + + `PVE::Storage::storage_info()`, which collects the status of the storages for pvestatd, the + storage index API and `pvesm status`, sets `$cache->{status_only}` in the cache it activates the + storages with. Plugins can check it in `check_connection()` and `activate_storage()` to skip + waiting for what only a use of the storage needs, for example a device that is still appearing, + so a storage that cannot get ready does not stall the status updates of the node. Plugins that + do not check it are not affected. + ## Version 16: * Add `volname_for_format()`, `get_parsed_format()`, `volname_with_format()`, `is_valid_format()` and diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index d660cfc4..891d1885 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -41,11 +41,11 @@ use PVE::Storage::BTRFSPlugin; use PVE::Storage::ESXiPlugin; # Storage API version. Increment it on changes in storage API interface. -use constant APIVER => 16; +use constant APIVER => 17; # Age is the number of versions we're backward compatible with. # This is like having 'current=APIVER' and age='APIAGE' in libtool, # see https://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html -use constant APIAGE => 7; +use constant APIAGE => 8; our $KNOWN_EXPORT_FORMATS = ['raw+size', 'tar+size', 'qcow2+size', 'vmdk+size', 'zfs', 'btrfs']; @@ -1356,7 +1356,7 @@ sub activate_storage { activate_storage($cfg, $baseid, $cache); } - if (!eval { $plugin->check_connection($storeid, $scfg) }) { + if (!eval { $plugin->check_connection($storeid, $scfg, $cache) }) { die "connection check for storage '$storeid' failed - $@\n" if $@; die "storage '$storeid' is not online\n"; } @@ -1485,7 +1485,8 @@ sub storage_info { push @$slist, $storeid; } - my $cache = {}; + # Status-only activation must not wait for resources needed only when using a storage. + my $cache = { status_only => 1 }; foreach my $storeid (keys %$ids) { my $scfg = $ids->{$storeid}; diff --git a/src/PVE/Storage/Plugin.pm b/src/PVE/Storage/Plugin.pm index 3d07f749..bec8ae7a 100644 --- a/src/PVE/Storage/Plugin.pm +++ b/src/PVE/Storage/Plugin.pm @@ -2169,7 +2169,7 @@ sub deactivate_volume { } sub check_connection { - my ($class, $storeid, $scfg) = @_; + my ($class, $storeid, $scfg, $cache) = @_; # do nothing by default return 1; } -- 2.47.3