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

Creating a model with a single valued optional referential value panics. #216

Closed
alexanderConstantinescu opened this issue Aug 18, 2021 · 1 comment · Fixed by #220
Closed

Comments

@alexanderConstantinescu
Copy link
Contributor

alexanderConstantinescu commented Aug 18, 2021

.Create() currently panics if the model created specifies a single valued optional referential value, ex: create a logical router static route as:

 nbdb.LogicalRouterStaticRoute{
		UUID:   logicalRouterStaticRouteNamedUUID,
		Policy: &nbdb.LogicalRouterStaticRoutePolicySrcIP,
                BFD: &myBFDUUID, 
	}

It will panic with the following stack trace:

panic: interface conversion: interface {} is *string, not []string

goroutine 1429 [running]:
github.com/ovn-org/libovsdb/ovsdb.NativeToOvs(0xc00a99b230, 0x24aa1e0, 0xc006366160, 0x24aa100, 0xc006366160, 0x0, 0x0)
        /home/aconstan/go/src/github.com/ovn-org/ovn-kubernetes/go-controller/vendor/github.com/ovn-org/libovsdb/ovsdb/bindings.go:257 +0x1147
github.com/ovn-org/libovsdb/mapper.Mapper.NewRow(0xc00cc4f380, 0x27bb8c0, 0x1b, 0x248bca0, 0xc009a04fc0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
        /home/aconstan/go/src/github.com/ovn-org/ovn-kubernetes/go-controller/vendor/github.com/ovn-org/libovsdb/mapper/mapper.go:155 +0x614
github.com/ovn-org/libovsdb/client.api.Create(0xc00634bb30, 0x0, 0x0, 0xc0063662e0, 0x1, 0x1, 0x10, 0xc00f90f060, 0x44164b, 0x418980, ...)
        /home/aconstan/go/src/github.com/ovn-org/ovn-kubernetes/go-controller/vendor/github.com/ovn-org/libovsdb/client/api.go:254 +0x466
github.com/ovn-org/libovsdb/client.(*ovsdbClient).Create(0xc00f44db80, 0xc0063662e0, 0x1, 0x1, 0x248bca0, 0xc009a04fc0, 0x27cb71f, 0x25, 0xc0063662d0)
        /home/aconstan/go/src/github.com/ovn-org/ovn-kubernetes/go-controller/vendor/github.com/ovn-org/libovsdb/client/client.go:592 +0x90

It since LogicalRouterStaticRoute.BFD is optional, it will be parsed as a set https://github.com/ovn-org/libovsdb/blob/main/ovsdb/schema.go#L531, this is however not handled properly it seems in bindings (which always assumes a slice of referential values): https://github.com/ovn-org/libovsdb/blob/main/ovsdb/bindings.go#L257

@flavio-fernandes
Copy link
Contributor

@dave-tucker : Is it proper to assume that this issue introduced by #204 ?

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

Successfully merging a pull request may close this issue.

2 participants