Omer Frenkel has posted comments on this change. Change subject: core: add support to update running vm ......................................................................
Patch Set 11: (5 comments) http://gerrit.ovirt.org/#/c/26758/11/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmHandler.java: Line 135: return mUpdateVmsStatic.IsUpdateValid(source, destination); Line 136: } Line 137: Line 138: public static boolean copyNonEditableFieldsToDestination(VmStatic source, VmStatic destination) { Line 139: return mUpdateVmsStatic.copyNonEditableFieldsToDestination(source, destination); > the return value isn't being used. should it? good question, i probably should fail updateVm completely if this fails. Line 140: } Line 141: Line 142: /** Line 143: * Verifies the add vm command . http://gerrit.ovirt.org/#/c/26758/11/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmPoolHandler.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/VmPoolHandler.java: Line 69: */ Line 70: private static void ApplyNextRunConfiguration(Guid vmId) { Line 71: // Remove snpashot first, in case other update is in progress, it will block this one with exclusive lock Line 72: // and any newer update should be preffered to this one. Line 73: Snapshot runSnap = DbFacade.getInstance().getSnapshotDao().get(vmId, SnapshotType.NEXT_RUN); > can we just go and remove the snapshot and spare the roundtrip to fetch it? but anyway i need the configuration from the snapshot, so it getting from the db is a must Line 74: if (runSnap != null) { Line 75: DbFacade.getInstance().getSnapshotDao().remove(runSnap.getId()); Line 76: VM vm = DbFacade.getInstance().getVmDao().get(vmId); Line 77: if (vm != null) { Line 83: vm.setExportDate(null); Line 84: vm.setOvfVersion(null); Line 85: Line 86: VmManagementParametersBase updateVmParams = createUpdateVmParameters(vm); Line 87: vm.getManagedVmDeviceMap().clear(); > why is this needed? I don't see the vm object in use later it is in the updateVmCommand params, and it is a non-updatable field, so it must be cleared, i will move it into the createUpdateVmParameters method Line 88: vm.getVmUnamagedDeviceList().clear(); Line 89: Backend.getInstance().runInternalAction(VdcActionType.UpdateVm, updateVmParams); Line 90: } Line 91: } http://gerrit.ovirt.org/#/c/26758/11/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java: Line 155: Line 156: @CopyOnNewVersion Line 157: @EditableField Line 158: @Size(max = BusinessEntitiesDefinitions.GENERAL_MAX_SIZE) Line 159: private String isoPath; > what is the effect of changing this while VM runs? there is a question about this also in the design wiki, today you can changeCD for a running vm, but not using edit vm, we need to think if this should be merged or not Line 160: Line 161: private OriginType origin; Line 162: Line 163: @CopyOnNewVersion http://gerrit.ovirt.org/#/c/26758/11/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ObjectIdentityChecker.java File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ObjectIdentityChecker.java: Line 111: * @param destination object to copy the non editable to it Line 112: */ Line 113: public boolean copyNonEditableFieldsToDestination(Object source, Object destination) { Line 114: Class<?> cls = source.getClass(); Line 115: while (!cls.equals(Object.class)) { > is this check necessary? yes, because we start in vmStatic, then in line 132 getting superClass (vmBase) and there is no need to check the object class fields Line 116: for (Field srcFld : cls.getDeclaredFields()) { Line 117: try { Line 118: if (!Modifier.isFinal(srcFld.getModifiers()) && !IsFieldUpdatable(srcFld.getName())) { Line 119: srcFld.setAccessible(true); -- To view, visit http://gerrit.ovirt.org/26758 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie433352852f53f62e58349ce85475ee89e37ce89 Gerrit-PatchSet: 11 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Omer Frenkel <[email protected]> Gerrit-Reviewer: Arik Hadas <[email protected]> Gerrit-Reviewer: Michal Skrivanek <[email protected]> Gerrit-Reviewer: Omer Frenkel <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: [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
