[pve-devel] [PATCH manager] gui: form/ControllerSelector: fix autoselection

Dominik Csapak d.csapak at proxmox.com
Wed Feb 12 10:51:59 CET 2020


changing from Ext.Array.each to a for loop and changing the return
to a 'break', resulted in exiting the wrong loop (previously the outer,
now the inner) resulting in wrongly looping through all controllers
instead of only until we found a match

using a label and labeled break, we can break the outer loop

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 www/manager6/form/ControllerSelector.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/www/manager6/form/ControllerSelector.js b/www/manager6/form/ControllerSelector.js
index 8ba46f17..89ecdf4a 100644
--- a/www/manager6/form/ControllerSelector.js
+++ b/www/manager6/form/ControllerSelector.js
@@ -54,13 +54,14 @@ Ext.define('PVE.form.ControllerSelector', {
 	    clist = me.sortByPreviousUsage(me.vmconfig, clist);
 	}
 
+clist_loop:
 	for (const controller of clist) {
 	    bussel.setValue(controller);
 	    for (let i = 0; i < PVE.Utils.diskControllerMaxIDs[controller]; i++) {
 		let confid = controller + i.toString();
 		if (!Ext.isDefined(me.vmconfig[confid])) {
 		    deviceid.setValue(i);
-		    break;
+		    break clist_loop; // we found the desired controller/id combo
 		}
 	    }
 	}
-- 
2.20.1





More information about the pve-devel mailing list