[PATCH] Add UI option for boot optional mapped usb device

moddingfox moddingfox at gmail.com
Tue Nov 26 02:51:56 CET 2024


From: Tyst Marin <moddingfox at foxtek.us>

This is intended to work with a seprately submitted patch to qemu-server which enables the behavior

Signed-off-by: Tyst Marin <moddingfox at foxtek.us>
---
 www/manager6/qemu/USBEdit.js | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/www/manager6/qemu/USBEdit.js b/www/manager6/qemu/USBEdit.js
index b372d53d..f3606ef0 100644
--- a/www/manager6/qemu/USBEdit.js
+++ b/www/manager6/qemu/USBEdit.js
@@ -62,6 +62,10 @@ Ext.define('PVE.qemu.USBInputPanel', {
 	    delete values.usb3;
 	    val += ',usb3=1';
 	}
+	if (values.bootwhenmissing) {
+	    delete values.bootwhenmissing;
+	    val += ',bootwhenmissing=1';
+	}
 	values[me.confid] = val;
 	return values;
     },
@@ -142,6 +146,15 @@ Ext.define('PVE.qemu.USBInputPanel', {
 		    reference: 'usb3',
 		    fieldLabel: gettext('Use USB3'),
 		},
+		{
+		    xtype: 'checkbox',
+		    name: 'bootwhenmissing',
+		    bind: { disabled: '{!mapped.checked}' },
+		    inputValue: true,
+		    checked: true,
+		    reference: 'bootwhenmissing',
+		    fieldLabel: gettext('Boot Missing'),
+		},
 	    ],
 	},
     ],
@@ -180,7 +193,7 @@ Ext.define('PVE.qemu.USBEdit', {
 		}
 
 		let data = PVE.Parser.parsePropertyString(response.result.data[me.confid], 'host');
-		let port, hostdevice, mapped, usb3 = false;
+		let port, hostdevice, mapped, usb3, bootwhenmissing = false;
 		let usb;
 
 		if (data.host) {
@@ -199,6 +212,7 @@ Ext.define('PVE.qemu.USBEdit', {
 		}
 
 		usb3 = data.usb3 ?? false;
+		bootwhenmissing = data.bootwhenmissing ?? false;
 
 		var values = {
 		    usb,
@@ -206,6 +220,7 @@ Ext.define('PVE.qemu.USBEdit', {
 		    port,
 		    usb3,
 		    mapped,
+		    bootwhenmissing,
 		};
 
 		ipanel.setValues(values);
-- 
2.39.5




More information about the pve-devel mailing list