Skip to content
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

Feature: support get ipvs info #14

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

kwanhur
Copy link
Contributor

@kwanhur kwanhur commented Mar 18, 2020

fetch ipvs info with API info := i.GetInfo()

fetch version number just call info.Version.String(), example: 1.2.1
fetch connection table size call info.ConnTableSize, example: 4096 .

Signed-off-by: kwanhur <huang_hua2012@163.com>
ipvs.go Outdated

ver := uint(res.version)
return &Info{
Version: &Version{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we put the conversion of ver to Version in a separate function so we can add unit tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

version as one attribute of ipvsInfo, we should test it as a whole? like test case TestInfo

Copy link
Member

Choose a reason for hiding this comment

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

@kwanhur I agree with @andrewsykim.
We can test different inputs for the conversion and not rely on the netlink of the test system.

@@ -573,6 +578,44 @@ func (i *Handle) doSetConfigCmd(c *Config) error {
return err
}

// parseInfo given a ipvs netlink response this function will respond with a valid info entry, an error otherwise
func (i *Handle) parseInfo(msg []byte) (*ipvsInfo, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this needs to be bound to *Handle?

Signed-off-by: kwanhur <huang_hua2012@163.com>
Signed-off-by: kwanhur <huang_hua2012@163.com>
@kwanhur
Copy link
Contributor Author

kwanhur commented Sep 17, 2021

@andrewsykim @cpuguy83 add two api GetVersion GetConnectionTableSize, review them pls :-)

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.

None yet

3 participants