Eli Mesika has submitted this change and it was merged. Change subject: core: Prevent dead lock on vm device (#852451) ......................................................................
core: Prevent dead lock on vm device (#852451) https://bugzilla.redhat.com/852451 This patch should be tested for regressions by pre-integration. The following patch solved a dead lock on vm device: Both VdsUpdateRuntimeInfo and HotPlugDisk update a collection of VmDevices. The devices are unordered, so a dead lock may occur. This patch solves the issue the following way: a. Orders VM devices fetched from DB (uses device_id as sorting column). b. Changes HotplugDisk to perform update for both plugged flag and boot order in the same area of code c. Changes HotplugDisk to update only boot order and plugged fields of vm device d. Changes VdsUpdateRuntime info to update only the alias and address fields c and d are performed in order to avoid data races between the two concurrent flows We have discussed about using an optimistic lock mechanism at first, but using c and d , lets us have a KISS approach to the solution Change-Id: If316259f9760777c5f85db0880a157021c61a6ba Signed-off-by: Yair Zaslavsky <yzasl...@redhat.com> Signed-off-by: Eli Mesika <emes...@redhat.com> --- M backend/manager/dbscripts/vm_device_sp.sql M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AttachDiskToVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/DetachDiskFromVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotPlugDiskToVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java M backend/manager/modules/common/src/test/java/org/ovirt/engine/core/common/businessentities/VmDeviceTest.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/MassOperationsDao.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/MassOperationsGenericDaoDbFacade.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDeviceDAO.java M backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/VmDeviceDAODbFacadeImpl.java M backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VmDeviceDAOTest.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java 13 files changed, 217 insertions(+), 42 deletions(-) Approvals: Eli Mesika: Verified; Looks good to me, approved -- To view, visit http://gerrit.ovirt.org/7641 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: If316259f9760777c5f85db0880a157021c61a6ba Gerrit-PatchSet: 7 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Barak Azulay <bazu...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Michael Kublin <mkub...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: oVirt Jenkins CI Server _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches