partially fix #4012: ui: migrate: mention snapshots referencing a local CD/DVD
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>
This commit is contained in:
1 parent
0bb7be3f7f
commit
429ce91253
1 file changed
+15
-4
@@ -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
|
||||
|
||||
Reference in new issue
Block a user