if the hardware/driver is capable, the admin can now mark a pci device as 'live-migration-capable', which then tries enabling live migration for such devices.
mark it as experimental when configuring and in the migrate window also change 'hideComment' to 'globalEdit' and reverse the logic (so hideComment => !globalEdit) to better reflect what it does now. Signed-off-by: Dominik Csapak <d.csa...@proxmox.com> --- changes from v6: * dropped the check for 'mappedResources' since it was always true * renamed 'hideComment' to 'globalEdit' (and reversed it) -> no change in logic www/manager6/window/Migrate.js | 25 ++++++++++++++++++++----- www/manager6/window/PCIMapEdit.js | 20 ++++++++++++++++---- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/www/manager6/window/Migrate.js b/www/manager6/window/Migrate.js index 604b63e7..dba5556b 100644 --- a/www/manager6/window/Migrate.js +++ b/www/manager6/window/Migrate.js @@ -244,10 +244,10 @@ Ext.define('PVE.window.Migrate', { } let blockingResources = []; - let mappedResources = migrateStats['mapped-resources'] ?? []; + let mappedResources = migrateStats['mapped-resource-info'] ?? {}; for (const res of migrateStats.local_resources) { - if (mappedResources.indexOf(res) === -1) { + if (!mappedResources[res]) { blockingResources.push(res); } } @@ -271,14 +271,29 @@ Ext.define('PVE.window.Migrate', { } } - if (mappedResources && mappedResources.length) { - if (vm.get('running')) { + if (vm.get('running')) { + let allowed = []; + let notAllowed = []; + for (const [key, resource] of Object.entries(mappedResources)) { + if (resource['live-migration']) { + allowed.push(key); + } else { + notAllowed.push(key); + } + } + if (notAllowed.length > 0) { migration.possible = false; migration.preconditions.push({ text: Ext.String.format('Can\'t migrate running VM with mapped resources: {0}', - mappedResources.join(', ')), + notAllowed.join(', ')), severity: 'error', }); + } else if (allowed.length > 0) { + migration.preconditions.push({ + text: Ext.String.format('Live-migrating running VM with mapped resources (Experimental): {0}', + allowed.join(', ')), + severity: 'warning', + }); } } diff --git a/www/manager6/window/PCIMapEdit.js b/www/manager6/window/PCIMapEdit.js index faf58255..8b7ff826 100644 --- a/www/manager6/window/PCIMapEdit.js +++ b/www/manager6/window/PCIMapEdit.js @@ -16,7 +16,7 @@ Ext.define('PVE.window.PCIMapEditWindow', { me.isCreate = (!me.name || !me.nodename) && !me.entryOnly; me.method = me.name ? 'PUT' : 'POST'; me.hideMapping = !!me.entryOnly; - me.hideComment = me.name && !me.entryOnly; + me.globalEdit = !me.name || me.entryOnly; me.hideNodeSelector = me.nodename || me.entryOnly; me.hideNode = !me.nodename || !me.hideNodeSelector; return { @@ -241,7 +241,19 @@ Ext.define('PVE.window.PCIMapEditWindow', { name: 'mdev', cbind: { deleteEmpty: '{!isCreate}', - disabled: '{hideComment}', + disabled: '{!globalEdit}', + }, + }, + { + xtype: 'proxmoxcheckbox', + fieldLabel: gettext('Live Migration Capable'), + labelWidth: 200, + boxLabel: `<i class="fa fa-exclamation-triangle warning"></i> ${gettext('Experimental')}`, + reference: 'live-migration-capable', + name: 'live-migration-capable', + cbind: { + deleteEmpty: '{!isCreate}', + disabled: '{!globalEdit}', }, }, ], @@ -271,8 +283,8 @@ Ext.define('PVE.window.PCIMapEditWindow', { name: 'description', cbind: { deleteEmpty: '{!isCreate}', - disabled: '{hideComment}', - hidden: '{hideComment}', + disabled: '{!globalEdit}', + hidden: '{!globalEdit}', }, }, ], -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel