Eli Mesika has posted comments on this change. Change subject: [WIP] core: Prevent dead lock on vm device (#852451) ......................................................................
Patch Set 1: (3 inline comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotPlugDiskToVmCommand.java Line 70: if (getVm().getstatus() == VMStatus.Up) { Line 71: performPlugCommnad(getPlugAction(), disk, oldVmDevice); Line 72: } Line 73: Line 74: //Update boot order and and isPlugged flag Line 75: final List<VmDevice> devices = VmDeviceUtils.updateBootOrderInVmDevice(getVm().getStaticData()); Line 76: for (VmDevice device:devices) { Line 77: if (device.getDeviceId().equals(oldVmDevice.getDeviceId())) { Line 78: device.setIsPlugged(!oldVmDevice.getIsPlugged()); .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java Line 329: * @return the updated VmDevice list Line 330: */ Line 331: public static List<VmDevice> updateBootOrderInVmDevice(VmBase vmBase) { Line 332: if (vmBase instanceof VmStatic) { Line 333: //Returns the devices sorted in ascending manner manner => order Line 334: List<VmDevice> devices = dao.getVmDeviceByVmId(vmBase.getId()); Line 335: // reset current boot order Line 336: for (VmDevice device: devices) { Line 337: device.setBootOrder(0); .................................................... File backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsUpdateRunTimeInfo.java Line 177: } Line 178: Line 179: private void saveVmDevicesToDb() { Line 180: //Sort VM devices in ascending order Line 181: List<VmDevice> sortedVmDevices = new ArrayList<VmDevice>(); Why should we use a comparator and sort those devices at all if when we get those devices from DB we can get them sorted already as we wish ??? Line 182: sortedVmDevices.addAll(vmDeviceToSave.values()); Line 183: sortVmDeviceList(sortedVmDevices); Line 184: updateAllInTransaction(sortedVmDevices, getDbFacade().getVmDeviceDAO()); Line 185: -- To view, visit http://gerrit.ovirt.org/7641 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: If316259f9760777c5f85db0880a157021c61a6ba Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Michael Kublin <mkub...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches