Bug 854499 - RESTAPI - Wrong number of events when updating tag
RESTAPI - Wrong number of events when updating tag
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
3.1.0
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Ori Liel
Elena
infra
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-05 04:14 EDT by Elena
Modified: 2016-02-10 14:36 EST (History)
9 users (show)

See Also:
Fixed In Version: si18
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-04 14:59:22 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Infra
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Elena 2012-09-05 04:14:20 EDT
When updating tag with rest api only one event is registered:
<events>
<event href="/api/events/160" id="160">
<description>Tag TagRestTestUpd parameters were updated by vdcadmin.</description>
<code>430</code>
<severity>normal</severity>
<time>2012-09-05T10:55:13.876+03:00</time>
<correlation_id>44363</correlation_id>
<user href="/api/users/9b9002d1-ec33-4083-8a7b-31f6b8931648" id="9b9002d1-ec33-4083-8a7b-31f6b8931648"/>
</event>
</events>

When doing same action with sdk - 2 events are registered:

<events>
<event href="/api/events/168" id="168">
<description>Tag TagRestTestUpd parameters were updated by vdcadmin.</description><code>430</code><severity>normal</severity><time>2012-09-05T11:00:44.629+03:00</time><correlation_id>44373</correlation_id>
<user href="/api/users/9b9002d1-ec33-4083-8a7b-31f6b8931648" id="9b9002d1-ec33-4083-8a7b-31f6b8931648"/>
</event>
<event href="/api/events/167" id="167">
<description>Tag TagRestTestUpd was moved from root to root by vdcadmin.</description>
<code>555</code>
<severity>normal</severity>
<time>2012-09-05T11:00:44.472+03:00</time><correlation_id>44373</correlation_id>
<user href="/api/users/9b9002d1-ec33-4083-8a7b-31f6b8931648" id="9b9002d1-ec33-4083-8a7b-31f6b8931648"/>
</event>
</events>
Comment 1 Michael Pasternak 2012-09-05 06:15:40 EDT
this cannot be the sdk issue as sdk doesn't carry own logic, 
you probably used same correlation_id in move tag,

check your code pls.
Comment 2 Elena 2012-09-05 06:39:44 EDT
Believe me, I'm checking a lot my code before opening a bug.
Test scenario:
create a tag
update a tag name and assign some correlation id to this action
search for events with the id assinged above

Please run it and let me know if you have different results from mine.
Also what is the event 'Tag TagRestTestUpd was moved from root to root by vdcadmin.'? It appears only when using sdk api, not rest (see above examples)
Comment 3 Michael Pasternak 2012-09-05 08:11:55 EDT
please run sdk in debug mode and add the output + server log

thanks.
Comment 4 Elena 2012-09-05 08:40:42 EDT
send: 'GET /api/tags HTTP/1.1\r\nHost: aqua-rhel.qa.lab.tlv.redhat.com\r\nAccept-Encoding: identity\r\ncookie: JSESSIONID=McOolbPbb-zCdbvoyXwYlHr9\r\nPrefer: persistent-auth\r\nContent-type: application/xml\r\nAuthorization: Basic dmRjYWRtaW5AcWEubGFiLnRsdi5yZWRoYXQuY29tOjEyMzQ1Ng==\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Wed, 05 Sep 2012 12:34:42 GMT
header: Pragma: No-cache
header: Cache-Control: no-cache
header: Expires: Thu, 01 Jan 1970 02:00:00 IST
header: Content-Type: application/xml
header: Content-Length: 1939
header: Connection: close
send: 'PUT /api/tags/4f9b1176-f72b-11e1-b569-0bfa0dd8375a HTTP/1.1\r\nHost: aqua-rhel.qa.lab.tlv.redhat.com\r\nAccept-Encoding: identity\r\nContent-Length: 285\r\ncookie: JSESSIONID=McOolbPbb-zCdbvoyXwYlHr9\r\nPrefer: persistent-auth\r\nContent-type: application/xml\r\nAuthorization: Basic dmRjYWRtaW5AcWEubGFiLnRsdi5yZWRoYXQuY29tOjEyMzQ1Ng==\r\nCorrelation-Id: 15233\r\n\r\n'
send: '<tag href="/api/tags/4f9b1176-f72b-11e1-b569-0bfa0dd8375a" id="4f9b1176-f72b-11e1-b569-0bfa0dd8375a">\n    <name>TagRestTestUpd</name>\n    <description>Test Tag Description Updates</description>\n    <parent>\n        <tag id="00000000-0000-0000-0000-000000000000"/>\n    </parent>\n</tag>\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Date: Wed, 05 Sep 2012 12:34:43 GMT
header: Pragma: No-cache
header: Cache-Control: no-cache
header: Expires: Thu, 01 Jan 1970 02:00:00 IST
header: Content-Type: application/xml
header: Content-Length: 341
header: Connection: close

send: 'GET /api/events;max=-1;case_sensitive=true?search=correlation_id%3D15233 HTTP/1.1\r\nHost: aqua-rhel.qa.lab.tlv.redhat.com\r\nAccept-Encoding: identity\r\ncookie: JSESSIONID=McOolbPbb-zCdbvoyXwYlHr9\r\nPrefer: persistent-auth\r\nContent-type: application/xml\r\nAuthorization: Basic dmRjYWRtaW5AcWEubGFiLnRsdi5yZWRoYXQuY29tOjEyMzQ1Ng==\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
Comment 5 Elena 2012-09-05 08:41:38 EDT
Engine log:
2012-09-05 15:39:56,211 WARN  [org.ovirt.engine.core.bll.GetConfigurationValueQuery] (ajp-/127.0.0.1:8009-6) calling GetConfigurationValueQuery (SupportedClusterLevels) with null version, using default general for version
2012-09-05 15:39:57,798 WARN  [org.ovirt.engine.core.bll.GetConfigurationValueQuery] (ajp-/127.0.0.1:8009-4) calling GetConfigurationValueQuery (SupportedClusterLevels) with null version, using default general for version
2012-09-05 15:40:00,000 INFO  [org.ovirt.engine.core.bll.AutoRecoveryManager] (QuartzScheduler_Worker-52) Autorecovering hosts is disabled, skipping
2012-09-05 15:40:01,322 INFO  [org.ovirt.engine.core.bll.AutoRecoveryManager] (QuartzScheduler_Worker-52) Autorecovering storage domains is disabled, skipping
2012-09-05 15:40:07,436 WARN  [org.ovirt.engine.core.dal.job.ExecutionMessageDirector] (ajp-/127.0.0.1:8009-3) [152338] The message key MoveTag is missing from bundles/ExecutionMessages
2012-09-05 15:40:16,897 INFO  [org.ovirt.engine.core.bll.MoveTagCommand] (ajp-/127.0.0.1:8009-3) [152338] Running command: MoveTagCommand internal: false.
2012-09-05 15:40:16,903 INFO  [org.ovirt.engine.core.bll.UpdateTagCommand] (ajp-/127.0.0.1:8009-3) [3c798182] Running command: UpdateTagCommand internal: true.
2012-09-05 15:40:17,929 WARN  [org.ovirt.engine.core.dal.job.ExecutionMessageDirector] (ajp-/127.0.0.1:8009-3) [152338] The message key UpdateTag is missing from bundles/ExecutionMessages
2012-09-05 15:40:18,904 INFO  [org.ovirt.engine.core.bll.UpdateTagCommand] (ajp-/127.0.0.1:8009-3) [152338] Running command: UpdateTagCommand internal: false.
Comment 6 Michael Pasternak 2012-09-05 08:59:48 EDT
Elena, as i told, sdk is ok, please do same as sdk does (using same xmls):

1. get tag
2. change field as in xml, and PUT entire body as sdk did

something cause MoveTagCommand to be called, i believe this is api/engine 
bug and you didn't catch it via restapi as you didn't used entire tag body
(as sdk did) for update.
Comment 7 Elena 2012-09-06 03:05:23 EDT
You are right. If I'm sending this request in rest api:
<tag>
    <name>TagRestTestUpd</name>
    <description>Test Tag Description Updates</description>
</tag>

I'll get only one event.

But when providing the whole object ():
<tag href="/api/tags/4f9b1176-f72b-11e1-b569-0bfa0dd8375a" id="4f9b1176-f72b-11e1-b569-0bfa0dd8375a">
    <name>TagRestTestUpd</name>
    <description>Test Tag Description Updates</description>
    <parent>
        <tag id="00000000-0000-0000-0000-000000000000"/>
    </parent>
</tag>

2 events will be registered although I still change the name only (parent remain the same). Second event looks a little meaningless - "Tag TagRestTestUpd was moved from root to root by vdcadmin".
Comment 8 Ori Liel 2012-09-06 08:51:45 EDT
patch posted upstream: 

   http://gerrit.ovirt.org/#/c/7818/
Comment 9 Elena 2012-09-16 02:10:07 EDT
Verified in si18

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