-
Notifications
You must be signed in to change notification settings - Fork 34
Port: add binding:host field #626
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
base: main
Are you sure you want to change the base?
Conversation
ac3a8e2 to
b703e72
Compare
| // hostID is the ID of host where the port resides. | ||
| // +kubebuilder:validation:MaxLength=36 | ||
| // +optional | ||
| HostID string `json:"hostID,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wished there was a way to represent a Host resource in ORC so that we could have a HostRef rather than a HostID.
In that case, HostID is an ID that is exposed to a user via the nova API in the server object and that is hashed from the project ID.
According to the nova docs:
An ID string representing the host. This is a hashed value so will not actually look like a hostname, and is hashed with data from the project_id, so the same physical host as seen by two different project_ids, will be different. It is useful when within the same project you need to determine if two instances are on the same or different physical hosts for the purposes of availability or performance.
I don't think there's a way to list all host IDs for a given project as a user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to have a HostRef instead of simply the HostID. The only thing that we have is os-hypervisor but it is not project-scoped, so we can't the get the hashed value directly from the API =/.
| - celExpr: "!has(port.status.resource.description)" | ||
| # Following the network API reference, the default value for | ||
| # hostID field is an empty string. | ||
| - celExpr: "portAdmin.status.resource.hostID == ''" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Funny, I would have expected the binding host_id to be returned always to the admin, but according to what you're saying (and the tests) it's only shown when a binding host_id was set in the request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's right. I made a few tests using curl to avoid meta commands hiding the output, and the binding:host_id was only returned when set in the request.
I believe it is because we explicitly specify which host we want to bind to that port. On the other hand, I think it will be defined when binding to a device (e.g., server or router), or via Port Binding, like we are doing here.
Passing hostID:
❯ curl -s -X GET -H "X-Auth-Token: $TOKEN" http://10.5.11.133/networking/v2.0/ports/$(k get port port-create-minimal -ojsonpath='{.status.id}') | jq .
{
"port":{
"mac_address":"fa:16:3e:f4:f8:3c",
"admin_state_up":true,
"status":"DOWN",
"binding:vnic_type":"normal",
"binding:profile":{},
"binding:host_id":"devstack",
"binding:vif_type":"ovs",
"binding:vif_details":{
"port_filter":true,
"connectivity":"l2",
"bridge_name":"br-int",
"datapath_type":"system",
"bound_drivers":{
"0":"ovn"
}
}
}
}Not passing hostID:
{
"port": {
"mac_address": "fa:16:3e:44:a0:7d",
"admin_state_up": true,
"status": "DOWN",
"binding:vnic_type": "normal",
"binding:profile": {},
"binding:host_id": "",
"binding:vif_type": "unbound",
"binding:vif_details": {},
"port_security_enabled": true,
"trusted": null,
}
}
This PR adds the
binding:hostfield as hostID field on spec.Notes:
Partial: #616