Omer Frenkel has posted comments on this change. Change subject: core: move VM status handling to VdsManager. ......................................................................
Patch Set 1: (3 comments) http://gerrit.ovirt.org/#/c/28114/1/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java File backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/VdsManager.java: Line 89: private static Map<Guid, String> recoveringJobIdMap = new ConcurrentHashMap<Guid, String>(); Line 90: private boolean isSetNonOperationalExecuted; Line 91: private MonitoringStrategy monitoringStrategy; Line 92: private EngineLock monitoringLock; Line 93: protected List<VM> mVmList = null; we dont need the list as a class member (see my suggestion below) Line 94: public Object getLockObj() { Line 95: return _lockObj; Line 96: } Line 97: Line 826: ThreadPoolUtil.execute(new Runnable() { Line 827: @Override Line 828: public void run() { Line 829: if (vm.getStatus() == VMStatus.MigratingFrom) { Line 830: try { since we are inside the resource manager, need to replace try..catch block with just checking the return value of runVdsCommand for succeeded or not. Line 831: if (vm.getMigratingToVds() != null) { Line 832: ResourceManager.getInstance() Line 833: .runVdsCommand( Line 834: VDSCommandType.DestroyVm, Line 848: }); Line 849: } Line 850: Line 851: private void addMigratedVmsNotUpYet() { Line 852: List<VM> vmList = DbFacade.getInstance().getVmDao().getAllRunningForVds(getVdsId()); according to original code, this should be getVmDAO().getAllMigratingToHost(getVdsId()) i think now that everything is in one place we can design this a little better: change this method to: List<VM> getVmsToMoveToUnknown() { List<VM> vmList = DbFacade.getInstance().getVmDao().getAllRunningForVds( getVdsId()); List<VM> migratingVms = DbFacade.getInstance().getVmDao().getAllMigratingToHost( getVdsId()); for (VM incomingVm : migratingVms) { if (incomingVm.getStatus() == VMStatus.MigratingTo) { // this VM is finished the migration handover and is running on this host now // and should be treated as well. vmList.add(incomingVm); } } return vmList; } Line 853: for (VM incomingVm : vmList) { Line 854: if (incomingVm.getStatus() == VMStatus.MigratingTo) { Line 855: // this VM is finished the migration handover and is running on this host now Line 856: // and should be treated as well. -- To view, visit http://gerrit.ovirt.org/28114 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7304109b49a0fb8441f9fdc9aee6edb0c654ab0e Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <[email protected]> Gerrit-Reviewer: Eli Mesika <[email protected]> Gerrit-Reviewer: Omer Frenkel <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: Yair Zaslavsky <[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
