ui: window/Migrate: avoid triggering another info request if already in-progress

use the node as key, so that a target switch would still trigger a
new one - else there's a slight chance that a user could get the
check out-of-sync (from another node).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-05-19 16:51:16 +02:00
parent d8d4c14b73
commit 685b52f58c

View File

@ -98,7 +98,6 @@ Ext.define('PVE.window.Migrate', {
me.lookup('proxmoxHelpButton').setHelpConfig({
onlineHelp: vm.get(view.vmtype).onlineHelp,
});
me.checkMigratePreconditions();
me.lookup('formPanel').isValid();
},
@ -190,11 +189,16 @@ Ext.define('PVE.window.Migrate', {
}
try {
if (me.fetchingNodeMigrateInfo && me.fetchingNodeMigrateInfo === vm.get('nodename')) {
return;
}
me.fetchingNodeMigrateInfo = vm.get('nodename');
let { result } = await Proxmox.Async.api2({
url: `/nodes/${vm.get('nodename')}/${vm.get('vmtype')}/${vm.get('vmid')}/migrate`,
method: 'GET',
});
migrateStats = result.data;
me.fetchingNodeMigrateInfo = false;
} catch (error) {
Ext.Msg.alert(gettext('Error'), error.htmlStatus);
return;