<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On May 30, 2017 11:28, &quot;Juan Hernández&quot; &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt; wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">On 05/30/2017 09:38 AM, Tomas Jelinek wrote:<br>
&gt;<br>
&gt;<br>
&gt; On Tue, May 30, 2017 at 9:16 AM, Juan Hernández &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a><br>
</div><div class="quoted-text">&gt; &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     On 05/30/2017 08:55 AM, Tomas Jelinek wrote:<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt; On Tue, May 30, 2017 at 7:20 AM, Michal Skrivanek &lt;<a href="mailto:mskrivan@redhat.com">mskrivan@redhat.com</a> &lt;mailto:<a href="mailto:mskrivan@redhat.com">mskrivan@redhat.com</a>&gt;<br>
</div><div class="quoted-text">&gt;     &gt; &lt;mailto:<a href="mailto:mskrivan@redhat.com">mskrivan@redhat.com</a> &lt;mailto:<a href="mailto:mskrivan@redhat.com">mskrivan@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;<br>
&gt;     &gt;     &gt; On 29 May 2017, at 11:44, Juan Hernández &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;<br>
</div><div class="quoted-text">&gt;     &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;&gt; On 05/29/2017 11:27 AM, Michal Skrivanek wrote:<br>
&gt;     &gt;     &gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; On 29 May 2017, at 10:39, Juan Hernández &lt;<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;<br>
</div><div class="elided-text">&gt;     &gt;     &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a> &lt;mailto:<a href="mailto:jhernand@redhat.com">jhernand@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; Hello,<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; It has been recently requested that the API provides event<br>
&gt;     types:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; [RFE] Expose event types to API<br>
&gt;     &gt;     &gt;&gt;&gt; <a href="https://bugzilla.redhat.com/1453170" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1453170</a><br>
&gt;     &lt;<a href="https://bugzilla.redhat.com/1453170" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1453170</a>&gt;<br>
&gt;     &gt;     &lt;<a href="https://bugzilla.redhat.com/1453170" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1453170</a><br>
&gt;     &lt;<a href="https://bugzilla.redhat.com/1453170" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1453170</a>&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; Currently the API provides the event code and description, for<br>
&gt;     &gt;     example:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;event href=&quot;/ovirt-engine/api/<wbr>events/8021&quot; id=&quot;8021&quot;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;code&gt;19&lt;/code&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;description&gt;Host myhost failed to recover.&lt;/description<br>
&gt;     &gt;     &gt;&gt;&gt;   ...<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;/event&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; There is no documentation of what is the meaning of codes,<br>
&gt;     &gt;     except the<br>
&gt;     &gt;     &gt;&gt;&gt; source code of the engine itself. This forces some<br>
&gt;     applications<br>
&gt;     &gt;     to add<br>
&gt;     &gt;     &gt;&gt;&gt; their own code to name mapping. For example, the &#39;ovirt&#39; Ruby<br>
&gt;     &gt;     gem used<br>
&gt;     &gt;     &gt;&gt;&gt; by older versions of ManageIQ to interact with oVirt contains<br>
&gt;     &gt;     the following:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;<br>
&gt;      <a href="https://github.com/ManageIQ/ovirt/blob/v0.17.0/lib/ovirt/event.rb#L25-L485" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>ovirt/blob/v0.17.0/lib/ovirt/<wbr>event.rb#L25-L485</a><br>
&gt;     &lt;<a href="https://github.com/ManageIQ/ovirt/blob/v0.17.0/lib/ovirt/event.rb#L25-L485" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>ovirt/blob/v0.17.0/lib/ovirt/<wbr>event.rb#L25-L485</a>&gt;<br>
&gt;     &gt;<br>
&gt;      &lt;<a href="https://github.com/ManageIQ/ovirt/blob/v0.17.0/lib/ovirt/event.rb#L25-L485" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>ovirt/blob/v0.17.0/lib/ovirt/<wbr>event.rb#L25-L485</a><br>
&gt;     &lt;<a href="https://github.com/ManageIQ/ovirt/blob/v0.17.0/lib/ovirt/event.rb#L25-L485" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>ovirt/blob/v0.17.0/lib/ovirt/<wbr>event.rb#L25-L485</a>&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; We could avoid this by adding to the API a new event<br>
&gt;     attribute that<br>
&gt;     &gt;     &gt;&gt;&gt; indicates the type:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;event href=&quot;/ovirt-engine/api/<wbr>events/8021&quot; id=&quot;8021&quot;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;code&gt;19&lt;/code&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;type&gt;host_recover_failure&lt;/<wbr>type&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;description&gt;Host myhost failed to recover.&lt;/description&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   ...<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;/event&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; Ideally this should be defined as an enum, so that it will be<br>
&gt;     &gt;     &gt;&gt;&gt; represented as an enum in the SDKs. Alternatively it could<br>
&gt;     just<br>
&gt;     &gt;     be an<br>
&gt;     &gt;     &gt;&gt;&gt; string, and we could reuse the &#39;name&#39; attribute:<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;event href=&quot;/ovirt-engine/api/<wbr>events/8021&quot; id=&quot;8021&quot;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;code&gt;19&lt;/code&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;name&gt;host_recover_failure&lt;/<wbr>name&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   &lt;description&gt;Host myhost failed to recover.&lt;/description&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;   ...<br>
&gt;     &gt;     &gt;&gt;&gt; &lt;/event&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; However, the key point to making this useful would be to keep<br>
&gt;     &gt;     the types<br>
&gt;     &gt;     &gt;&gt;&gt; (or names) backwards compatible, so that users of the API can<br>
&gt;     &gt;     rely on<br>
&gt;     &gt;     &gt;&gt;&gt; their values and meanings.<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; So this is my question to you: can we commit to keep the<br>
&gt;     names and<br>
&gt;     &gt;     &gt;&gt;&gt; meanings of the backend event types backwards compatible?<br>
&gt;     &gt;     &gt;&gt;<br>
&gt;     &gt;     &gt;&gt; Do we even have to make it bw compatible?<br>
&gt;     &gt;     &gt;&gt; I guess it depends on the actual usage of those names…<br>
&gt;     &gt;     &gt;&gt; The ovirt ruby gem itself doesn’t do much with it<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; We need to make keep it backwards compatible or else tell<br>
&gt;     users &quot;don&#39;t<br>
&gt;     &gt;     &gt; rely on these values, as they may change without notice&quot;.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; The &#39;ovirt&#39; gem doesn&#39;t do anything special, it just creates<br>
&gt;     its own<br>
&gt;     &gt;     &gt; code to name mapping. But the users of the &#39;ovirt&#39; gem (the<br>
&gt;     ManageIQ<br>
&gt;     &gt;     &gt; oVirt provider) do rely on the name. For example:<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     <a href="https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L92" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/blob/<wbr>master/app/models/manageiq/<wbr>providers/redhat/infra_<wbr>manager/event_parser.rb#L80-<wbr>L92</a><br>
&gt;     &lt;<a href="https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L92" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/blob/<wbr>master/app/models/manageiq/<wbr>providers/redhat/infra_<wbr>manager/event_parser.rb#L80-<wbr>L92</a>&gt;<br>
&gt;     &gt;<br>
&gt;      &lt;<a href="https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L92" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/blob/<wbr>master/app/models/manageiq/<wbr>providers/redhat/infra_<wbr>manager/event_parser.rb#L80-<wbr>L92</a><br>
&gt;     &lt;<a href="https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L92" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/blob/<wbr>master/app/models/manageiq/<wbr>providers/redhat/infra_<wbr>manager/event_parser.rb#L80-<wbr>L92</a>&gt;&gt;<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt; hmmm, while we are on topic, this pretty much looks like that manageiq<br>
&gt;     &gt; does not only rely on the code but also on the actual value of it<br>
&gt;     since<br>
&gt;     &gt; it is parsing it:<br>
&gt;     &gt;<br>
&gt;     &gt; # sample message: &quot;Interface nic1 (VirtIO) was added to VM v5. (User:<br>
&gt;     &gt; admin@internal-authz)&quot; message.split(/\s/)[7][0...-1]<br>
&gt;     &gt;<br>
&gt;     &gt; Is this something we commit to maintain? Or should we commit to<br>
&gt;     maintain it?<br>
&gt;     &gt;<br>
&gt;<br>
&gt;     That is a good point, that isn&#39;t very future proof. We should also find<br>
&gt;     a way to make less fragile. Any suggestion?<br>
&gt;<br>
&gt;<br>
&gt; The only doable thing which comes to my mind is something like this:<br>
&gt; The msg is defined like this:<br>
&gt; USER_ADD_VM_POOL_WITH_VMS_<wbr>FAILED=Failed to create VM Pool ${VmPoolName}<br>
&gt; (User: ${UserName}).<br>
&gt;<br>
&gt; e.g. the msg type and the variables. If we could expose in the api not<br>
&gt; only the substituted msg but also the variable/value binding, we could<br>
&gt; commit to keep the variable names backward compatible.<br>
&gt;<br>
&gt; So, something like:<br>
&gt;<br>
&gt; &lt;event href=&quot;/ovirt-engine/api/<wbr>events/8021&quot; id=&quot;8021&quot;&gt;<br>
&gt;    &lt;code&gt;19&lt;/code&gt;<br>
&gt;    &lt;type&gt;USER_ADD_VM_POOL_WITH_<wbr>VMS_FAILED&lt;/type&gt;<br>
&gt;    &lt;description&gt;the substituted msg.&lt;/description&gt;<br>
&gt;    &lt;parameters&gt;<br>
&gt;      &lt;parameter&gt;<br>
&gt;         &lt;key&gt;VmPoolName&lt;/key&gt;<br>
&gt;         &lt;value&gt;The Pool Name&lt;value&gt;<br>
&gt;      &lt;/parameter&gt;<br>
&gt; ...<br>
&gt;    &lt;/parameters&gt;<br>
&gt; &lt;/event&gt;<br>
&gt;<br>
&gt; Not really rock solid since the variables would still be defined in the<br>
&gt; AuditLogMessages.properties but still better and still easier to parse<br>
&gt; on the client side.<br>
&gt;<br>
<br>
</div>That makes sense to me. I have opened the following bug to track that:<br>
<br>
  [RFE] Add properties to events<br>
  <a href="https://bugzilla.redhat.com/1456711" rel="noreferrer" target="_blank">https://bugzilla.redhat.com/<wbr>1456711</a><br>
