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

[occm] Replace call to Nova os-interfaces with direct Neutron call #2250

Merged
merged 1 commit into from
May 31, 2023

Conversation

mdbooth
Copy link
Contributor

@mdbooth mdbooth commented May 19, 2023

What this PR does / why we need it:
os-interfaces is a proxy API for neutron's ports list. This has 2 significant disadvantages to us:

  • It adds the overhead of an extra API call every time it is used
  • It doesn't contain all the information returned by Neutron

This is a non-functional change, although is does reduce the load on nova-api without reducing functionality.

The primary motivation for this is to enable additional filtering using information from ports, e.g. filtering by port tag or the addition of subports as in #2228.

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 19, 2023
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 19, 2023
@mdbooth
Copy link
Contributor Author

mdbooth commented May 19, 2023

/cc @stephenfin @dulek

@k8s-ci-robot k8s-ci-robot requested a review from dulek May 19, 2023 13:07
@k8s-ci-robot
Copy link
Contributor

@mdbooth: GitHub didn't allow me to request PR reviews from the following users: stephenfin.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @stephenfin @dulek

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@stephenfin
Copy link
Member

stephenfin commented May 19, 2023

To the best of my knowledge, the only thing exposed by the nova /server/{server}/os-interface API that is not exposed by the /ports?device_id={server} API is the device tags. If you don't need those, this should be a no-op.

Edit: The code agrees.

@mdbooth
Copy link
Contributor Author

mdbooth commented May 19, 2023

To the best of my knowledge, the only thing exposed by the nova /server/{server}/os-interface API that is not exposed by the /ports?device_id={server} API is the device tags. If you don't need those, this should be a no-op.

Edit: The code agrees.

To be clear, this is a tag on the attachment, which is independent of the port. We still get port tags. I'm guessing only the former is available through the metadata service? For the purpose I had in mind I don't think it makes any difference which one we use.

@jichenjc
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 22, 2023
pkg/openstack/instances.go Outdated Show resolved Hide resolved
pkg/openstack/instances.go Outdated Show resolved Hide resolved
pkg/openstack/instancesv2.go Outdated Show resolved Hide resolved
@mdbooth
Copy link
Contributor Author

mdbooth commented May 23, 2023

/hold for @dulek's review comments.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 23, 2023
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 24, 2023
@mdbooth
Copy link
Contributor Author

mdbooth commented May 24, 2023

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 24, 2023
os-interfaces is a proxy API for neutron's ports list. This has 2
significant disadvantages to us:
* It adds the overhead of an extra API call every time it is used
* It doesn't contain all the information returned by Neutron
@kayrus
Copy link
Contributor

kayrus commented May 24, 2023

@mdbooth I don't think it's a good idea. We need to keep the interfaces order, listing neutron ports doesn't provide the exact order. See #863

@mdbooth
Copy link
Contributor Author

mdbooth commented May 24, 2023

You're thinking of server.Addresses, which preserves order. This change doesn't affect that. The API it replaces also doesn't guarantee order.

For confirmation, you can check the code which was linked above: https://github.com/openstack/nova/blob/27.1.0/nova/api/openstack/compute/attach_interfaces.py#L74-L106

Nova is simply proxying this neutron call, and returns results in the same order as neutron.

server.Addresses additionally uses Nova's internal network_info cache, which is how it preserves order.

@kayrus
Copy link
Contributor

kayrus commented May 24, 2023

@mdbooth interesting. so it looks like the neutron default order is a timestamp, right? When an interface is attached to a node, neutron creates a port and the port gets the recent timestamp. If this order corresponds to the os-interfaces order, then I'm fine with a change ;)

@dulek
Copy link
Contributor

dulek commented May 24, 2023

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 24, 2023
@mdbooth
Copy link
Contributor Author

mdbooth commented May 31, 2023

@zetaab @jichenjc Could we merge this?

Copy link
Member

@zetaab zetaab left a comment

Choose a reason for hiding this comment

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

wow this looks interesting. Thank you!

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zetaab

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 31, 2023
@k8s-ci-robot k8s-ci-robot merged commit 06f3d8c into kubernetes:master May 31, 2023
@stephenfin stephenfin deleted the nodeaddresses branch May 31, 2023 22:54
mandre pushed a commit to shiftstack/cloud-provider-openstack that referenced this pull request Feb 7, 2024
…es#2250)

os-interfaces is a proxy API for neutron's ports list. This has 2
significant disadvantages to us:
* It adds the overhead of an extra API call every time it is used
* It doesn't contain all the information returned by Neutron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants