public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] ui: console: detect and warn on application containers
@ 2025-11-18 13:07 Dominik Csapak
  2025-11-18 14:14 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Dominik Csapak @ 2025-11-18 13:07 UTC (permalink / raw)
  To: pve-devel

application containers often don't have a functional shell (since it
runs directly, without init) so try to detect and warn the users
in the inline console.

The detection heuristic is:
* cmode is 'console'
* entrypiont is not '/sbin/init'

Those values are not the (lxc) default and should cover most application
containers.

Since we change the layout a bit, focus the actual iframe component, not
the panel.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 www/manager6/VNCConsole.js | 36 +++++++++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

diff --git a/www/manager6/VNCConsole.js b/www/manager6/VNCConsole.js
index e4f22cf9..399ed55f 100644
--- a/www/manager6/VNCConsole.js
+++ b/www/manager6/VNCConsole.js
@@ -29,11 +29,25 @@ Ext.define('PVE.noVncConsole', {
 
         // always use same iframe, to avoid running several noVnc clients
         // at same time (to avoid performance problems)
-        var box = Ext.create('Ext.ux.IFrame', { itemid: 'vncconsole' });
+        var box = Ext.create('Ext.ux.IFrame', { itemid: 'vncconsole', flex: 1 });
+
+        let warning = Ext.create('Ext.Component', {
+            userCls: 'pmx-hint',
+            padding: 5,
+            hidden: true,
+            style: {
+                'text-align': 'center',
+            },
+            html: gettext('Application Container detected - console might not be functional.'),
+        });
 
         var type = me.xtermjs ? 'xtermjs' : 'novnc';
         Ext.apply(me, {
-            items: box,
+            layout: {
+                type: 'vbox',
+                align: 'stretch',
+            },
+            items: [warning, box],
             listeners: {
                 activate: function () {
                     let sp = Ext.state.Manager.getProvider();
@@ -58,8 +72,24 @@ Ext.define('PVE.noVncConsole', {
 
         me.callParent();
 
+        // check for app container
+        if (me.consoleType === 'lxc') {
+            Proxmox.Utils.API2Request({
+                url: `/nodes/${me.nodename}/lxc/${me.vmid}/config`,
+                success: function (response) {
+                    let consoleMode = response?.result?.data?.cmode;
+                    let entryPoint = response?.result?.data?.entrypoint;
+                    let customEntryPoint = entryPoint !== undefined && entryPoint !== '/sbin/init';
+
+                    if (customEntryPoint && consoleMode === 'console') {
+                        warning.setVisible(true);
+                    }
+                },
+            });
+        }
+
         me.on('afterrender', function () {
-            me.focus();
+            box.focus();
         });
     },
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH manager] ui: console: detect and warn on application containers
  2025-11-18 13:07 [pve-devel] [PATCH manager] ui: console: detect and warn on application containers Dominik Csapak
@ 2025-11-18 14:14 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2025-11-18 14:14 UTC (permalink / raw)
  To: pve-devel, Dominik Csapak

On Tue, 18 Nov 2025 14:07:04 +0100, Dominik Csapak wrote:
> application containers often don't have a functional shell (since it
> runs directly, without init) so try to detect and warn the users
> in the inline console.
> 
> The detection heuristic is:
> * cmode is 'console'
> * entrypiont is not '/sbin/init'
> 
> [...]

Applied, thanks!

[1/1] ui: console: detect and warn on application containers
      commit: 62545a1ed9fc0f51d2c27b372e52c7e8bde12e71


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-18 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-18 13:07 [pve-devel] [PATCH manager] ui: console: detect and warn on application containers Dominik Csapak
2025-11-18 14:14 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal