Liron Aravot has posted comments on this change. Change subject: core: Prevent VM migration when SCSI reservation is used ......................................................................
Patch Set 9: (3 comments) https://gerrit.ovirt.org/#/c/37664/9/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java: Line 378: } Line 379: Line 380: VmValidator vmValidator = new VmValidator(vm); Line 381: ValidationResult validationResult = vmValidator.isVmPluggedDiskUsingScsiReservation(); Line 382: if (validationResult != ValidationResult.VALID) { please use the standard format for checking validate(Validation result..) Line 383: return failCanDoAction(validationResult.getMessage()); Line 384: } Line 385: Line 386: switch (vm.getStatus()) { https://gerrit.ovirt.org/#/c/37664/9/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmDiskCommand.java: Line 680: return readOnlyNewValue != null && !getVmDeviceForVm().getIsReadOnly().equals(readOnlyNewValue); Line 681: } Line 682: Line 683: private boolean updateIsUsingScsiReservationRequested(LunDisk lunDisk) { Line 684: return getVmDeviceForVm().isUsingScsiReservation() != Boolean.TRUE.equals(lunDisk.isUsingScsiReservation()); this won't work. let's assume that we get null in lunDisk.isUsingScsiReservation() while getVmDeviceForVm().isUsingScsiReservation() is true. this method will return true and in line 411 we'll get a NPE. the code here should kind of similar to the code of updateReadOnlyRequested() Line 685: } Line 686: Line 687: protected boolean updateWipeAfterDeleteRequested() { Line 688: return getNewDisk().isWipeAfterDelete() != getOldDisk().isWipeAfterDelete(); https://gerrit.ovirt.org/#/c/37664/9/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/LunDisk.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/LunDisk.java: Line 50: @Override Line 51: public int hashCode() { Line 52: final int prime = 31; Line 53: int result = super.hashCode(); Line 54: result = prime * result + (Boolean.TRUE.equals(usingScsiReservation) ? 1231 : 1237); I'd prefer an implementation similar to line 55 here. Line 55: result = prime * result + ((lun == null) ? 0 : lun.hashCode()); Line 56: return result; Line 57: } Line 58: -- To view, visit https://gerrit.ovirt.org/37664 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia38c03dae04c9dbb30c882941391b1909f5af416 Gerrit-PatchSet: 9 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Ala Hino <ah...@redhat.com> Gerrit-Reviewer: Adam Litke <ali...@redhat.com> Gerrit-Reviewer: Ala Hino <ah...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Amit Aviram <aavi...@redhat.com> Gerrit-Reviewer: Candace Sheremeta <csher...@redhat.com> Gerrit-Reviewer: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Freddy Rolland <rolla...@gmail.com> Gerrit-Reviewer: Greg Padgett <gpadg...@redhat.com> Gerrit-Reviewer: Idan Shaby <ish...@redhat.com> Gerrit-Reviewer: Liron Aravot <lara...@redhat.com> Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com> Gerrit-Reviewer: Nir Soffer <nsof...@redhat.com> Gerrit-Reviewer: Tal Nisan <tni...@redhat.com> Gerrit-Reviewer: Tomas Jelinek <tjeli...@redhat.com> Gerrit-Reviewer: Vered Volansky <vvola...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches