libteam/SOURCES/0003-utils-team2bond-add-ca...

80 lines
3.4 KiB
Diff

From ad9cf008dfed4918e3d1e521647e5f44f46bfc91 Mon Sep 17 00:00:00 2001
From: Hangbin Liu <haliu@redhat.com>
Date: Wed, 21 Jul 2021 14:23:55 +0800
Subject: [PATCH 3/4] utils/team2bond: add cautions for the script
Split the exec-cmd to Dangerous groups and add cautions to let customer
know they need to remove old team device. Also fix a typo.
Add parameter "actual" when dump team config.
Signed-off-by: Hangbin Liu <haliu@redhat.com>
---
utils/team2bond | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/utils/team2bond b/utils/team2bond
index 265bc79..118f38b 100755
--- a/utils/team2bond
+++ b/utils/team2bond
@@ -1,7 +1,7 @@
#!/bin/env python3
# vim: sts=4 ts=4 sw=4 expandtab :
-from optparse import OptionParser
+from optparse import OptionParser, OptionGroup
import subprocess
import json
import sys
@@ -11,7 +11,7 @@ def handle_cmd_line():
parser.add_option('--config', dest='config', default = '',
help = "convert the team JSON format configuration file " \
+ "to NetworkManager connection profile, please use " \
- + "'teamdctl TEAM config dump' to dump the config file." \
+ + "'teamdctl TEAM config dump [actual]' to dump the config file." \
+ " Note the script only convert config file. IP " \
+ "address configurations still need to be set manually.")
parser.add_option('--rename', dest='rename', default = '',
@@ -19,11 +19,17 @@ def handle_cmd_line():
+ " Careful: firewall rules, aliases interfaces, etc., " \
+ "will break after the renaming because the tool " \
+ "will only change the config file, nothing else.")
- parser.add_option('--exec-cmd', dest='exec_cmd', action='store_true', default = False,
+
+ group = OptionGroup(parser, 'Dangerous Options',
+ "Caution: You need to dump the team configuration " \
+ "file first and then delete old team device to avoid " \
+ "device name conflicts.")
+ group.add_option('--exec-cmd', dest='exec_cmd', action='store_true', default = False,
help = "exec nmcli and add the connections directly " \
+ "instead of printing the nmcli cmd to screen. " \
- + "This parameter is NOT recommend, it would be good " \
+ + "This parameter is NOT recommended, it would be good " \
+ "to double check the cmd before apply.")
+ parser.add_option_group(group)
(options, args) = parser.parse_args()
@@ -302,7 +308,8 @@ def main():
if not options.exec_cmd:
print("### These are the commands to configure a bond interface " +
- "similar to this team config:")
+ "similar to this team config (remember to remove the old team " +
+ "device before exec the following cmds):")
if options.rename:
bond_name = options.rename
@@ -313,7 +320,7 @@ def main():
setup_ports(bond_name, team_opts, options.exec_cmd)
if not options.exec_cmd:
- print("### After this, IP addresses, routes and so need to be reconfigured.")
+ print("### After this, IP addresses, routes, and so on, need to be configured.")
if __name__ == '__main__':
main()
--
2.31.1