Skip to content

interface network option improvement #1421

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

Conversation

liangxin1300
Copy link
Collaborator

@liangxin1300 liangxin1300 commented May 9, 2024

  • Give valid value list for the -i option when the value is invalid
# crm cluster init -i xxx
ERROR: cluster.init: Invalid value 'xxx' for -i/--interface option

# After applying this PR

# crm cluster init -i xxx
ERROR: cluster.init: Invalid value 'xxx' for -i/--interface option, should be enp1s0, enp7s0, enp8s0 or 192.168.122.189, 10.10.10.61, 20.20.20.61
  • On join side, adjust the condition of comparing the link number
# on init node
# crm cluster init -i 10.10.10.61 -i 20.20.20.61 -y

# on join node
# crm cluster join
# ...
# ERROR: cluster.join: knet transport of all cluster nodes need 2 links via '-i' options, but provided 1

# After applying this PR

# crm cluster join
# ...
# Address for ring0 [192.168.122.145]
# Address for ring1 []10.10.10.62
  • Minor refactoring of the get_address_list function
# no way to add another ring on interactive mode
# crm cluster init
...
Address for ring0 [192.168.122.189]
INFO: Configure SBD:

# After applying this PR
# crm cluster init
...
Address for ring0 [192.168.122.145]

Add another ring (y/n)?
# no need to ask for confirm for each -i option
# crm cluster init -i enp7s0 -i enp8s0
...
Address for ring0 [10.10.10.61]

Add another ring (y/n)?

# After applying this PR
 # crm cluster init -i enp7s0 -i enp8s0
...
Address for ring0 [10.10.10.62]
Address for ring1 [20.20.20.62]
INFO: Configure SBD:

Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 85.71429% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 53.74%. Comparing base (ec25d36) to head (1adedcb).
Report is 7 commits behind head on master.

Files Patch % Lines
crmsh/bootstrap.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1421      +/-   ##
==========================================
- Coverage   53.74%   53.74%   -0.01%     
==========================================
  Files          80       80              
  Lines       24058    24064       +6     
==========================================
+ Hits        12931    12934       +3     
- Misses      11127    11130       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@liangxin1300 liangxin1300 force-pushed the 20240509_interface_improvement branch from abad08c to 90bca5e Compare May 20, 2024 01:11
@liangxin1300 liangxin1300 marked this pull request as ready for review May 20, 2024 02:19
Copy link
Collaborator

@nicholasyang2022 nicholasyang2022 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be ['enp1s0', 'enp7s0', 'enp8s0'] or ['192.168.122.189', '10.10.10.61', '20.20.20.61']

This is confusing. How about

should be 'enp1s0', 'enp7s0', 'enp8s0', '192.168.122.189', '10.10.10.61', or '20.20.20.61'.

for i in range(loop_count):
# at non-interactive mode, need to confirm after default ip list been consumed
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "at interactive mode"?

@nicholasyang2022
Copy link
Collaborator

It does not make sense to ask for another ring when -i is specified in cmdline, especially when multiple -i is specified. Or at least, the question should have a default answer 'N' so that the user can simply skip the question by pressing Enter.

@liangxin1300 liangxin1300 force-pushed the 20240509_interface_improvement branch from 90bca5e to 7a38e61 Compare May 27, 2024 06:53
@liangxin1300
Copy link
Collaborator Author

It does not make sense to ask for another ring when -i is specified in cmdline, especially when multiple -i is specified. Or at least, the question should have a default answer 'N' so that the user can simply skip the question by pressing Enter.

Changed, not ask when -i was specified

if _context.yes_to_all or _context.nic_addr_list:
loop_count = len(_context.default_ip_list)
else:
# interative mode or without -i option specified
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# interative mode or without -i option specified
# interative mode and without -i option specified

@liangxin1300 liangxin1300 force-pushed the 20240509_interface_improvement branch from 7a38e61 to 1adedcb Compare May 27, 2024 08:49
@liangxin1300 liangxin1300 merged commit c723009 into ClusterLabs:master May 28, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants