Allon Mureinik has posted comments on this change. Change subject: core: sync luns info after ConnectStorageServer ......................................................................
Patch Set 7: Code-Review-1 (5 comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/SyncLunsInfoForIscsiStorageDomainCommand.java Line 16: import org.ovirt.engine.core.utils.transaction.TransactionSupport; Line 17: Line 18: /** Line 19: * Synchronize LUN details comprising the storage domain with the DB Line 20: */ what about locking? Line 21: @InternalCommandAttribute Line 22: @NonTransactiveCommandAttribute(forceCompensation = true) Line 23: public class SyncLunsInfoForIscsiStorageDomainCommand<T extends StorageDomainParametersBase> extends StorageDomainCommandBase<T> { Line 24: Line 45: Line 46: setSucceeded(true); Line 47: } Line 48: Line 49: protected void refreshLunsInfo(List<LUNs> lunsFromVgInfo, List<LUNs> lunsFromDb) { I'd take a much simpler approach - remove 'em all, and write the new ones - no fuss, no bugs :-) Line 50: for (LUNs lunFromVgInfo : lunsFromVgInfo) { Line 51: // Update LUN Line 52: if (getLunDao().get(lunFromVgInfo.getLUN_id()) == null) { Line 53: getLunDao().save(lunFromVgInfo); .................................................... File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/SyncLunsInfoForIscsiStorageDomainCommandTest.java Line 22: private SyncLunsInfoForIscsiStorageDomainCommand<StorageDomainParametersBase> command; Line 23: private StorageDomainParametersBase parameters; Line 24: Line 25: @Before Line 26: public void setup() { how about calling it setUp() ? Line 27: parameters = new StorageDomainParametersBase(Guid.newGuid()); Line 28: parameters.setVdsId(Guid.newGuid()); Line 29: Line 30: command = spy(new SyncLunsInfoForIscsiStorageDomainCommand<StorageDomainParametersBase>(parameters)); Line 54: List<LUNs> lunsFromVgInfo = Collections.singletonList(lunFromVG); Line 55: List<LUNs> lunsFromDb = Collections.singletonList(lunFromDB); Line 56: Line 57: boolean isMismatch = command.isLunsInfoMismatch(lunsFromVgInfo, lunsFromDb); Line 58: assertTrue(isMismatch); please add a message to the assert. Line 59: } Line 60: Line 61: @Test Line 62: public void lunsMatch() { Line 67: List<LUNs> lunsFromVgInfo = Arrays.asList(lun, lun); Line 68: List<LUNs> lunsFromDb = Arrays.asList(lun, lun); Line 69: Line 70: boolean isMismatch = command.isLunsInfoMismatch(lunsFromVgInfo, lunsFromDb); Line 71: assertFalse(isMismatch); please add a message to the assert. Line 72: } -- To view, visit http://gerrit.ovirt.org/17919 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5867ad8d36f329e23c611079512be30a9c5f83a5 Gerrit-PatchSet: 7 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Daniel Erez <de...@redhat.com> Gerrit-Reviewer: Alissa Bonas <abo...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> 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