From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id CC4701FF15C for ; Fri, 17 Oct 2025 15:08:29 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9B03B3483; Fri, 17 Oct 2025 15:08:49 +0200 (CEST) Mime-Version: 1.0 Date: Fri, 17 Oct 2025 15:08:15 +0200 Message-Id: Cc: "pve-devel" From: "Daniel Kral" To: "Proxmox VE development discussion" X-Mailer: aerc 0.20.0 References: <20251014143946.160679-1-f.ebner@proxmox.com> <20251014143946.160679-15-f.ebner@proxmox.com> In-Reply-To: <20251014143946.160679-15-f.ebner@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1760706492022 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.015 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [helpers.pm] Subject: Re: [pve-devel] [PATCH qemu-server 14/16] introduce QSD module for qemu-storage-daemon functionality X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On Tue Oct 14, 2025 at 4:39 PM CEST, Fiona Ebner wrote: > diff --git a/src/PVE/QemuServer/Helpers.pm b/src/PVE/QemuServer/Helpers.pm > index 2c78a7b4..ab8aa389 100644 > --- a/src/PVE/QemuServer/Helpers.pm > +++ b/src/PVE/QemuServer/Helpers.pm > @@ -89,6 +89,24 @@ sub qsd_pidfile_name { > return "${var_run_tmpdir}/qsd-${vmid}.pid"; > } > > +sub qsd_fuse_export_cleanup_files { > + my ($vmid) = @_; > + > + PVE::Tools::dir_glob_foreach( > + $var_run_tmpdir, > + "qsd-${vmid}-.*.fuse", > + sub { > + my ($file) = @_; > + unlink "${var_run_tmpdir}/${file}"; This could fail if the exported fuse fs wasn't cleaned up by qsd correctly, see more below. > + }, > + ); > +} > + > +sub qsd_fuse_export_path { > + my ($vmid, $export_name) = @_; > + return "${var_run_tmpdir}/qsd-${vmid}-${export_name}.fuse"; > +} > + --- [ snip ] --- > +=head3 quit > + > + PVE::QemuServer::QSD::quit($vmid); > + > +Shut down the QEMU storage daemon associated to VM C<$vmid> and cleans up its PID file and socket. > +Waits for 60 seconds for clean shutdown, then sends SIGTERM and waits an additional 10 seconds > +before sending SIGKILL. > + > +=cut > + > +sub quit($vmid) { > + eval { PVE::QemuServer::Monitor::qsd_cmd($vmid, 'quit'); }; > + my $qmp_err = $@; > + warn "QEMU storage daemon for $vmid failed to handle 'quit' - $qmp_err" if $qmp_err; > + > + my $count = $qmp_err ? 60 : 0; # can't wait for QMP 'quit' to terminate the process if it failed > + my $pid = PVE::QemuServer::Helpers::qsd_running_locally($vmid); > + while ($pid) { > + if ($count == 60) { > + warn "QEMU storage daemon for $vmid still running with PID $pid" > + . " - terminating now with SIGTERM\n"; > + kill 15, $pid; > + } elsif ($count == 70) { > + warn "QEMU storage daemon for $vmid still running with PID $pid" > + . " - terminating now with SIGKILL\n"; > + kill 9, $pid; > + last; SIGKILL will leave the exported fuse export in an unremovable state since the qsd couldn't clean it up. I could only reproduce this by doing it manually with `kill -SIGKILL ...`, which resulted in the VM not being startable anymore. Might be worth to add an `umount /run/qemu-server/qsd-....fuse` if unlink fails or if we can stat -f that the file is still the FUSE-exported image? > + } > + > + sleep 1; > + $count++; > + $pid = PVE::QemuServer::Helpers::qsd_running_locally($vmid); > + } > + > + unlink PVE::QemuServer::Helpers::qsd_pidfile_name($vmid); > + unlink PVE::QemuServer::Helpers::qmp_socket({ vmid => $vmid, type => 'qsd' }); > + > + PVE::QemuServer::Helpers::qsd_fuse_export_cleanup_files($vmid); > + > + return; > +} > + > +1; _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel