Juan Hernandez has posted comments on this change. Change subject: REST API: Adding external status to API ......................................................................
Patch Set 6: (4 comments) https://gerrit.ovirt.org/#/c/40997/6/backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd File backend/manager/modules/restapi/interface/definition/src/main/resources/api.xsd: Line 1921: <xs:sequence> Line 1922: <xs:element name="address" type="xs:string" minOccurs="0"/> Line 1923: <xs:element ref="certificate" minOccurs="0" maxOccurs="1"/> Line 1924: <xs:element ref="status" minOccurs="0" maxOccurs="1"/> Line 1925: <xs:element name="external_status" type="xs:string" minOccurs="0" maxOccurs="1"/> The RESTAPI already uses a "status" element for the internal status. That element uses the "Status" complex type. That complex type supports a "state" enum-like string and a free text "detail" field. Please reuse that complex type here: <xs:element name="external_status" type="Status" .../> That way users of the SDKs won't need to understand how to deal with two different "status" data structures. Line 1926: <xs:element name="cluster" type="Cluster" minOccurs="0"/> Line 1927: <!-- unsigned to avoid issues with port values greater than 32767, Line 1928: e.g. the standard VDSM port 54321 --> Line 1929: <xs:element name="port" type="xs:unsignedShort" minOccurs="0"/> Line 2035: </xs:appinfo> Line 2036: </xs:annotation> Line 2037: </xs:element> Line 2038: </xs:sequence> Line 2039: </xs:complexType> Fix indentation before merging: 2 spaces per level. Line 2040: Line 2041: <xs:element name="host_protocols" type="HostProtocols"/> Line 2042: Line 2043: <xs:complexType name="HostProtocols"> https://gerrit.ovirt.org/#/c/40997/6/backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendEventsResource.java File backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendEventsResource.java: Line 88: Line 89: } Line 90: return performCreate(VdcActionType.AddExternalEvent, Line 91: new AddExternalEventParameters(map(event), null), Line 92: new QueryIdResolver<Long>(VdcQueryType.GetAuditLogById, GetAuditLogByIdParameters.class)); Consider re-formatting this so that first you create the parameters object and then call "performCreate" only once: AddExternalEventParameters parameters = new ...(); if (event.isSetHost() && event.getHost().isSetExternalStatus()) { parameter.setExternalStatus(...); } return performCreate(...); Line 93: Line 94: } Line 95: Line 96: @Override https://gerrit.ovirt.org/#/c/40997/6/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostMapper.java File backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/HostMapper.java: Line 200: HostStatus status = map(entity.getStatus(), null); Line 201: model.setStatus(StatusUtils.create(status)); Line 202: if (entity.getExternalStatus() != null) { Line 203: EntityExternalStatus entityExternalStatus = map(entity.getExternalStatus(), null); Line 204: model.setExternalStatus(entityExternalStatus.name()); This should be "entityExternalStatus.value()". Line 205: } Line 206: if (status == HostStatus.NON_OPERATIONAL) { Line 207: model.getStatus().setDetail(entity.getNonOperationalReason().name().toLowerCase()); Line 208: } else if (status == HostStatus.MAINTENANCE || status == HostStatus.PREPARING_FOR_MAINTENANCE) { -- To view, visit https://gerrit.ovirt.org/40997 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I833f8e607fac7107e9352a547b3e36cbf9000f01 Gerrit-PatchSet: 6 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Eli Mesika <emes...@redhat.com> Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: Ori Liel <ol...@redhat.com> Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches