Skip to content

Commit 190ff7a

Browse files
committed
Backport the following upstream PRs (#85 and #86):
xapi-project/xsconsole#85 xapi-project/xsconsole#86 Signed-off-by: Stefanos Gerangelos <stefanos.gerangelos@vates.tech>
1 parent 495a5b2 commit 190ff7a

3 files changed

Lines changed: 189 additions & 1 deletion
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
From 098b204f7be3a29e00facdef0429a19660e21031 Mon Sep 17 00:00:00 2001
2+
From: Stefanos Gerangelos <stefanos.gerangelos@vates.tech>
3+
Date: Wed, 14 Jan 2026 18:13:07 +0200
4+
Subject: [PATCH] XSFeatureNetworkReset: allow the user to perform an emergency
5+
network reset without renaming the management interface
6+
7+
There are some use cases according to which the user would like to perform an
8+
emergency network reset by keeping the management interface's name intact. This
9+
commit allows the user to proceed to an emergency network reset by requesting
10+
the aforementioned behavior.
11+
12+
Signed-off-by: Stefanos Gerangelos <stefanos.gerangelos@vates.tech>
13+
---
14+
plugins-base/XSFeatureNetworkReset.py | 37 ++++++++++++++++++++++++---
15+
1 file changed, 34 insertions(+), 3 deletions(-)
16+
17+
diff --git a/plugins-base/XSFeatureNetworkReset.py b/plugins-base/XSFeatureNetworkReset.py
18+
index 62442d0..2d33657 100644
19+
--- a/plugins-base/XSFeatureNetworkReset.py
20+
+++ b/plugins-base/XSFeatureNetworkReset.py
21+
@@ -82,6 +82,12 @@ class NetworkResetDialogue(Dialogue):
22+
except:
23+
self.vlan = ''
24+
25+
+ self.renameMgmt = True
26+
+ self.renameMenu = Menu(self, None, Lang("Choose to rename/keep the Management Interface name"), [
27+
+ ChoiceDef(Lang("Rename"), lambda: self.HandleRenameChoice('RENAME') ),
28+
+ ChoiceDef(Lang("Keep name"), lambda: self.HandleRenameChoice('KEEP') )
29+
+ ])
30+
+
31+
self.modeMenu = Menu(self, None, Lang("Select IP Address Configuration Mode"), [
32+
ChoiceDef(Lang("DHCP"), lambda: self.HandleModeChoice('DHCP') ),
33+
ChoiceDef(Lang("Static"), lambda: self.HandleModeChoice('STATIC') )
34+
@@ -126,6 +132,14 @@ class NetworkResetDialogue(Dialogue):
35+
if pane.InputIndex() is None:
36+
pane.InputIndexSet(0) # Activate first field for input
37+
38+
+ def UpdateFieldsRENAME(self):
39+
+ pane = self.Pane()
40+
+ pane.ResetFields()
41+
+
42+
+ pane.AddTitleField(Lang("Choose to rename/keep the Management Interface name"))
43+
+ pane.AddMenuField(self.renameMenu)
44+
+ pane.AddKeyHelpField( { Lang("<Enter>") : Lang("OK"), Lang("<Esc>") : Lang("Cancel") } )
45+
+
46+
def UpdateFieldsMODE(self):
47+
pane = self.Pane()
48+
pane.ResetFields()
49+
@@ -168,6 +182,10 @@ class NetworkResetDialogue(Dialogue):
50+
51+
pane.AddWrappedTextField(Lang("The Primary Management Interface will be reconfigured with the following settings:"))
52+
pane.AddStatusField(Lang("NIC", 16), self.device)
53+
+ if self.renameMgmt:
54+
+ pane.AddStatusField(Lang("Rename NIC:", 16), "Yes")
55+
+ else:
56+
+ pane.AddStatusField(Lang("Rename NIC:", 16), "No")
57+
if self.vlan != '':
58+
pane.AddStatusField(Lang("VLAN", 16), self.vlan)
59+
pane.AddStatusField(Lang("IP Mode", 16), self.mode)
60+
@@ -214,7 +232,7 @@ class NetworkResetDialogue(Dialogue):
61+
pane.InputIndexSet(None)
62+
Layout.Inst().PushDialogue(InfoDialogue(Lang('VLAN tag must be between 0 and 4094')))
63+
else:
64+
- self.ChangeState('MODE')
65+
+ self.ChangeState('RENAME')
66+
else:
67+
pane.ActivateNextInput()
68+
elif inKey == 'KEY_TAB':
69+
@@ -227,6 +245,9 @@ class NetworkResetDialogue(Dialogue):
70+
handled = False
71+
return handled
72+
73+
+ def HandleKeyRENAME(self, inKey):
74+
+ return self.renameMenu.HandleKey(inKey)
75+
+
76+
def HandleKeyMODE(self, inKey):
77+
return self.modeMenu.HandleKey(inKey)
78+
79+
@@ -315,6 +336,12 @@ class NetworkResetDialogue(Dialogue):
80+
81+
return handled
82+
83+
+ def HandleRenameChoice(self, inChoice):
84+
+ if inChoice == 'KEEP':
85+
+ self.renameMgmt = False
86+
+
87+
+ self.ChangeState('MODE')
88+
+
89+
def HandleModeChoice(self, inChoice):
90+
if inChoice == 'DHCP':
91+
self.mode = 'dhcp'
92+
@@ -410,8 +437,12 @@ class NetworkResetDialogue(Dialogue):
93+
94+
# Reset the domain 0 network interface naming configuration
95+
# back to a fresh-install state for the currently-installed
96+
- # hardware.
97+
- os.system("/etc/sysconfig/network-scripts/interface-rename.py --reset-to-install")
98+
+ # hardware (unless prevented by the user).
99+
+ if self.renameMgmt:
100+
+ XSLog('Will rename the Management Interface')
101+
+ os.system("/etc/sysconfig/network-scripts/interface-rename.py --reset-to-install")
102+
+ else:
103+
+ XSLog('Will NOT rename the Management Interface')
104+
105+
class XSFeatureNetworkReset:
106+
@classmethod
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
From 4dd53f6e64ee4a62220af2d6f392ceb695c2c766 Mon Sep 17 00:00:00 2001
2+
From: Stefanos Gerangelos <stefanos.gerangelos@vates.tech>
3+
Date: Mon, 22 Jun 2026 14:40:11 +0200
4+
Subject: [PATCH] XSFeatureInterface: Reset old management interface
5+
configuration when switching to a new one
6+
7+
Fix the following issue from upstream:
8+
https://github.com/xapi-project/xsconsole/issues/8
9+
10+
Essentially, reset the old management interface configuration when
11+
switching to a new one, in order to avoid network conflicts
12+
13+
Signed-off-by: Stefanos Gerangelos <stefanos.gerangelos@vates.tech>
14+
---
15+
plugins-base/XSFeatureInterface.py | 13 +++++++++++++
16+
1 file changed, 13 insertions(+)
17+
18+
diff --git a/plugins-base/XSFeatureInterface.py b/plugins-base/XSFeatureInterface.py
19+
index e5cf547..c812cc3 100644
20+
--- a/plugins-base/XSFeatureInterface.py
21+
+++ b/plugins-base/XSFeatureInterface.py
22+
@@ -28,6 +28,7 @@ class InterfaceDialogue(Dialogue):
23+
self.nic=None
24+
self.converting = False
25+
currentPIF = None
26+
+ self.oldPIF = None
27+
choiceArray = []
28+
for i in range(len(data.host.PIFs([]))):
29+
pif = data.host.PIFs([])[i]
30+
@@ -45,6 +46,7 @@ class InterfaceDialogue(Dialogue):
31+
32+
choiceDefs.append(ChoiceDef(choiceName, lambda: self.HandleNICChoice(self.nicMenu.ChoiceIndex())))
33+
34+
+ self.oldPIF = currentPIF
35+
if len(choiceDefs) == 0:
36+
XSLog('Configure Management Interface found no PIFs to present')
37+
choiceDefs.append(ChoiceDef(Lang("<No interfaces present>"), None))
38+
@@ -84,6 +86,7 @@ class InterfaceDialogue(Dialogue):
39+
self.netmask = '0.0.0.0'
40+
self.gateway = '0.0.0.0'
41+
self.hostname = data.host.hostname('')
42+
+ self.oldIP = self.IP
43+
44+
if currentPIF is not None:
45+
ipv6 = currentPIF['primary_address_type'].lower() == 'ipv6'
46+
@@ -93,6 +96,7 @@ class InterfaceDialogue(Dialogue):
47+
if self.mode.lower().startswith('static'):
48+
if 'IP' in currentPIF:
49+
self.IP = currentPIF['IPv6'][0].split('/')[0] if ipv6 else currentPIF['IP']
50+
+ self.oldIP = self.IP
51+
if 'netmask' in currentPIF:
52+
self.netmask = currentPIF['IPv6'][0].split('/')[1] if ipv6 else currentPIF['netmask']
53+
if 'gateway' in currentPIF:
54+
@@ -110,6 +114,9 @@ class InterfaceDialogue(Dialogue):
55+
self.nicMenu.AddChoice(name = Lang('Renew DHCP Lease On Current Interface'),
56+
onAction = lambda: self.HandleRenewChoice()
57+
)
58+
+ if currentPIF is not None and 'IP' in currentPIF:
59+
+ self.IP = currentPIF['IPv6'][0].split('/')[0] if ipv6 else currentPIF['IP']
60+
+ self.oldIP = self.IP
61+
62+
self.ChangeState('INITIAL')
63+
64+
@@ -458,7 +465,13 @@ class InterfaceDialogue(Dialogue):
65+
data.HostnameSet('localhost')
66+
else:
67+
data.HostnameSet(self.hostname)
68+
+
69+
+ # Reset old PIF in order to prevent network conflicts
70+
+ if self.mode.lower().startswith('static') and self.oldPIF != pif and self.IP == self.oldIP:
71+
+ data.ReconfigureManagement(self.oldPIF, 'static', '0.0.0.0', '0.0.0.0', '0.0.0.0', '')
72+
+
73+
data.ReconfigureManagement(pif, self.mode, self.IP, self.netmask, self.gateway, dns)
74+
+
75+
data.Update()
76+
self.hostname = data.host.hostname('') # Hostname may have changed. Must be after data.Update()
77+

SPECS/xsconsole.spec

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Summary: XCP-ng Host Configuration Console
66
Name: xsconsole
77
Version: 11.0.9.1
8-
Release: %{?xsrel}.1%{?dist}
8+
Release: %{?xsrel}.2%{?dist}
99
License: GPL2
1010
Group: Administration/System
1111
Source0: xsconsole-11.0.9.1.tar.gz
@@ -35,6 +35,8 @@ Patch1001: xsconsole-10.1.13-define-xcp-ng-colors.XCP-ng.patch
3535
# PR pending merge
3636
Patch1002: xsconsole-11.0.2-support-ipv6.XCP-ng.patch
3737
Patch1003: xsconsole-11.0.6-Ipv6-pool-join.XCP-ng.patch
38+
Patch1004: xsconsole-network-reset-without-management-interface-rename.patch
39+
Patch1005: xsconsole-reset-old-management-interface-when-switching-to-new.patch
3840

3941
%description
4042
Console tool for configuring a XCP-ng installation.
@@ -71,6 +73,9 @@ Console tool for configuring a XCP-ng installation.
7173
%{_unitdir}/xsconsole.service
7274

7375
%changelog
76+
* Mon Jun 22 2026 Stefanos Gerangelos <stefanos.gerangelos@vates.tech> - 11.0.9.1-2
77+
- Backport the user option to allow the network reset without renaming the management interface (upstream PR #85)
78+
- Backport the reset of old management interface configuration when switching to a new one (upstream PR #86)
7479
* Tue Sep 02 2025 Guillaume Thouvenin <guillaume.thouvenin@vates.tech> - 11.0.9.1-1.1
7580
- Sync with 11.0.9.1-1
7681
- Drop xsconsole-11.0.8-sync-network-reset-trigger-file.patch

0 commit comments

Comments
 (0)