<br>
Note that for the particular case of the VM name, which is what ManageIQ<br>
is trying to do in that caode, the current best way is to use the &lt;vm<br>
.../&gt; link that is part of the event. I have opened the following<br>
ManageIQ issue to track it:<br>
<br>
  Avoid parsing the descriptions of events<br>
  <a href="https://github.com/ManageIQ/manageiq-providers-ovirt/issues/45" rel="noreferrer" target="_blank">https://github.com/ManageIQ/<wbr>manageiq-providers-ovirt/<wbr>issues/45</a><br>
<div class="quoted-text"></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">I think it was introduced while working on targeted refresh, but if we have an alternative then of course it would be better. </div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text"><br>
&gt;<br>
&gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; That means that if we ever change the meaning of a code the ManageIQ<br>
&gt;     &gt;     &gt; provider, for example, will break.<br>
&gt;     &gt;<br>
&gt;     &gt;     Right,then it indeed needs to stay stable.<br>
&gt;     &gt;     But how is maintaining the enum string different from the code? It is<br>
&gt;     &gt;     the same information, so if MIQ doesn&#39;t use the name directly then it<br>
&gt;     &gt;     doesn&#39;t really matter if it&#39;s a code or string.<br>
&gt;     &gt;     Perhaps deprecate the code and keep the name fixed?<br>
&gt;     &gt;<br>
&gt;     &gt;     Thanks,<br>
&gt;     &gt;     michal<br>
&gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; Regards,<br>
&gt;     &gt;     &gt;&gt;&gt; Juan Hernandez<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt;<br>
&gt;     &gt;     &gt;&gt;&gt; ______________________________<wbr>_________________<br>
&gt;     &gt;     &gt;&gt;&gt; Devel mailing list<br>
&gt;     &gt;     &gt;&gt;&gt; <a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>&gt;<br>
</div>&gt;     &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>&gt;&gt;<br>
<div class="quoted-text">&gt;     &gt;     &gt;&gt;&gt; <a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>&gt;<br>
&gt;     &gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>&gt;&gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     ______________________________<wbr>_________________<br>
&gt;     &gt;     Devel mailing list<br>
&gt;     &gt;     <a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>&gt;<br>
</div>&gt;     &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a> &lt;mailto:<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a>&gt;&gt;<br>
<div class="quoted-text">&gt;     &gt;     <a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>&gt;<br>
&gt;     &gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a><br>
&gt;     &lt;<a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a>&gt;&gt;<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;<br>
&gt;<br>
<br>
______________________________<wbr>_________________<br>
Devel mailing list<br>
<a href="mailto:Devel@ovirt.org">Devel@ovirt.org</a><br>
</div><a href="http://lists.ovirt.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.ovirt.org/<wbr>mailman/listinfo/devel</a></blockquote></div><br></div></div></div>