From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [45.144.208.40]) by lore.proxmox.com (Postfix) with ESMTPS id 7F40B1FF0B3 for ; Wed, 11 Nov 2026 17:22:45 +0100 (CET) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 2B2162164C; Wed, 11 Nov 2026 17:22:43 +0100 (CET) Message-ID: Date: Wed, 11 Nov 2026 17:22:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: David Riley Subject: Re: [PATCH pve-manager v2 8/8] ui: qemu: options: add editor for reboot behavior To: Jakob Klocker , pve-devel@lists.proxmox.com References: <20261022125111.236538-1-j.klocker@proxmox.com> <20261022125111.236538-9-j.klocker@proxmox.com> Content-Language: en-US In-Reply-To: <20261022125111.236538-9-j.klocker@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1794414159815 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.613 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: HIBBOBI3YEC2GMP7H2CSBA7X46UILQU5 X-Message-ID-Hash: HIBBOBI3YEC2GMP7H2CSBA7X46UILQU5 X-MailFrom: d.riley@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: see comments inline. On 10/22/26 2:52 PM, Jakob Klocker wrote: > The `reboot` option is now a property string with an added `powercycle` > sub-property, so expose both in the VM options panel: one checkbox to > allow reboots at all, and one to stop and start the VM on a > guest-initated reboot instead of resetting it in place, which makes typo: -initated/-initiated > pending changes take effect. > > Signed-off-by: Jakob Klocker > --- > www/manager6/Makefile | 1 + > www/manager6/Utils.js | 17 +++++++ > www/manager6/form/RebootFeatureSelector.js | 59 ++++++++++++++++++++++ > www/manager6/qemu/Options.js | 14 +++++ > 4 files changed, 91 insertions(+) > create mode 100644 www/manager6/form/RebootFeatureSelector.js nit: I feel like 'Feature' does not add anything here to what this actually is, might be better to just call it 'RebootBehaviorSelector' matching the naming scheme used in the docs and actual UI elements. > diff --git a/www/manager6/Makefile b/www/manager6/Makefile > index d2ea786b..1fd7a27a 100644 > --- a/www/manager6/Makefile > +++ b/www/manager6/Makefile > @@ -67,6 +67,7 @@ JSSRC= \ > form/PrivilegesSelector.js \ > form/QemuBiosSelector.js \ > form/QemuMachineSelector.js \ > + form/RebootFeatureSelector.js \ > form/RecordSearchField.js \ > form/SDNControllerSelector.js \ > form/SDNZoneSelector.js \ > diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js > index 8b99371d..12554e89 100644 > --- a/www/manager6/Utils.js > +++ b/www/manager6/Utils.js > @@ -1160,6 +1160,23 @@ Ext.define('PVE.Utils', { > return Ext.Date.format(new Date(value * 1000), 'l d F Y H:i:s'); > }, > > + renderReboot: function (value) { nit: Might also wanna consider changing 'renderReboot' to 'renderRebootBehavior' for consistensy. > + let normal = gettext('Reboot normally'); > + > + if (Ext.isEmpty(value)) { > + return `${Proxmox.Utils.defaultText} (${normal})`; > + } > + > + let props = PVE.Parser.parsePropertyString(value, 'enabled'); > + if (!PVE.Parser.parseBoolean(props.enabled, 1)) { > + return gettext('Shut down instead of rebooting'); > + } > + if (PVE.Parser.parseBoolean(props.powercycle, 0)) { > + return gettext('Stop and start the VM on guest reboot'); > + } > + return normal; > + }, > + > // render a timestamp or pending > render_next_event: function (value) { > if (!value) { > diff --git a/www/manager6/form/RebootFeatureSelector.js b/www/manager6/form/RebootFeatureSelector.js > new file mode 100644 > index 00000000..fb66da4b > --- /dev/null > +++ b/www/manager6/form/RebootFeatureSelector.js > @@ -0,0 +1,59 @@ > +Ext.define('PVE.form.RebootFeatureSelector', { > + extend: 'Proxmox.panel.InputPanel', > + alias: ['widget.pveRebootFeatureSelector'], > + > + viewModel: {}, > + > + items: [ > + { > + xtype: 'proxmoxcheckbox', > + boxLabel: gettext('Allow reboot'), > + name: 'enabled', > + reference: 'enabled', > + uncheckedValue: 0, > + }, > + { > + xtype: 'proxmoxcheckbox', > + boxLabel: gettext('Stop and start the VM on guest reboot (applies pending changes)'), > + name: 'powercycle', > + uncheckedValue: 0, > + bind: { > + disabled: '{!enabled.checked}', > + }, > + disabled: true, > + }, > + { > + xtype: 'displayfield', > + userCls: 'pmx-hint', > + value: gettext('The VM is shut down instead of rebooted and stays off.'), > + bind: { > + hidden: '{enabled.checked}', > + }, > + }, > + ], > + > + onGetValues: function (values) { > + let enabled = String(values.enabled) === '1'; > + let powercycle = String(values.powercycle) === '1'; > + > + // equivalent to the default, so don't write the option at all > + if (enabled && !powercycle) { > + return { delete: 'reboot' }; > + } > + > + let props = { enabled: enabled ? 1 : 0 }; > + if (powercycle) { > + props.powercycle = 1; > + } > + > + return { reboot: PVE.Parser.printPropertyString(props, 'enabled') }; > + }, > + > + setValues: function (values) { > + let res = PVE.Parser.parsePropertyString(values.reboot, 'enabled'); > + if (!Ext.isDefined(res.enabled)) { > + res.enabled = 1; > + } > + this.callParent([res]); > + }, > +}); > diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js > index 8a4721a0..480c6579 100644 > --- a/www/manager6/qemu/Options.js > +++ b/www/manager6/qemu/Options.js > @@ -84,6 +84,20 @@ Ext.define('PVE.qemu.Options', { > } > : undefined, > }, > + reboot: { > + header: gettext('Reboot behavior'), > + defaultValue: '', > + renderer: PVE.Utils.renderReboot, > + editor: caps.vms['VM.Config.Options'] > + ? { > + xtype: 'proxmoxWindowEdit', > + subject: gettext('Reboot behavior'), > + onlineHelp: 'qm_reboot_behavior', > + width: 350, > + items: { xtype: 'pveRebootFeatureSelector' }, > + } > + : undefined, > + }, > ostype: { > header: gettext('OS Type'), > editor: caps.vms['VM.Config.Options']