Eli Mesika has posted comments on this change. Change subject: REST API: Adding external status to API ......................................................................
Patch Set 6: (7 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 e Hi Juan I am aware of this status field and think it should not be used here Reasons : 1) current call format : <event> <description>The heat of the host is above 30 Oc</description> <severity>warning</severity> <origin>HP Openview</origin> <custom_id>1</custom_id> <flood_rate>30</flood_rate> <host id="82d9f776-12cf-437a-b686-5958d09f9eb4" > <external_status>error</external_status> </host> </event> instead of <event> <description>The heat of the host is above 30 Oc</description> <severity>warning</severity> <origin>HP Openview</origin> <custom_id>1</custom_id> <flood_rate>30</flood_rate> <host id="82d9f776-12cf-437a-b686-5958d09f9eb4" > <status> <state>error</state> <detail>bla bla </detail> </status> </host> </event> not friendly IMO 2) More than that , you can put any string in the <detail> part but it will not mapped and saved since this is an external event and the details are in the <description>T field , so it is very confusing to be able to set a field but get it empty when you retrieve the event instance Those are the reasons I didn't used the status complex field and I had also consulted with Ori about that BTW We thought at the begining to call that entity_health, so the fact that we actually renamed it to external_status should not force us use the status complex field, especially if using it not just give us nothing but also violent simplicity and clarity 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. OK 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/BackendCapabilitiesResource.java File backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendCapabilitiesResource.java: Line 650: ConfigurationValues > whitespace There is no white space, its just gerrit representation Line 650: ConfigurationValues.PredefinedVMProperties, Line 651: version), Line 652: true)); Line 653: ret.addAll(CustomPropertiesParser.parse(getConfigurationValue(String.class, Line 654: ConfigurationValues.UserDefinedVMProperties, > whitespace There is no white space, its just gerrit representation Line 655: version), Line 656: true)); Line 657: return ret; Line 658: } 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 Done 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()". Done 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) { Line 722: class > The annotation here is wrong, should be reverse Done -- 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