public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH manager] partially fix #4012: ui: migrate: mention snapshots referencing a local CD/DVD
Date: Mon, 12 Oct 2026 12:52:07 +0000	[thread overview]
Message-ID: <20261012125207.7-1-me@dualfroz.com> (raw)

When a VM has no local CD/DVD attached anymore, but one of its
snapshots still references it, the migrate window only shows:

  Cannot migrate VM with local CD/DVD

which does not tell where the CD/DVD is coming from, since it is not
visible in the current configuration of the VM.

The migration precondition API already returns the 'is_attached' and
'referenced_in_snapshot' attributes for each local disk. Use them to
mention the volume and the snapshots referencing it in that case, and
that removing these snapshots allows migration. This matches the hint
in the migration task log since qemu-server commit a4efa5f9ad2a
("partially fix #4012: migrate: mention snapshots referencing a local
ISO image"). The plain message is kept if the CD/DVD is still
attached, like in the backend.

Signed-off-by: Michal Fox <me@dualfroz.com>
---
 www/manager6/window/Migrate.js | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js
index 8cac54ea..b5067d7b 100644
--- a/www/manager6/window/Migrate.js
+++ b/www/manager6/window/Migrate.js
@@ -366,11 +366,22 @@ Ext.define('PVE.window.Migrate', {
                 migrateStats.local_disks.forEach(function (disk) {
                     if (disk.cdrom && disk.cdrom === 1) {
                         if (!disk.volid.includes('vm-' + vm.get('vmid') + '-cloudinit')) {
+                            let text = gettext('Cannot migrate VM with local CD/DVD');
+                            let snapshots = Object.keys(disk.referenced_in_snapshot ?? {}).sort();
+                            if (!disk.is_attached && snapshots.length) {
+                                text = Ext.String.format(
+                                    ngettext(
+                                        'Cannot migrate VM with local CD/DVD ({0}) referenced in snapshot {1}. Remove the snapshot to allow migration.',
+                                        'Cannot migrate VM with local CD/DVD ({0}) referenced in snapshots {1}. Remove the snapshots to allow migration.',
+                                        snapshots.length,
+                                    ),
+                                    disk.volid,
+                                    snapshots.join(', '),
+                                );
+                            }
+
                             migration.possible = false;
-                            migration.preconditions.push({
-                                text: gettext('Cannot migrate VM with local CD/DVD'),
-                                severity: 'error',
-                            });
+                            migration.preconditions.push({ text, severity: 'error' });
                         }
                     } else {
                         let size = disk.size
-- 
2.43.0




                 reply	other threads:[~2026-10-12 12:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261012125207.7-1-me@dualfroz.com \
    --to=me@dualfroz.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal