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 937FD1FF13B for ; Wed, 25 Feb 2026 11:45:00 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 44200346A0; Wed, 25 Feb 2026 11:45:55 +0100 (CET) Content-Type: text/plain; charset=UTF-8 Date: Wed, 25 Feb 2026 11:45:49 +0100 Message-Id: From: "Daniel Kral" To: "Markus Frank" , Subject: Re: [PATCH qemu-server v2 4/11] virtiofs: add live migration support Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Mailer: aerc 0.21.0-38-g7088c3642f2c-dirty References: <20260223155951.468572-1-m.frank@proxmox.com> <20260223155951.468572-5-m.frank@proxmox.com> In-Reply-To: <20260223155951.468572-5-m.frank@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1772016332672 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.025 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 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: IQXYVYNQV3DXOTMHK5IWROO3OEJVWNUE X-Message-ID-Hash: IQXYVYNQV3DXOTMHK5IWROO3OEJVWNUE X-MailFrom: d.kral@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: 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 > --- > v2: > * fixed broken file-handles migration method by adding > '--modcaps=3D+dac_read_search' to the virtiofsd command as stated in th= e > 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::virtiof= s_enabled($conf); > } > =20 > if (scalar(@blockers) && !$noerr) { > @@ -100,8 +99,17 @@ sub check_local_resources { > } > if ($k =3D~ m/^virtiofs/) { > my $entry =3D parse_property_string('pve-qm-virtiofs', $conf= ->{$k}); > - $add_missing_mapping->('dir', $k, $entry->{dirid}); > - $mapped_res->{$k} =3D { name =3D> $entry->{dirid} }; > + if (my $dirid =3D $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 =3D { name =3D> $dirid }; > + $mapped_res->{$k} =3D $mapped_device; > + > + if ($dir_map->{ids}->{$dirid}->{'live-migration-method'}= ) { > + $mapped_device->{'live-migration'} =3D 1; > + # don't add mapped device with live migration as blo= cker > + next; > + } > + } > } > # sockets are safe: they will recreated be on the target side po= st-migrate > next if $k =3D~ 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 { > =20 > my $dir_cfg =3D PVE::Mapping::Dir::find_on_current_node($virtiofs->{= dirid}); > =20 > + my $dirid =3D $virtiofs->{dirid}; > + my $dir_properties =3D PVE::Mapping::Dir::config()->{ids}->{$dirid}; > + > my $virtiofsd_bin =3D '/usr/libexec/virtiofsd'; > if (!-f $virtiofsd_bin) { > die "virtiofsd is not installed. To use virtio-fs, install virti= ofsd via apt.\n"; > @@ -201,6 +204,21 @@ sub start_virtiofsd { > push @$cmd, '--readonly' if $virtiofs->{readonly}; > push @$cmd, '--cache=3D' . $virtiofs->{cache} if $virtiofs->= {cache}; > push @$cmd, '--inode-file-handles=3Dprefer' if $prefer_inode= _fh; > + > + if (my $method =3D $dir_properties->{'live-migration-method'= }) { > + # migration-on-error=3Dabort would result in a stopped V= M on the target node > + push @$cmd, '--migration-on-error=3Dguest-error'; > + if ($method eq 'find-paths') { > + push @$cmd, '--migration-mode=3Dfind-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=3Dfile-handles'; > + push @$cmd, '--modcaps=3D+dac_read_search'; > + } > + } > + > push @$cmd, '--syslog'; > exec(@$cmd); > } elsif (!defined($pid2)) {