From: Fiona Ebner <f.ebner@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Daniel Kral <d.kral@proxmox.com>
Cc: pve-devel <pve-devel-bounces@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH qemu-server 14/16] introduce QSD module for qemu-storage-daemon functionality
Date: Fri, 17 Oct 2025 16:46:36 +0200 [thread overview]
Message-ID: <ef06c0b0-ff4a-43ba-9d0a-e3874d1d4621@proxmox.com> (raw)
In-Reply-To: <DDKMD1O1TFDH.2TYZV8G62X1O6@proxmox.com>
Am 17.10.25 um 3:08 PM schrieb Daniel Kral:
> 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?
Good catch! Yeah, I think trying an unmount is a good approach.
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-10-17 14:46 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 14:39 [pve-devel] [PATCH-SERIES qemu/swtpm/storage/qemu-server 00/16] fix #4693: drive: allow non-raw image formats for TPM state drive Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu 01/16] d/rules: enable fuse Fiona Ebner
2025-10-17 13:09 ` Daniel Kral
2025-10-17 14:03 ` Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH swtpm 02/16] swtpm setup: file: always just clear header rather than unlinking Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH storage 03/16] common: add pve-vm-image-format standard option for VM image formats Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 04/16] tests: cfg2cmd: remove invalid mocking of qmp_cmd Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 05/16] migration: offline volumes: drop deprecated special casing for TPM state Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 06/16] qmp client: better abstract peer in preparation for qemu-storage-daemon Fiona Ebner
2025-10-17 12:38 ` Daniel Kral
2025-10-17 13:36 ` Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 07/16] monitor: qmp: precise error message by logging peer type Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 08/16] helpers: add functions for qemu-storage-daemon instances Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 09/16] monitor: qmp: allow 'qsd' peer type for qemu-storage-daemon Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 10/16] monitor: align interface of qmp_cmd() with other helpers Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 11/16] machine: include +pve version when getting installed machine version Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 12/16] blockdev: support attaching to qemu-storage-daemon Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 13/16] blockdev: attach: also return whether attached blockdev is read-only Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 14/16] introduce QSD module for qemu-storage-daemon functionality Fiona Ebner
2025-10-17 13:08 ` Daniel Kral
2025-10-17 14:46 ` Fiona Ebner [this message]
2025-10-20 8:47 ` Laurent GUERBY
2025-10-20 9:49 ` Fiona Ebner
2025-10-20 10:00 ` Fiona Ebner
2025-10-20 11:27 ` Laurent GUERBY
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 15/16] tpm: support non-raw volumes via FUSE exports for swtpm Fiona Ebner
2025-10-14 14:39 ` [pve-devel] [PATCH qemu-server 16/16] fix #4693: drive: allow non-raw image formats for TPM state drive Fiona Ebner
2025-10-17 13:17 ` [pve-devel] [PATCH-SERIES qemu/swtpm/storage/qemu-server 00/16] " Daniel Kral
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef06c0b0-ff4a-43ba-9d0a-e3874d1d4621@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=d.kral@proxmox.com \
--cc=pve-devel-bounces@lists.proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox