Description of problem: I tried to add a new VM to an existing affinity group with: ``` SystemService(). ClustersService(). ClusterService(cID). AffinityGroupsService(). GroupService(ag.MustId()). VmsService(). Add(). Vm(vm).Send() ``` and that call always returned an error in my go code: "Tag not matched: expect <vm> but got <action>" When I looked at the VM on the engine I saw that the VM was added to the affinity group successfully. I tried to run a POST request to the engine to add the VM to the affinity group, and got a 200 status with body: ``` <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <action> <status>complete</status> </action> ``` When I looked in the go-ovirt code on services.go line 2429 I saw: ``` result, err := XMLVmReadOne(reader, nil, "") ``` And when you look at the "XMLVmReadOne" you see: ``` if expectedTag == "" { expectedTag = "vm" } if start.Name.Local != expectedTag { return nil, XMLTagNotMatchError{start.Name.Local, expectedTag} } ``` Meaning because on the "AffinityGroupVmsServiceAddRequest" we sent an expectedTag on "" then it tried to find a "vm" tag and returned an error. As I see it there are 2 solutions: 1. call "XMLVmAffinityReadOne" function instead of "XMLVmReadOne" - XMLVmAffinityReadOne doesn'y have an expected tag logic 2. change the expectedTag to be "action" and not "" meaning: ``` result, err := XMLVmReadOne(reader, nil, "action") ``` Since the go-ovirt sdk is generated I think that this problem is much bigger then the go-ovirt sdk, and probably starts at the original SDK of ovirt
According to Ori: > I've found the problem, it is here: > https://github.com/oVirt/ovirt-engine/blob/68721ead04cef0378937cd331fae3170b4c275ba/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendAffinityGroupVmsResource.java#L39 > editAffinityGroup() indeed returns an Action, incongruent with the declaration in the AffinityGroupVmsService.java. > So the bug should actually be on ovirt-engine
Ori, wouldn't it be considered breaking backward compatibility if we change it now?
Can't we just change the SDKs/API to return action instead? https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/services/AffinityGroupVmsService.java#L68
(In reply to Gal Zaidman from comment #3) > Can't we just change the SDKs/API to return action instead? > https://github.com/oVirt/ovirt-engine-api-model/blob/master/src/main/java/ > services/AffinityGroupVmsService.java#L68 I think that's the only thing we can actually do - since we guarantee not to break existing clients so if we used to return an action, we should keep doing that but I'd like to check this with Ori
I think it's not considered breaking backwards-compatibility, because we are fixing a bug. I mean, it never worked as documented and intended. Also, this is happening at the 3rd level of the API tree (Clusters -> Affinity-Groups -> Vms), I can't imagine that there's tons of scripts out there messing with this. I think it's ok to fix it and return Vms instead of Action. (by the way in case anyone is wondering how this but is possible in a type-safe language (Java) - the reason is that the return value is always wrapped in a Response object)
verified on ovirt-engine-4.4.5.9-0.1.el8ev.noarch POST https://{{host}}/ovirt-engine/api/clusters/{clusterId}/affinitygroups/{affinityGroupId}/vms body <vm id="ae1b93a1-f504-48ec-bec2-ec95e269e95d"/> Returns response : <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <vm id="ae1b93a1-f504-48ec-bec2-ec95e269e95d"/> and not <action> as it was on the previous version
This bugzilla is included in oVirt 4.4.5 release, published on March 18th 2021. Since the problem described in this bug report should be resolved in oVirt 4.4.5 release, it has been closed with a resolution of CURRENT RELEASE. If the solution does not work for you, please open a new bug report.