
Eli Mesika has submitted this change and it was merged. Change subject: engine: AddVdsSpmIdCommand throw exception when... ...................................................................... engine: AddVdsSpmIdCommand throw exception when... AddVdsSpmIdCommand throw exception when trying to edit cluster and we have more than one host attached to these cluster. The bug is regression caused by commit 4b9a4cfaee613e3254735f06df339840ebc8c4fc. The problem is the following: UpdateVdsGroupCommand running inside transaction. canDoAction() of AddVdsSpmIdCommand is running outside those transaction. In canDoAction() was retrieved a list of already existed spm_ids. execute() of AddVdsSpmIdCommand is running inside same transaction as UpdateVdsGroupCommand. As a result a second AddVdsSpmIdCommand is retrieving a list of spm_ids but with out id inserted by first AddVdsSpmIdCommand, because of it is still not committed and canDoAction() is running outside transaction. Solution: move appropriate logic to execute(). Also for internal command there are no meaning to put some checks inside canDoAction(), the internal command is not logged and a result of canDoAction() will not be passed to client. Change-Id: I7f8aa6b6cb3dfc1508a99c53553afc2e15009b68 Signed-off-by: Michael Kublin <mkublin@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVdsSpmIdCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVdsGroupCommand.java 2 files changed, 27 insertions(+), 26 deletions(-) Approvals: Eli Mesika: Verified; Looks good to me, approved -- To view, visit http://gerrit.ovirt.org/11271 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7f8aa6b6cb3dfc1508a99c53553afc2e15009b68 Gerrit-PatchSet: 4 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emesika@redhat.com> Gerrit-Reviewer: Eli Mesika <emesika@redhat.com> Gerrit-Reviewer: Michael Kublin <mkublin@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofrenkel@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzaslavs@redhat.com>