vmware / go-vcloud-director

Golang SDK for VMware Cloud Director
Other
82 stars 75 forks source link

BUG: can't update EGW - there is no ownerRef field #395

Closed lelvisl closed 3 years ago

lelvisl commented 3 years ago

Struct from https://github.com/vmware/go-vcloud-director/blob/v2.12.1/types/v56/nsxt_types.go#L5 doesn't have field ownerRef.

vCloud doesn't accept requests without this field

  "message": "[ 9ef3aa8c-e7fc-4377-9a63-e68479f83340 ] Invalid owner specified for edge gateway demo-kazaryan-nw-02-edge. Owner must be a organization vDC or vDC Group."

Result: method https://github.com/vmware/go-vcloud-director/blob/v2.12.1/govcd/nsxt_edgegateway.go#L137 not working at all.

Workaround: i continue to maintain my fork 🙂

Didainius commented 3 years ago

Hello, Thanks for the bug, but I need more details - which version of vcd and are tou overriding api version?

I think we do have tests and it used to work for all supported vcd versions.

Edit - are you using vDC groups? The support for them is not yet baked in, but if it is only a field you are missing - it is easy to put it in :)

lelvisl commented 3 years ago

35/36 version and vcd 10.3. in this org i'm not using vDC groups. i added this to OpenAPIEdgeGateway

    OwnerRef *OpenApiReference `json:"ownerRef,omitempty"`

and all works well (quick ip allocation in my case). you can test by opening https://your.vcloud/api-explorer/provider#/edgeGateway/updateEdgeGateway and add/remove ownerRef field.

About vDC groups - now it's just manual use in ui for future. But in several weeks i'm planing to use them from my code.

Didainius commented 3 years ago

Is this the only thing that keeps you having the fork? We can surelly add this field here

BTW - what kind of project are you working on using the SDK?

lelvisl commented 3 years ago

No, i have some problems with quering vm, working with storage policies. https://github.com/vmware/go-vcloud-director/issues/373 And i want to do something with admin/non-admin objects. https://github.com/vmware/go-vcloud-director/issues/384 Some additional nsx-t funcs - (firewall,nat) i wrote earlier outside of this lib (using OpenApiGetItem and same client methods), and preparing to migrate to library.

If you can add this field - it will be very cool! (using omitempty - i think it will be backcompatible). Or i can make a PR.

lelvisl commented 3 years ago

About my project - internal project, some kind of aggregate web portal with IaaS (k8s/vcd) and some functions on top of them.

Didainius commented 3 years ago

If you can add this field - it will be very cool! (using omitempty - i think it will be backcompatible). Or i can make a PR.

If you can just make that PR with a small note in changelog (.changes/v2.13.0)- no additional testing is required here from us so I will approve.

About my project - internal project, some kind of aggregate web portal with IaaS (k8s/vcd) and some functions on top of them.

Sounds great!