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

GetIloIPAddress() does not work with GetServerHardwareList() #286

Closed
mikeshapp opened this issue Dec 14, 2020 · 3 comments
Closed

GetIloIPAddress() does not work with GetServerHardwareList() #286

mikeshapp opened this issue Dec 14, 2020 · 3 comments
Assignees

Comments

@mikeshapp
Copy link

I'm trying to get the ILO IP addresses for all servers returned by GetServerHardwareList()

Using:# go version
go version go1.15.6 linux/amd64
OneView Client API Version: 2000

GetIloIPAddress() works with GetServerHardwareByName() because it sets the Client member:

    serverHardwareList.Members[0].Client = c

GetServerHardwareList() does not set the Client member for each server, leaving it as nil, so GetIloIPAddress() panics:

For example, these will panic in GetIloIPAddress() because the Client member is not set:

    filters := []string{""}
    ServerList, err := ovc.GetServerHardwareList(filters, "", "", "", "")
    for i := 0; i < ServerList.Total; i++ {
            iloIpaddress := ServerList.Members[i].GetIloIPAddress()
    }

OR

    filters := []string{""}
    ServerList, err := ovc.GetServerHardwareList(filters, "", "", "", "")
   for _, serverName := range ServerList.Members {
            iloIpaddress := serverName.GetIloIPAddress()
    }

I can workaround it by setting the Client member before using GetIloIPAddress() but it would be better to have it set in GetServerHardwareList():

This will display all the server ILO IP addresses returned by GetServerHardwareList():

    filters := []string{""}
    ServerList, err := ovc.GetServerHardwareList(filters, "", "", "", "")
    for i := 0; i < ServerList.Total; i++ {
            ServerList.Members[i].Client = ovc
    }
    for i := 0; i < ServerList.Total; i++ {
            iloIpaddress := ServerList.Members[i].GetIloIPAddress()
    }
@AsisBagga
Copy link
Contributor

@mikeshapp Hi Mike, Thanks for pointing this out, this has been taken care in new PR, and changes will show up in coming release.

@AsisBagga
Copy link
Contributor

Since this enhancement is added to source code, good to close the issue.

@mikeshapp
Copy link
Author

I tested it with this code and it works correctly (no longer panics):

filters := []string{""}
ServerList, err := ovc.GetServerHardwareList(filters, "", "", "", "")
for _, serverName := range ServerList.Members {
iloIpaddress := serverName.GetIloIPAddress()
fmt.Printf("Server Name: %-30s ILO: %s\n", serverName.Name, iloIpaddress)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants