Sergey Gotliv has posted comments on this change.
Change subject: engine: Split update of 'isPlugged' and 'bootOrder'
properties...
......................................................................
Patch Set 3:
(4 comments)
....................................................
Commit Message
Line 7: engine: Split update of 'isPlugged' and 'bootOrder' properties...
Line 8:
Line 9: HotPlugDiskToVmCommand updates 'isPlugged' and 'bootOrder' of all
Line 10: devices attached to any particular VM. It should update 'isPlugged'
only
Line 11: for device that was plugged in this command, otherwise it can cause a
Done
Line 12: race with another thread which handles the hot plug of another disk for
Line 13: the same VM.
Line 14:
Line 15: Change-Id: I1359a34a48a6261e22631ff1640d81d735e8c490
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/HotPlugDiskToVmCommand.java
Line 31: private VmDevice oldVmDevice;
Line 32:
Line 33: public HotPlugDiskToVmCommand(T parameters) {
Line 34: super(parameters);
Line 35: disk = getDiskDao().get(getParameters().getDiskId());
Maybe I am an old fashion but once constructor was a good place to initialize
things!
I'll move it to lazy getter.
Line 36: }
Line 37:
Line 38: @Override
Line 39: protected void setActionMessageParameters() {
Line 79: }
Line 80:
Line 81: oldVmDevice = getVmDeviceDao().get(new
VmDeviceId(disk.getId(), getVmId()));
Line 82: if (getPlugAction() == VDSCommandType.HotPlugDisk &&
oldVmDevice.getIsPlugged()) {
Line 83: return
failCanDoAction(VdcBllMessages.HOT_PLUG_DISK_IS_NOT_UNPLUGGED);
Done
Line 84: }
Line 85:
Line 86: if (getPlugAction() == VDSCommandType.HotUnPlugDisk &&
!oldVmDevice.getIsPlugged()) {
Line 87: return
failCanDoAction(VdcBllMessages.HOT_UNPLUG_DISK_IS_NOT_PLUGGED);
Line 108: TransactionSupport.executeInNewTransaction(new
TransactionMethod<Void>() {
Line 109: @Override
Line 110: public Void runInTransaction() {
Line 111:
getVmStaticDAO().incrementDbGeneration(getVm().getId());
Line 112:
getVmDeviceDao().updateAll("UpdateVmDeviceForHotPlugDisk",
Arrays.asList(device));
Done
Line 113: getVmDeviceDao().updateAll("UpdateVmDeviceBootOrder",
devices);
Line 114: return null;
Line 115: }
Line 116: });
--
To view, visit http://gerrit.ovirt.org/19311
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I1359a34a48a6261e22631ff1640d81d735e8c490
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sergey Gotliv <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Omer Frenkel <[email protected]>
Gerrit-Reviewer: Sergey Gotliv <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches