Bug 1456711 - [RFE] Add properties to events
Summary: [RFE] Add properties to events
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: ovirt-engine
Classification: oVirt
Component: RestAPI
Version: 4.1.1
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ovirt-4.2.0
: 4.2.0
Assignee: Ori Liel
QA Contact: Petr Matyáš
URL:
Whiteboard:
Depends On:
Blocks: 1499716
TreeView+ depends on / blocked
 
Reported: 2017-05-30 08:16 UTC by Juan Hernández
Modified: 2017-12-20 10:49 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-12-20 10:49:04 UTC
oVirt Team: Infra
Embargoed:
rule-engine: ovirt-4.2?
pmatyas: testing_plan_complete-
rule-engine: planning_ack?
oourfali: devel_ack+
lsvaty: testing_ack+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
oVirt gerrit 81513 0 master POST Add Names To Event Objects 2017-09-06 12:12:39 UTC

Description Juan Hernández 2017-05-30 08:16:48 UTC
Currently events contain a description that is built a template and a set of properties added by the backend to the audit log object. For example, when a NIC is added to a virtual machine the generated event looks like this:

  <event href="/ovirt-engine/api/events/99" id="99">
    <description>Interface nic2 (VirtIO) was added to VM myvm. (User: admin@internal-authz)</description>
    <code>932</code>
    ...
    <vm href="/ovirt-engine/api/vms/34bc8a23-8749-481c-a67e-dd855960cf79" id="34bc8a23-8749-481c-a67e-dd855960cf79"/>
    ...
  </event>

Some applications need to extract certain details from that message, for example the name of the virtual machine. For a selected set of objects that information can be extracted from the links that are part of the event. For example, in the above example the user could follow the <vm ../> link to get the VM name. But this isn't always possible, as there may not be a link containing the required information. In that cases applications tend to parse the text message. For example, that is what ManageIQ currently does to extract the VM name:

  https://github.com/ManageIQ/manageiq/blob/fine-1/app/models/manageiq/providers/redhat/infra_manager/event_parser.rb#L80-L88

That is very fragile.

To better support these applications the API should provide the properties in easier and more reliable way:

  <event href="/ovirt-engine/api/events/99" id="99">
    <description>Interface nic2 (VirtIO) was added to VM myvm. (User: admin@internal-authz)</description>
    <code>932</code>
    <properties>
      <property>
        <name>nic_name</name>
        <value>nic2</value>
      </property>
      <property>
        <name>nic_interface</name>
        <value>VirtIO</value>
      </property>
      <property>
        <name>vm_name</name>
        <value>myvm</value>
      </property>
      <property>
        <name>user_name</name>
        <value>admin@internal-authz</value>
      </property>

    </properties>
    ...
  </event>

The set of properties available for each event type should be kept backwards compatible, and the names and meanings should be documented in the specification of the API.

Comment 1 Oved Ourfali 2017-07-12 12:04:25 UTC
We discussed that offline.
We'll add that functionality to some extent in 4.2.
The idea is to add the names of references we currently have in the events structure (like VM name, cluster name, DC name etc, depends on the event itself).

Comment 2 Ori Liel 2017-09-06 12:14:43 UTC
Patch posted: 

  https://gerrit.ovirt.org/#/c/81513/

Comment 3 Petr Matyáš 2017-10-09 09:35:04 UTC
Verified on ovirt-engine-4.2.0-0.0.master.20171006152719.gitbc9a33d.el7.centos.noarch

Comment 4 Sandro Bonazzola 2017-12-20 10:49:04 UTC
This bugzilla is included in oVirt 4.2.0 release, published on Dec 20th 2017.

Since the problem described in this bug report should be
resolved in oVirt 4.2.0 release, published on Dec 20th 2017, it has been closed with a resolution of CURRENT RELEASE.

If the solution does not work for you, please open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.