Repository navigation
Add Nova interface-list support - #430
Conversation
52223c6 to
7c33e5b
Compare
|
@jtopjian Hi jtopjian, I'd like you to do a code review, thank you. |
|
@FengyunPan Thank you for submitting this. Per the PR template and the STYLEGUIDE you'll need to provide links to the python source code which implements this feature in the OpenStack service. Also, a corresponding Gophercloud issue needs to be opened. Please let me know if you have any questions. |
|
@jtopjian I have added it, need other information? |
|
@FengyunPan I had some time to look into this in more detail. It looks like the ability to "get" interfaces is part of the This is actually utterly confusing because I had no idea this ability existed hidden in the Since it's an extension, it needs to be packaged under the As for the code itself, you'll need to modify the field names to use "camel case" rather than the current format which is using underscores. For example, Once all of that is done, I can do another review. Let me know if you have any questions or need any help. |
|
@jtopjian Thank for your comment, I will update it soon. |
c991229 to
2a59bd5
Compare
jtopjian
left a comment
There was a problem hiding this comment.
@FengyunPan This looks really good. Thank you for both your patience and your work on this.
Please see the request for changes. They're all quite simple -- just renaming and rewording.
| @@ -0,0 +1,3 @@ | |||
| // Package attachinterfaces provides the ability to manage attach interfaces through | |||
There was a problem hiding this comment.
How about:
"the ability to manage network interfaces"
| ) | ||
|
|
||
| // ListInterfaces makes a request against the nova API to list the servers interfaces. | ||
| func ListInterfaces(client *gophercloud.ServiceClient, id string) pagination.Pager { |
There was a problem hiding this comment.
The attach-interfaces extension only lists one type of resource (interfaces), so this can be renamed to just List.
In addition, the id is the id of the server, so let's rename id to serverID so it's not mistaken as an "interface id".
| // Interface represents an interface. | ||
| type FixedID struct { | ||
| SubnetID string `json:"subnet_id"` | ||
| IpAddress string `json:"ip_address"` |
| "github.com/gophercloud/gophercloud/pagination" | ||
| ) | ||
|
|
||
| // Interface represents an interface. |
There was a problem hiding this comment.
// FixedIP represents a Fixed IP Address.
| ) | ||
|
|
||
| // Interface represents an interface. | ||
| type FixedID struct { |
| IpAddress string `json:"ip_address"` | ||
| } | ||
|
|
||
| // Interface represents an interface. |
There was a problem hiding this comment.
How about:
// Interface represents a network interface on an instance.
Just so it's not confused as a golang interface.
| // Interface represents an interface. | ||
| type Interface struct { | ||
| PortState string `json:"port_state"` | ||
| FixedIPs []FixedID `json:"fixed_ips"` |
There was a problem hiding this comment.
FixedIPs []FixedIP `json:"fixed_ips"`| MacAddr string `json:"mac_addr"` | ||
| } | ||
|
|
||
| // InterfacePage abstracts the raw results of making a ListInterfaces() request against the API. |
| t.Logf("Addresses on %s: %+v", network, address) | ||
| } | ||
|
|
||
| allInterfacePages, err := attachinterfaces.ListInterfaces(client, server.ID).AllPages() |
2a59bd5 to
8c294ef
Compare
jtopjian
left a comment
There was a problem hiding this comment.
one more change. I apologize.
| FixedIPs []FixedIP `json:"fixed_ips"` | ||
| PortID string `json:"port_id"` | ||
| NetID string `json:"net_id"` | ||
| MacAddr string `json:"mac_addr"` |
There was a problem hiding this comment.
@FengyunPan I'm sorry, I just noticed this.
This should be MACAddr. There are several other areas in Gophercloud where MAC is used, so this will be consistent. It's better to change this now than later.
There was a problem hiding this comment.
Yeah, my mistake, I update it soon, thank you very much.
Add support to list interface for a server
through a GET on: /v2.1/{tenant_id}/servers/{server_id}/os-interface
The same operation with OpenStack CLI is done with:
nova interface-list <server_id>
8c294ef to
d1f42e8
Compare
|
Looks good to me! Thank you again for your patience and for contributing this! |
This commit increases the Gomago Eventuall timeout to 30 seconds in all tests cases to avoid tests failures by timeout [1]. [1]: https://github.com/Wind-River/cloud-platform-deployment-manager/pull/429/checks?check_run_id=33619644827 Test Case: PASS - make test Signed-off-by: Wallysson Silva <[email protected]>
Add support to list interface for a server
through a GET on: /v2.1/{tenant_id}/servers/{server_id}/os-interface
The same operation with OpenStack CLI is done with:
nova interface-list <server_id>
Fix gophercloud issue:
#431
Fix kubernetes issue:
kubernetes/kubernetes#43909