-
Notifications
You must be signed in to change notification settings - Fork 2
Backport #85 and #86 upstream PRs #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
SOURCES/xsconsole-network-reset-without-management-interface-rename.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| From 098b204f7be3a29e00facdef0429a19660e21031 Mon Sep 17 00:00:00 2001 | ||
| From: Stefanos Gerangelos <stefanos.gerangelos@vates.tech> | ||
| Date: Wed, 14 Jan 2026 18:13:07 +0200 | ||
| Subject: [PATCH] XSFeatureNetworkReset: allow the user to perform an emergency | ||
| network reset without renaming the management interface | ||
|
|
||
| There are some use cases according to which the user would like to perform an | ||
| emergency network reset by keeping the management interface's name intact. This | ||
| commit allows the user to proceed to an emergency network reset by requesting | ||
| the aforementioned behavior. | ||
|
|
||
| Signed-off-by: Stefanos Gerangelos <stefanos.gerangelos@vates.tech> | ||
| --- | ||
| plugins-base/XSFeatureNetworkReset.py | 37 ++++++++++++++++++++++++--- | ||
| 1 file changed, 34 insertions(+), 3 deletions(-) | ||
|
|
||
| diff --git a/plugins-base/XSFeatureNetworkReset.py b/plugins-base/XSFeatureNetworkReset.py | ||
| index 62442d0..2d33657 100644 | ||
| --- a/plugins-base/XSFeatureNetworkReset.py | ||
| +++ b/plugins-base/XSFeatureNetworkReset.py | ||
| @@ -82,6 +82,12 @@ class NetworkResetDialogue(Dialogue): | ||
| except: | ||
| self.vlan = '' | ||
|
|
||
| + self.renameMgmt = True | ||
| + self.renameMenu = Menu(self, None, Lang("Choose to rename/keep the Management Interface name"), [ | ||
| + ChoiceDef(Lang("Rename"), lambda: self.HandleRenameChoice('RENAME') ), | ||
| + ChoiceDef(Lang("Keep name"), lambda: self.HandleRenameChoice('KEEP') ) | ||
| + ]) | ||
| + | ||
| self.modeMenu = Menu(self, None, Lang("Select IP Address Configuration Mode"), [ | ||
| ChoiceDef(Lang("DHCP"), lambda: self.HandleModeChoice('DHCP') ), | ||
| ChoiceDef(Lang("Static"), lambda: self.HandleModeChoice('STATIC') ) | ||
| @@ -126,6 +132,14 @@ class NetworkResetDialogue(Dialogue): | ||
| if pane.InputIndex() is None: | ||
| pane.InputIndexSet(0) # Activate first field for input | ||
|
|
||
| + def UpdateFieldsRENAME(self): | ||
| + pane = self.Pane() | ||
| + pane.ResetFields() | ||
| + | ||
| + pane.AddTitleField(Lang("Choose to rename/keep the Management Interface name")) | ||
| + pane.AddMenuField(self.renameMenu) | ||
| + pane.AddKeyHelpField( { Lang("<Enter>") : Lang("OK"), Lang("<Esc>") : Lang("Cancel") } ) | ||
| + | ||
| def UpdateFieldsMODE(self): | ||
| pane = self.Pane() | ||
| pane.ResetFields() | ||
| @@ -168,6 +182,10 @@ class NetworkResetDialogue(Dialogue): | ||
|
|
||
| pane.AddWrappedTextField(Lang("The Primary Management Interface will be reconfigured with the following settings:")) | ||
| pane.AddStatusField(Lang("NIC", 16), self.device) | ||
| + if self.renameMgmt: | ||
| + pane.AddStatusField(Lang("Rename NIC:", 16), "Yes") | ||
| + else: | ||
| + pane.AddStatusField(Lang("Rename NIC:", 16), "No") | ||
| if self.vlan != '': | ||
| pane.AddStatusField(Lang("VLAN", 16), self.vlan) | ||
| pane.AddStatusField(Lang("IP Mode", 16), self.mode) | ||
| @@ -214,7 +232,7 @@ class NetworkResetDialogue(Dialogue): | ||
| pane.InputIndexSet(None) | ||
| Layout.Inst().PushDialogue(InfoDialogue(Lang('VLAN tag must be between 0 and 4094'))) | ||
| else: | ||
| - self.ChangeState('MODE') | ||
| + self.ChangeState('RENAME') | ||
| else: | ||
| pane.ActivateNextInput() | ||
| elif inKey == 'KEY_TAB': | ||
| @@ -227,6 +245,9 @@ class NetworkResetDialogue(Dialogue): | ||
| handled = False | ||
| return handled | ||
|
|
||
| + def HandleKeyRENAME(self, inKey): | ||
| + return self.renameMenu.HandleKey(inKey) | ||
| + | ||
| def HandleKeyMODE(self, inKey): | ||
| return self.modeMenu.HandleKey(inKey) | ||
|
|
||
| @@ -315,6 +336,12 @@ class NetworkResetDialogue(Dialogue): | ||
|
|
||
| return handled | ||
|
|
||
| + def HandleRenameChoice(self, inChoice): | ||
| + if inChoice == 'KEEP': | ||
| + self.renameMgmt = False | ||
| + | ||
| + self.ChangeState('MODE') | ||
| + | ||
| def HandleModeChoice(self, inChoice): | ||
| if inChoice == 'DHCP': | ||
| self.mode = 'dhcp' | ||
| @@ -410,8 +437,12 @@ class NetworkResetDialogue(Dialogue): | ||
|
|
||
| # Reset the domain 0 network interface naming configuration | ||
| # back to a fresh-install state for the currently-installed | ||
| - # hardware. | ||
| - os.system("/etc/sysconfig/network-scripts/interface-rename.py --reset-to-install") | ||
| + # hardware (unless prevented by the user). | ||
| + if self.renameMgmt: | ||
| + XSLog('Will rename the Management Interface') | ||
| + os.system("/etc/sysconfig/network-scripts/interface-rename.py --reset-to-install") | ||
| + else: | ||
| + XSLog('Will NOT rename the Management Interface') | ||
|
|
||
| class XSFeatureNetworkReset: | ||
| @classmethod |
77 changes: 77 additions & 0 deletions
77
SOURCES/xsconsole-reset-old-management-interface-when-switching-to-new.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| From 4dd53f6e64ee4a62220af2d6f392ceb695c2c766 Mon Sep 17 00:00:00 2001 | ||
| From: Stefanos Gerangelos <stefanos.gerangelos@vates.tech> | ||
| Date: Mon, 22 Jun 2026 14:40:11 +0200 | ||
| Subject: [PATCH] XSFeatureInterface: Reset old management interface | ||
| configuration when switching to a new one | ||
|
|
||
| Fix the following issue from upstream: | ||
| https://github.com/xapi-project/xsconsole/issues/8 | ||
|
|
||
| Essentially, reset the old management interface configuration when | ||
| switching to a new one, in order to avoid network conflicts | ||
|
|
||
| Signed-off-by: Stefanos Gerangelos <stefanos.gerangelos@vates.tech> | ||
| --- | ||
| plugins-base/XSFeatureInterface.py | 13 +++++++++++++ | ||
| 1 file changed, 13 insertions(+) | ||
|
|
||
| diff --git a/plugins-base/XSFeatureInterface.py b/plugins-base/XSFeatureInterface.py | ||
| index e5cf547..c812cc3 100644 | ||
| --- a/plugins-base/XSFeatureInterface.py | ||
| +++ b/plugins-base/XSFeatureInterface.py | ||
| @@ -28,6 +28,7 @@ class InterfaceDialogue(Dialogue): | ||
| self.nic=None | ||
| self.converting = False | ||
| currentPIF = None | ||
| + self.oldPIF = None | ||
| choiceArray = [] | ||
| for i in range(len(data.host.PIFs([]))): | ||
| pif = data.host.PIFs([])[i] | ||
| @@ -45,6 +46,7 @@ class InterfaceDialogue(Dialogue): | ||
|
|
||
| choiceDefs.append(ChoiceDef(choiceName, lambda: self.HandleNICChoice(self.nicMenu.ChoiceIndex()))) | ||
|
|
||
| + self.oldPIF = currentPIF | ||
| if len(choiceDefs) == 0: | ||
| XSLog('Configure Management Interface found no PIFs to present') | ||
| choiceDefs.append(ChoiceDef(Lang("<No interfaces present>"), None)) | ||
| @@ -84,6 +86,7 @@ class InterfaceDialogue(Dialogue): | ||
| self.netmask = '0.0.0.0' | ||
| self.gateway = '0.0.0.0' | ||
| self.hostname = data.host.hostname('') | ||
| + self.oldIP = self.IP | ||
|
|
||
| if currentPIF is not None: | ||
| ipv6 = currentPIF['primary_address_type'].lower() == 'ipv6' | ||
| @@ -93,6 +96,7 @@ class InterfaceDialogue(Dialogue): | ||
| if self.mode.lower().startswith('static'): | ||
| if 'IP' in currentPIF: | ||
| self.IP = currentPIF['IPv6'][0].split('/')[0] if ipv6 else currentPIF['IP'] | ||
| + self.oldIP = self.IP | ||
| if 'netmask' in currentPIF: | ||
| self.netmask = currentPIF['IPv6'][0].split('/')[1] if ipv6 else currentPIF['netmask'] | ||
| if 'gateway' in currentPIF: | ||
| @@ -110,6 +114,9 @@ class InterfaceDialogue(Dialogue): | ||
| self.nicMenu.AddChoice(name = Lang('Renew DHCP Lease On Current Interface'), | ||
| onAction = lambda: self.HandleRenewChoice() | ||
| ) | ||
| + if currentPIF is not None and 'IP' in currentPIF: | ||
| + self.IP = currentPIF['IPv6'][0].split('/')[0] if ipv6 else currentPIF['IP'] | ||
| + self.oldIP = self.IP | ||
|
|
||
| self.ChangeState('INITIAL') | ||
|
|
||
| @@ -458,7 +465,13 @@ class InterfaceDialogue(Dialogue): | ||
| data.HostnameSet('localhost') | ||
| else: | ||
| data.HostnameSet(self.hostname) | ||
| + | ||
| + # Reset old PIF in order to prevent network conflicts | ||
| + if self.mode.lower().startswith('static') and self.oldPIF != pif and self.IP == self.oldIP: | ||
| + data.ReconfigureManagement(self.oldPIF, 'static', '0.0.0.0', '0.0.0.0', '0.0.0.0', '') | ||
| + | ||
| data.ReconfigureManagement(pif, self.mode, self.IP, self.netmask, self.gateway, dns) | ||
| + | ||
| data.Update() | ||
| self.hostname = data.host.hostname('') # Hostname may have changed. Must be after data.Update() | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.