Roy Golan has posted comments on this change. Change subject: engine: VM Device Type for Display Type ......................................................................
Patch Set 7: (7 comments) .................................................... File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/utils/VmDeviceUtils.java Line 75: } Line 76: // add video device per each monitor Line 77: int monitors = entity.getSingleQxlPci() ? 1 : entity.getNumOfMonitors(); Line 78: for (int i = 0; i<monitors; i++) { Line 79: VmDeviceType vmDeviceType = osRepository.getVmDeviceType(entity.getOsId(), entity.getDefaultDisplayType()); missing Version in the API call... Line 80: addManagedDevice(new VmDeviceId(Guid.newGuid(), entity.getId()), Line 81: VmDeviceGeneralType.VIDEO, Line 82: vmDeviceType, Line 83: getMemExpr(entity.getNumOfMonitors(), entity.getSingleQxlPci()), .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/DisplayType.java Line 2: Line 3: import org.ovirt.engine.core.common.utils.VmDeviceType; Line 4: Line 5: public enum DisplayType { Line 6: vnc(VmDeviceType.VGA), Michal the change is recorded in the wiki TODO Line 7: qxl(VmDeviceType.QXL); Line 8: Line 9: private VmDeviceType defaultVmDeviceType; Line 10: .................................................... File backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepositoryImpl.java Line 175: Map<DisplayType, VmDeviceType> parseDisplayProtocols = new HashMap<DisplayType, VmDeviceType>(); Line 176: String displayProtocolValue = getValueByVersion(idToUnameLookup.get(osId), "displayProtocols", version); Line 177: Line 178: if (displayProtocolValue != null) { Line 179: String[] displayProtocolList = displayProtocolValue.split(","); pls use directly forEach and loose the unneeded boilerplate for (String candidate : displayProtocol.split(",")) { Pair<String, String> pairts = parseDisplayProtocol(candidate) // Pair will be cleaner .... the rest } parseDisplayProtocol(String candidate) { ... similar to what above } Line 180: if (displayProtocolList != null && displayProtocolList.length > 0) { Line 181: for (String displayProtocol : displayProtocolList) { Line 182: String[] displayProtocolSplit = displayProtocol.split("/"); Line 183: if (displayProtocolSplit != null && displayProtocolSplit.length == 2) { Line 175: Map<DisplayType, VmDeviceType> parseDisplayProtocols = new HashMap<DisplayType, VmDeviceType>(); Line 176: String displayProtocolValue = getValueByVersion(idToUnameLookup.get(osId), "displayProtocols", version); Line 177: Line 178: if (displayProtocolValue != null) { Line 179: String[] displayProtocolList = displayProtocolValue.split(","); pls use directly forEach and loose the unneeded boilerplate as split is null safe for (String candidate : displayProtocol.split(",")) { .... } and consider Pait<String, String> for parsing Pair<String, String> pairts = parseDisplayProtocol(candidate) Line 180: if (displayProtocolList != null && displayProtocolList.length > 0) { Line 181: for (String displayProtocol : displayProtocolList) { Line 182: String[] displayProtocolSplit = displayProtocol.split("/"); Line 183: if (displayProtocolSplit != null && displayProtocolSplit.length == 2) { Line 193: return parseDisplayProtocols; Line 194: } Line 195: Line 196: @Override Line 197: public VmDeviceType getVmDeviceType(int osId, DisplayType displayType) { getVmDeviceType is exclusive to display. This reads better osRepository.getDisplayDevice(int osId, DisplayType displayType, Version version) Line 198: VmDeviceType vmDeviceType = parseDisplayProtocols(osId, null).get(displayType); Line 199: return vmDeviceType == null ? displayType.getDefaultVmDeviceType() : vmDeviceType; Line 200: } Line 201: .................................................... File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfReader.java Line 297: protected abstract void readOsSection(XmlNode section); Line 298: Line 299: protected abstract void readHardwareSection(XmlNode section); Line 300: Line 301: protected abstract VmDeviceType getDisplayType(DisplayType displayType); name is confusing. it returns a device Line 302: Line 303: protected void readGeneralData() { Line 304: XmlNode content = _document.SelectSingleNode("//*/Content"); Line 305: XmlNode node; .................................................... File backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfVmReader.java Line 296: protected void buildNicReference() { Line 297: } Line 298: Line 299: @Override Line 300: protected VmDeviceType getDisplayType(DisplayType displayType) { method name confusing Line 301: return osRepository.getVmDeviceType(_vm.getOs(), displayType); Line 302: } Line 303: -- To view, visit http://gerrit.ovirt.org/18677 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I326f8aaf0de95332436499205f90336d2f4e73d7 Gerrit-PatchSet: 7 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Gustavo Frederico Temple Pedrosa <gustavo.pedr...@eldorado.org.br> Gerrit-Reviewer: Frank Kobzik <fkob...@redhat.com> Gerrit-Reviewer: Gustavo Frederico Temple Pedrosa <gustavo.pedr...@eldorado.org.br> Gerrit-Reviewer: Itamar Heim <ih...@redhat.com> Gerrit-Reviewer: Leonardo Bianconi <leonardo.bianc...@eldorado.org.br> Gerrit-Reviewer: Michal Skrivanek <michal.skriva...@redhat.com> Gerrit-Reviewer: Omer Frenkel <ofren...@redhat.com> Gerrit-Reviewer: Roy Golan <rgo...@redhat.com> Gerrit-Reviewer: Shahar Havivi <shav...@redhat.com> Gerrit-Reviewer: Vitor de Lima <vitor.l...@eldorado.org.br> 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