Moti Asayag has posted comments on this change. Change subject: engine: refreshing host devices on engine startup ......................................................................
Patch Set 5: (4 comments) https://gerrit.ovirt.org/#/c/39893/5/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdev/HostDeviceManager.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/hostdev/HostDeviceManager.java: Line 16: @ApplicationScoped Line 17: public class HostDeviceManager { Line 18: Line 19: @Inject Line 20: private VdsDAO vdsDao; s/vdsDao/hostDao Line 21: Line 22: @Inject Line 23: private BackendInternal backend; Line 24: Line 27: vdsDao.getAll() you don't need the vdsDao.getAll() for the function needs. It is too 'heavy' for this purpose. Instead please use VdsDynamic which provides you both host id and host status. Line 23: private BackendInternal backend; Line 24: Line 25: public void init() { Line 26: ArrayList<VdcActionParametersBase> parameters = new ArrayList<>(); Line 27: for (VDS vds : vdsDao.getAll()) { s/vds/host Line 28: // It is sufficient to refresh only the devices of 'UP' hosts since other hosts Line 29: // will have their devices refreshed in InitVdsOnUpCommand Line 30: if (vds.getStatus().equals(VDSStatus.Up)) { Line 31: parameters.add(new VdsActionParameters(vds.getId())); Line 26: ArrayList<VdcActionParametersBase> parameters = new ArrayList<>(); Line 27: for (VDS vds : vdsDao.getAll()) { Line 28: // It is sufficient to refresh only the devices of 'UP' hosts since other hosts Line 29: // will have their devices refreshed in InitVdsOnUpCommand Line 30: if (vds.getStatus().equals(VDSStatus.Up)) { since deals with enum - please compare using == instead of equals. Line 31: parameters.add(new VdsActionParameters(vds.getId())); Line 32: } Line 33: } Line 34: backend.runInternalMultipleActions(VdcActionType.RefreshHostDevices, parameters); -- To view, visit https://gerrit.ovirt.org/39893 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I69745e4e4860681252a06a494a5d2c7bd2ce1153 Gerrit-PatchSet: 5 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Alona Kaplan <[email protected]> Gerrit-Reviewer: Alona Kaplan <[email protected]> Gerrit-Reviewer: Arik Hadas <[email protected]> Gerrit-Reviewer: Martin Betak <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: Omer Frenkel <[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
