From: "Daniel Kral" <d.kral@proxmox.com>
To: "Markus Frank" <m.frank@proxmox.com>, <pve-devel@lists.proxmox.com>
Subject: Re: [PATCH qemu-server v2 4/11] virtiofs: add live migration support
Date: Wed, 25 Feb 2026 11:45:49 +0100 [thread overview]
Message-ID: <DGNZDCPL1DJM.1GCM15DLGNQP7@proxmox.com> (raw)
In-Reply-To: <20260223155951.468572-5-m.frank@proxmox.com>
On Mon Feb 23, 2026 at 4:40 PM CET, Markus Frank wrote:
> There are two migration methods with virtiofsd.
>
> Virtiofsd in the 'find-paths' migration mode, tries to find the path
> inside of the shared directory for every filesystem object that must be
> transferred to the destination.
> Add two extra parameters that verify file handles and confirm paths.
>
> In the 'file-handles' migration mode every filesystem object is
> converted to a file handle. This migration mode requires the
> DAC_READ_SEARCH capability.
>
> Add a parameter so that migration does not abort if an error occurs.
> Aborting on error would result in a stopped VM on the destination node.
>
> Signed-off-by: Markus Frank <m.frank@proxmox.com>
> ---
> v2:
> * fixed broken file-handles migration method by adding
> '--modcaps=+dac_read_search' to the virtiofsd command as stated in the
> virtiofsd documentation
>
> src/PVE/QemuMigrate/Helpers.pm | 14 +++++++++++---
> src/PVE/QemuServer/Virtiofs.pm | 18 ++++++++++++++++++
> 2 files changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/src/PVE/QemuMigrate/Helpers.pm b/src/PVE/QemuMigrate/Helpers.pm
> index 466517da..9b577704 100644
> --- a/src/PVE/QemuMigrate/Helpers.pm
> +++ b/src/PVE/QemuMigrate/Helpers.pm
> @@ -21,7 +21,6 @@ sub check_non_migratable_resources {
> if ($state) {
> push @blockers, "amd-sev" if $conf->{"amd-sev"};
> push @blockers, "intel-tdx" if $conf->{"intel-tdx"};
> - push @blockers, "virtiofs" if PVE::QemuServer::Virtiofs::virtiofs_enabled($conf);
> }
>
> if (scalar(@blockers) && !$noerr) {
> @@ -100,8 +99,17 @@ sub check_local_resources {
> }
> if ($k =~ m/^virtiofs/) {
> my $entry = parse_property_string('pve-qm-virtiofs', $conf->{$k});
> - $add_missing_mapping->('dir', $k, $entry->{dirid});
> - $mapped_res->{$k} = { name => $entry->{dirid} };
> + if (my $dirid = $entry->{dirid}) {
Seems like the if (...) is unnecessary here as dirfd is a default key
and not optional?
> + $add_missing_mapping->('dir', $k, $dirid);
> + my $mapped_device = { name => $dirid };
> + $mapped_res->{$k} = $mapped_device;
> +
> + if ($dir_map->{ids}->{$dirid}->{'live-migration-method'}) {
> + $mapped_device->{'live-migration'} = 1;
> + # don't add mapped device with live migration as blocker
> + next;
> + }
> + }
> }
> # sockets are safe: they will recreated be on the target side post-migrate
> next if $k =~ m/^serial/ && ($conf->{$k} eq 'socket');
> diff --git a/src/PVE/QemuServer/Virtiofs.pm b/src/PVE/QemuServer/Virtiofs.pm
> index db4b9c78..1a3db50b 100644
> --- a/src/PVE/QemuServer/Virtiofs.pm
> +++ b/src/PVE/QemuServer/Virtiofs.pm
> @@ -177,6 +177,9 @@ sub start_virtiofsd {
>
> my $dir_cfg = PVE::Mapping::Dir::find_on_current_node($virtiofs->{dirid});
>
> + my $dirid = $virtiofs->{dirid};
> + my $dir_properties = PVE::Mapping::Dir::config()->{ids}->{$dirid};
> +
> my $virtiofsd_bin = '/usr/libexec/virtiofsd';
> if (!-f $virtiofsd_bin) {
> die "virtiofsd is not installed. To use virtio-fs, install virtiofsd via apt.\n";
> @@ -201,6 +204,21 @@ sub start_virtiofsd {
> push @$cmd, '--readonly' if $virtiofs->{readonly};
> push @$cmd, '--cache=' . $virtiofs->{cache} if $virtiofs->{cache};
> push @$cmd, '--inode-file-handles=prefer' if $prefer_inode_fh;
> +
> + if (my $method = $dir_properties->{'live-migration-method'}) {
> + # migration-on-error=abort would result in a stopped VM on the target node
> + push @$cmd, '--migration-on-error=guest-error';
> + if ($method eq 'find-paths') {
> + push @$cmd, '--migration-mode=find-paths';
> + push @$cmd, '--migration-verify-handles';
> + push @$cmd, '--migration-confirm-paths';
> + }
> + if ($method eq 'file-handles') {
nit: Since $method can only be one value, an elsif would be more
readable here
> + push @$cmd, '--migration-mode=file-handles';
> + push @$cmd, '--modcaps=+dac_read_search';
> + }
> + }
> +
> push @$cmd, '--syslog';
> exec(@$cmd);
> } elsif (!defined($pid2)) {
next prev parent reply other threads:[~2026-02-25 10:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-23 15:39 [PATCH guest-common/qemu-server/docs/manager v2 0/11] Virtiofs improvements Markus Frank
2026-02-23 15:39 ` [PATCH guest-common v2 1/11] mapping: dir: add 'live-migration-method' parameter Markus Frank
2026-02-25 10:42 ` Daniel Kral
2026-02-23 15:39 ` [PATCH qemu-server v2 2/11] fix #6370: virtiofs: add support for thread-pool-size option Markus Frank
2026-02-25 10:46 ` Daniel Kral
2026-02-23 15:40 ` [PATCH qemu-server v2 3/11] virtiofs: add readonly option Markus Frank
2026-02-23 15:40 ` [PATCH qemu-server v2 4/11] virtiofs: add live migration support Markus Frank
2026-02-25 10:45 ` Daniel Kral [this message]
2026-02-23 15:40 ` [PATCH docs v2 5/11] virtiofs: add explanation for cache=metadata behavior Markus Frank
2026-02-23 15:40 ` [PATCH docs v2 6/11] virtiofs: add table for optional parameters Markus Frank
2026-02-23 15:40 ` [PATCH docs v2 7/11] virtiofs: add thread-pool-size description Markus Frank
2026-02-25 10:46 ` Daniel Kral
2026-02-23 15:40 ` [PATCH docs v2 8/11] virtiofs: add documentation for live migration Markus Frank
2026-02-23 15:40 ` [PATCH manager v2 09/11] fix #6370: ui: virtiofs edit: add support for thread-pool-size option Markus Frank
2026-02-25 10:46 ` Daniel Kral
2026-02-23 15:40 ` [PATCH manager v2 10/11] virtiofs edit: add support for readonly option Markus Frank
2026-02-23 15:40 ` [PATCH manager v2 11/11] directory mapping: add live-migration-method option for virtiofs Markus Frank
2026-02-25 10:46 ` 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=DGNZDCPL1DJM.1GCM15DLGNQP7@proxmox.com \
--to=d.kral@proxmox.com \
--cc=m.frank@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