From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 0E32C1FF0AA for ; Tue, 20 Oct 2026 14:29:42 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 867B52173A; Tue, 20 Oct 2026 14:29:02 +0200 (CEST) Message-ID: <0718819e-2793-4522-9594-35c748906791@proxmox.com> Date: Tue, 20 Oct 2026 14:28:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH qemu-server 5/5] drive: rescan drives after migrating to different storage To: Thomas Ellmenreich , pve-devel@lists.proxmox.com References: <20261019095346.175659-1-t.ellmenreich@proxmox.com> <20261019095346.175659-6-t.ellmenreich@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20261019095346.175659-6-t.ellmenreich@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1792499336210 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.351 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust 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: G3AFNQOI2LQ4LCGY4YLJKAMZLZEAJD36 X-Message-ID-Hash: G3AFNQOI2LQ4LCGY4YLJKAMZLZEAJD36 X-MailFrom: f.ebner@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: Am 19.10.26 um 11:54 AM schrieb Thomas Ellmenreich: > In some cases, migrating to a different storage can change the size of > disks due to the underlying granularity of the storage. In the case of a > storage with 64MiB granularity, this can increase a 4MiB TPM disk to > 64MiB. To avoid out of sync ui, rescan all disks of the migrated vm after > such a storage change. > > The rescan not only adjusts the disk size, but also shows all unused > disks that may not have been shown before. > This is not specific to TPM or this series and warrants more discussion, so I would suggest leaving it out. I don't think we should do a full rescan: 1. It can help to find orphaned volumes, but it would be nicer to have a proper view/panel for all orphaned volumes in the UI. 2. It will iterate all storages with images and thus migration can suddenly produce an error (not a bad one, everything is safe on the target already, but still), because of an unrelated storage with issues. If we go for this, I feel like it could be a tunnel command, that does an update for all volumes in the configuration. See also the FIXME in the beginning of phase3_cleanup() and the (git) history behind it. For remote migration, it doesn't need a special command, it could be part of the 'quit'. We could also introduce a 'quit' for intra-cluster migration and do it as part of that. Then we can add other such operations there without requiring a new command in the future. > Signed-off-by: Thomas Ellmenreich > --- > src/PVE/QemuMigrate.pm | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/src/PVE/QemuMigrate.pm b/src/PVE/QemuMigrate.pm > index 3845fb41..fe5f422a 100644 > --- a/src/PVE/QemuMigrate.pm > +++ b/src/PVE/QemuMigrate.pm > @@ -1905,6 +1905,18 @@ sub phase3_cleanup { > $self->cmd_logerr($cmd, errmsg => "failed to clear migrate lock"); > } > > + if (!$self->{opts}->{remote} && scalar(keys %{ $self->{volume_map} })) { > + my $cmd = [@{ $self->{rem_ssh} }, 'qm', 'disk', 'rescan', '--vmid', $vmid]; > + eval { > + PVE::Tools::run_command( Nit: please use PVE::Cmd::run() for new calls > + $cmd, > + outfunc => sub { }, Nit: the resulting stdout could also be logged as info for completeness > + errfunc => sub { $self->log('warn', shift) }, > + ); > + }; > + $self->log('warn', "failed to rescan disks after migration - $@") if $@; > + } > + > if ($self->{opts}->{remote} && $self->{opts}->{delete}) { > eval { PVE::QemuServer::destroy_vm($self->{storecfg}, $vmid, 1, undef, 0) }; > warn "Failed to remove source VM - $@\n" if $@;