-
Notifications
You must be signed in to change notification settings - Fork 347
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
Add generated code using libovsdb #2217
Conversation
Testing wise, I'm looking at the one or all of the following options: a) a b) a c) using two real ovsdb servers |
What I think it would be really cool is using something like https://github.com/ory/dockertest to setup the databases to interact with. |
@dave-tucker I've checked out this PR and the code doesn't compile because you have to do Another thing, is that I think that we shouldn't try to do this in one shot, it is too complex to replace all the go-ovn bindings, is there any incompatibility if we checkout first the support for libovsdb and we start to migrate things one by one? |
@aojea there is no incompatibility, but I wouldn't recommend releasing or using a version that has both go-ovn and libovsdb in parallel. Both will retain an in-memory copy of all tables monitored in the nbdb and sbdb. Effectively we'll have a lot higher memory usage (especially on large dbs) until we migrate away from go-ovn. I can certainly make this PR just to add generation for now so it's smaller. Then I could look at porting one or two usages over to the new bindings. |
ah, ok, right, I forgot that
also I think we can spread the load and we can start playing/learning |
I am happy to try and help here as well if we would like to divide and conquer :) |
/retest |
Updated to tip of |
v0.4.0 tagged, updated PR with appropriate versions |
/retest |
Update: I found a few issues when doing #2262 so I'll merge some fixes in libovsdb, tag a new version and update this PR shortly |
This adds a gen.go in each package that will use modelgen from libovsdb to populate the packages based on the content of the schema Signed-off-by: Dave Tucker <[email protected]>
To reproduce, run ./hack/update-codegen Signed-off-by: Dave Tucker <[email protected]>
@trozet this should be good to go |
Update: Included the util functions from #2262 the |
Signed-off-by: Dave Tucker <[email protected]>
Signed-off-by: Dave Tucker <[email protected]>
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.
/lgtm
thanks @dave-tucker !
cd "${builddir}" | ||
GO111MODULE=on go install github.com/ovn-org/libovsdb/cmd/[email protected] | ||
cd "${olddir}" | ||
if [[ "${builddir}" == /tmp/* ]]; then #paranoia |
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.
lol
# generate ovsdb bindings | ||
if ! ( command -v modelgen > /dev/null ); then | ||
echo "modelgen not found, installing github.com/ovn-org/libovsdb/cmd/modelgen" | ||
olddir="${PWD}" |
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.
pushd/popd is easier to use, no need to change this though
OCPBUGS-33758,OCPBUGS-35347,SDN-4919,OCPBUGS-35367,OCPBUGS-33758,SDN-5011: Downstream Merge: July 2nd
- What this PR does and why is it needed
Checks in generated code that can be used to communicate with OVN via
ovn-org/libovsdb
.Version 20.12 of the nb/db schemas were used for generation.
There is documentation on how to use the library on https://github.com/ovn-org/libovsdb
The intention is for this to be used in place of
go-ovn
The benefit to using
libovsdb
is that enables generic CRUD (and mutate) operations using the generated structs.If at any point you need a new field, you can quickly regenerate code using a newer schema version.
- Special notes for reviewers
This is code-generation only.
No usage of this library yet.
Also, we avoid import conflicts with
ebay/go-ovn
as it's usingebaylibovsdb
.- How to verify it
CI will pass. You can see the testing that has been done over at https://github.com/ovn-org/libovsdb
- Description for the changelog