public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] fix #7229: refresh pmxcfs infos between guest bulk actions
@ 2026-01-16 10:44 Fabian Grünbichler
  0 siblings, 0 replies; only message in thread
From: Fabian Grünbichler @ 2026-01-16 10:44 UTC (permalink / raw)
  To: pve-devel

lifecycle changes in guests can trigger hookscript invocations which
in turn might affect configuration files like storage.cfg. since the
bulk action endpoints invoke API handlers directly, any cfs-registered
config files accessed by those handlers before forking off the task
worker are cached for the whole duration of the bulk endpoint
execution, which usually spans multiple guests. to allow potential
changes made by the hookscript invocation of guest A to be visible
when executing the bulk action for a (later) guest B, a call to
cfs_update needs to be made to invalidate the cache (if needed).

the originally reported issue was a bulk start via pve-guests.service,
with one VM providing a storage combined with a hookscript that
enables/disables the storage entry on start/stop of the VM. without
this fix, the storage entry is still visible as disabled for
subsequent guest starts in the same startall invocation, despite
storage.cfg being updated by the hookscript to reflect that the
storage is in fact available after the VM in question has been
started. the same issue exists for the other bulk actions (stop,
suspend, migrate) as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 PVE/API2/Nodes.pm | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 6a6465b6b..5bd6fe492 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -2126,6 +2126,7 @@ __PACKAGE__->register_method({
                     my $d = $vmlist->{$vmid};
 
                     PVE::Cluster::check_cfs_quorum(); # abort when we loose quorum
+                    PVE::Cluster::cfs_update(); # ensure modifications by hookscripts are visible
 
                     eval {
                         my $default_delay = 0;
@@ -2296,6 +2297,9 @@ __PACKAGE__->register_method({
                 };
 
                 for my $vmid (sort { $b <=> $a } keys %$vmlist) {
+
+                    PVE::Cluster::cfs_update(); # ensure modifications by hookscripts are visible
+
                     my $d = $vmlist->{$vmid};
                     my $timeout = int($d->{down} // $param->{timeout} // 180);
                     my $upid = eval {
@@ -2431,6 +2435,8 @@ __PACKAGE__->register_method({
                 };
 
                 for my $vmid (sort { $b <=> $a } keys %$vmlist) {
+                    PVE::Cluster::cfs_update(); # ensure modifications by hookscripts are visible
+
                     my $d = $vmlist->{$vmid};
                     if ($d->{type} ne 'qemu') {
                         log_warn("skipping $vmid, only VMs can be suspended");
@@ -2636,6 +2642,8 @@ __PACKAGE__->register_method({
             my $workers = {};
             my $workers_started = 0;
             foreach my $vmid (sort keys %$vmlist) {
+                PVE::Cluster::cfs_update(); # ensure modifications by hookscripts are visible
+
                 my $d = $vmlist->{$vmid};
                 my $pid;
                 eval {
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-01-16 10:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-16 10:44 [pve-devel] [PATCH manager] fix #7229: refresh pmxcfs infos between guest bulk actions Fabian Grünbichler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal