Frank Kobzik has posted comments on this change. Change subject: core: add graphics device to management classes ......................................................................
Patch Set 30: (4 comments) Damn, I only noticed newer comments. Have a coffe, I'm going to address the older ones too. http://gerrit.ovirt.org/#/c/28567/30/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java: Line 310: private void updateGraphicsDevice() { Line 311: for (GraphicsType type : GraphicsType.values()) { Line 312: if (!getParameters().getGraphicsDevices().containsKey(type)) { Line 313: continue; Line 314: } > can we iterate the keys instead? Yes, we can :) Line 315: Line 316: GraphicsDevice vmGraphicsDevice = getGraphicsDevOfType(type); Line 317: if (vmGraphicsDevice == null) { Line 318: if (getParameters().getGraphicsDevices().get(type) != null) { Line 336: // first dev or null Line 337: private GraphicsDevice getGraphicsDevOfType(GraphicsType type) { Line 338: VdcQueryReturnValue query = Line 339: getBackend().runInternalQuery(VdcQueryType.GetGraphicsDevices, new IdQueryParameters(getParameters().getVmId())); Line 340: List<GraphicsDevice> graphicsDevices = query.getReturnValue(); > it seems that for each type of graphics device we query the DB with the sam Ok, I'll do my best. Line 341: Line 342: for (GraphicsDevice dev : graphicsDevices) { Line 343: if (dev.getGraphicsType() == type) { Line 344: return dev; http://gerrit.ovirt.org/#/c/28567/30/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmTemplateCommand.java: Line 417: return dev; Line 418: } Line 419: } Line 420: Line 421: return null; > same as for the VM - how about caching the query result? same as ^ Line 422: } Line 423: http://gerrit.ovirt.org/#/c/28567/30/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmTemplateParametersBase.java File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/action/VmTemplateParametersBase.java: Line 158: * Helper method for determining which graphics types are supposed to be set for the template. Line 159: * Line 160: * @return graphics types of graphics devices that will be set to the template. Line 161: */ Line 162: public Set<GraphicsType> graphicsTypesToBeSet() { > is it ever being used? Actually, no. In the end I used static methods in VmHandler for dealing with this. So similar method is unneeded in VmManagementParamsBase too. Line 163: HashSet<GraphicsType> result = new HashSet<GraphicsType>(); Line 164: Line 165: for (GraphicsType graphicsType : GraphicsType.values()) { Line 166: if (graphicsDevices.get(graphicsType) != null) { -- To view, visit http://gerrit.ovirt.org/28567 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I39c84ce94cd3cb52286c52d765a389e69c9b0e62 Gerrit-PatchSet: 30 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Frank Kobzik <fkob...@redhat.com> Gerrit-Reviewer: Arik Hadas <aha...@redhat.com> Gerrit-Reviewer: Frank Kobzik <fkob...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@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