Skip to content

Commit 61cab92

Browse files
committed
xe-reset-networking: allow the user to perform a network reset without
renaming the management interface There are some use cases according to which the user would like to perform a network reconfiguration of the management interface by keeping the interface's name intact. This commit allows the user to run the xe-reset-networking script by requesting the aforementioned behavior. Signed-off-by: Stefanos Gerangelos <[email protected]>
1 parent b029809 commit 61cab92

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

python3/bin/xe-reset-networking

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ if __name__ == "__main__":
9191
parser.add_option("--gateway", help="Gateway for new management interface", dest="gateway", default='')
9292
parser.add_option("--gateway-v6", help="IPv6 Gateway for new management interface", dest="gateway_v6", default='')
9393
parser.add_option("--dns", help="DNS server for new management interface", dest="dns", default='')
94+
parser.add_option("--keep-interface-name", help="do not rename the interface name", dest="keep_interface_name", action="store_const", const=True, default=False)
9495
(options, args) = parser.parse_args()
9596

9697
# Determine pool role
@@ -174,6 +175,10 @@ if __name__ == "__main__":
174175
if not os.access('/tmp/fist_network_reset_no_warning', os.F_OK):
175176
configuration = []
176177
configuration.append("Management interface: " + device)
178+
if not options.keep_interface_name:
179+
configuration.append("Rename interface: Yes")
180+
else:
181+
configuration.append("Rename interface: No")
177182
configuration.append("IP configuration mode: " + options.mode)
178183
configuration.append("IPv6 configuration mode:" + options.mode_v6)
179184
if vlan != None:
@@ -288,8 +293,9 @@ Type 'no' to cancel.
288293
if rename_script_exists:
289294
# Reset the domain 0 network interface naming configuration
290295
# back to a fresh-install state for the currently-installed
291-
# hardware.
292-
os.system(f"{RENAME_SCRIPT} --reset-to-install")
296+
# hardware (unless prevented by the user).
297+
if not options.keep_interface_name:
298+
os.system(f"{RENAME_SCRIPT} --reset-to-install")
293299

294300
# Reboot
295301
os.system("mount -o remount,rw / && reboot -f")

0 commit comments

Comments
 (0)