Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 959879 - [REST-API] Update of power management by sending entire host representation is ignored
[REST-API] Update of power management by sending entire host representation i...
Status: CLOSED ERRATA
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine-restapi (Show other bugs)
3.2.0
All Linux
unspecified Severity high
: ---
: 3.3.0
Assigned To: Ravi Nori
Barak Dagan
infra
: Reopened
: 949599 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-06 03:41 EDT by Artyom
Modified: 2016-02-10 14:32 EST (History)
8 users (show)

See Also:
Fixed In Version: is15
Doc Type: Bug Fix
Doc Text:
Previously users could not update power management options via the command line, while it was possible to do so through the administration portal. With this update, all the fields available from the administration portal can be used via the command line.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-01-21 12:20:10 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)
update_ip.cli (15.26 KB, application/octet-stream)
2013-05-06 03:41 EDT, Artyom
no flags Details
engine.log (392.57 KB, text/x-log)
2013-05-06 04:28 EDT, Artyom
no flags Details
PUT xml (3.82 KB, text/xml)
2013-05-21 14:52 EDT, Ravi Nori
no flags Details


External Trackers
Tracker ID Priority Status Summary Last Updated
oVirt gerrit 14994 None None None Never
oVirt gerrit 19023 None None None Never
oVirt gerrit 19263 None None None Never
oVirt gerrit 19265 None None None Never
Red Hat Product Errata RHSA-2014:0038 normal SHIPPED_LIVE Important: Red Hat Enterprise Virtualization Manager 3.3.0 update 2014-01-21 17:03:06 EST

  None (edit)
Description Artyom 2013-05-06 03:41:08 EDT
Created attachment 744006 [details]
update_ip.cli

Description of problem:
Unable update power management fields via cli, just enable disable option is work.

Version-Release number of selected component (if applicable):
sf15

How reproducible:
Add host to engine, add some power management, try to update some field via cli.

Steps to Reproduce:
1. Add host to engine
2. Add some power management(not necessary to be with correct address)
3. Try to update some field of power management via CLI
  
Actual results:
No update

Expected results:
Updated field

Additional info:
Attach log with trying to update host power management ip from 10.1.1.1 to 10.10.10.10
Comment 1 Michael Pasternak 2013-05-06 04:19:55 EDT
Artyom,

as you can see (in attached cli log) cli sends <address>10.10.10.10</address>,
but engine ignores it, please attach engine log.
Comment 2 Artyom 2013-05-06 04:28:53 EDT
Created attachment 744015 [details]
engine.log
Comment 3 Ravi Nori 2013-05-06 10:30:12 EDT
Looks like the reason the power management host address is not updated is because we are checking for status of the power management host before updating it. In case the new host is not in UP status we are not updating the power management information. Below is the relevant log, is there a reason we should update the power management information even if the proxy host is down (or invalid power management host)?

2013-05-06 09:50:33,138 ERROR [org.ovirt.engine.core.bll.FenceExecutor] (ajp-/127.0.0.1:8702-6) [2e23dd59] Failed to run Power Management command on Host cyan-vdsf.qa.lab.tlv.redhat.com, no running proxy Host was found.
Comment 4 Michael Pasternak 2013-05-07 01:58:02 EDT
(In reply to comment #3)
> Looks like the reason the power management host address is not updated is
> because we are checking for status of the power management host before
> updating it. In case the new host is not in UP status we are not updating
> the power management information. Below is the relevant log, is there a
> reason we should update the power management information even if the proxy
> host is down (or invalid power management host)?

not sure we can even if we want (as we might have no connectivity to the host),
but engine should trigger a can-do-action error in such case instead of
silently ignoring the update, 

simon?

> 
> 2013-05-06 09:50:33,138 ERROR [org.ovirt.engine.core.bll.FenceExecutor]
> (ajp-/127.0.0.1:8702-6) [2e23dd59] Failed to run Power Management command on
> Host cyan-vdsf.qa.lab.tlv.redhat.com, no running proxy Host was found.
Comment 5 Oded Ramraz 2013-05-07 02:29:01 EDT
In the UI it is possible to update the power management information of the host even if the power management address is not reachable , this action will result with alert . 
One more thing: since power management cards are quite common / essential it is import to fix this bug soon , preferably to this version ( rc ) .
Comment 6 Ravi Nori 2013-05-08 15:18:13 EDT
This is a duplicate of 3.3 bug 950684
Comment 7 Simon Grinberg 2013-05-09 05:36:07 EDT

*** This bug has been marked as a duplicate of bug 950684 ***
Comment 8 Michael Pasternak 2013-05-20 12:09:36 EDT
(In reply to Ravi Nori from comment #6)
> This is a duplicate of 3.3 bug 950684

ravi,

can you please explain why this bug is a dup of bug 950684?
Comment 9 Michael Pasternak 2013-05-20 12:10:56 EDT
*** Bug 949599 has been marked as a duplicate of this bug. ***
Comment 10 Ravi Nori 2013-05-20 12:31:55 EDT
The reason the update command fails is because we are retrieving the host from the server, updating the host with the new powermanagement information and then calling update with the new object. A lot of unnecessary data gets sent to the RestAPI. The fix for the bug 950684 also fixes the issue we have here. In other works the patch for bug 950684 fixes the issue that has been reported in this bug.
Comment 11 Michael Pasternak 2013-05-21 03:13:01 EDT
(In reply to Ravi Nori from comment #10)
> The reason the update command fails is because we are retrieving the host
> from the server, updating the host with the new powermanagement information
> and then calling update with the new object. A lot of unnecessary data gets
> sent to the RestAPI. The fix for the bug 950684 also fixes the issue we have
> here. In other works the patch for bug 950684 fixes the issue that has been
> reported in this bug.

it's not fixes it, but hides it, if one will do the same [1] in api,
he will face exactly the same problem, i.e if we support PATCH over PUT,
it doesn't mean we should not support pure PUT [1].

[1] take the resource, change what you need and PUT it as is
Comment 12 Ravi Nori 2013-05-21 14:52:33 EDT
Created attachment 751346 [details]
PUT xml

The xml currently sent from cli contains all the information about VDS (host). The xml also contains power_management->agents information. In HostMapper we are first setting power_management->address to VdsStatic.ManagementIp and then loop through agents and over write the VdsStatic.ManagementIp with agent.address. I think currently cli sends a lot of unnecessary information which is causing the issue reported in the bug.

I can change the order in which HostMapper is setting the values to resolve this issue, but it could lead to other issues. I still think the right way to fix this is to send only the required amount of information from cli.
Comment 13 Michael Pasternak 2013-05-22 03:45:15 EDT
(In reply to Ravi Nori from comment #12)
> Created attachment 751346 [details]
> PUT xml
> 
> The xml currently sent from cli contains all the information about VDS
> (host). The xml also contains power_management->agents information. In
> HostMapper we are first setting power_management->address to
> VdsStatic.ManagementIp and then loop through agents and over write the
> VdsStatic.ManagementIp with agent.address. I think currently cli sends a lot
> of unnecessary information which is causing the issue reported in the bug.
> 
> I can change the order in which HostMapper is setting the values to resolve
> this issue, but it could lead to other issues. I still think the right way
> to fix this is to send only the required amount of information from cli.

what you describing is supporting only PATCH, this is inconsistent with the
rest of the api, where we support both PUT & PATCH,

also this is logically incorrect, user should be able to GET resource
representation (from the api), change what he wants and PUT it back to server
as is (i.e entire representation, not only the part that has been changed).
Comment 14 Barak Dagan 2013-09-09 04:41:35 EDT
Verification failed on is13:

using the same scenario from https://bugzilla.redhat.com/show_bug.cgi?id=949599#c3
[RHEVM shell (connected@10.35.161.51)]# update host 'rose03'  --storage_manager-priority 5 --power_management-username 'user' --power_management-address '10.35.35.35' --power_management-enabled true --power_management-password 'password' --power_management-type 'bladecenter' --power_management-options-option "option.name=secure,option.value=false,option.name=slot,option.value=1" --correlation_id 103

id                                                : 615d14c4-9c57-4615-ab49-0a0908f7faea
name                                              : rose03
cluster-id                                        : cd46a665-6e33-484f-acc5-04330d4dfede
libvirt_version-build                             : 2
libvirt_version-full_version                      : libvirt-0.10.2-18.el6_4.9
libvirt_version-major                             : 0
libvirt_version-minor                             : 10
libvirt_version-revision                          : 0
port                                              : 54321
power_management-address                          : 10.35.35.35
power_management-agents-agent-address             : 10.35.35.35
power_management-agents-agent-options-option-name : secure
power_management-agents-agent-options-option-value: false
power_management-agents-agent-options-option-name : slot
power_management-agents-agent-options-option-value: 1
power_management-agents-agent-order               : 1
power_management-agents-agent-type                : bladecenter
power_management-agents-agent-username            : user
power_management-enabled                          : True
power_management-options-option-name              : secure
power_management-options-option-value             : false
power_management-options-option-name              : slot
power_management-options-option-value             : 1
power_management-type                             : bladecenter
power_management-username                         : user
version-full_version                              : vdsm-4.12.0-105.git0da1561.el6ev
version-major                                     : 4
version-minor                                     : 12

[RHEVM shell]# update host rose03 --storage_manager-priority 5 --power_management-enabled true --power_management-type 'rsa' --correlation_id 104

id                                                : 615d14c4-9c57-4615-ab49-0a0908f7faea
name                                              : rose03
cluster-id                                        : cd46a665-6e33-484f-acc5-04330d4dfede
libvirt_version-full_version                      : libvirt-0.10.2-18.el6_4.9
libvirt_version-major                             : 0
libvirt_version-minor                             : 10
libvirt_version-revision                          : 0
power_management-address                          : 10.35.35.35
power_management-agents-agent-address             : 10.35.35.35
power_management-agents-agent-options-option-name : secure
power_management-agents-agent-options-option-value: false
power_management-agents-agent-options-option-name : slot
power_management-agents-agent-options-option-value: 1
power_management-agents-agent-order               : 1
power_management-agents-agent-type                : bladecenter
power_management-agents-agent-username            : user
power_management-enabled                          : True
power_management-options-option-name              : secure
power_management-options-option-value             : false
power_management-options-option-name              : slot
power_management-options-option-value             : 1
power_management-type                             : bladecenter
power_management-username                         : user
version-full_version                              : vdsm-4.12.0-105.git0da1561.el6ev
version-major                                     : 4
version-minor                                     : 12
Comment 15 Michael Pasternak 2013-09-09 04:52:42 EDT
(In reply to Barak Dagan from comment #14)
> Verification failed on is13:
> 
> using the same scenario from
> https://bugzilla.redhat.com/show_bug.cgi?id=949599#c3
> [RHEVM shell (connected@10.35.161.51)]# update host 'rose03' 
> --storage_manager-priority 5 --power_management-username 'user'
> --power_management-address '10.35.35.35' --power_management-enabled true
> --power_management-password 'password' --power_management-type 'bladecenter'
> --power_management-options-option
> "option.name=secure,option.value=false,option.name=slot,option.value=1"
> --correlation_id 103

collection based option ^ is not correct, you've used twice same properties
in the --power_management-options-option 

help is:
========

COLLECTION BASED OPTION FORMAT
  
    * [--x-y: collection]
      {
        [y.a: string]
        [y.b: string]
        [y.c: string]
      }
  
    e.g:
  
    --x-y "y.a=a1,y.b=b1,y.c=c1"
    --x-y "y.a=a2,y.b=b2,y.c=c2"
    ...


i.e it should be:
================

--power_management-options-option "option.name=secure,option.value=false" 
--power_management-options-option "option.name=slot,option.value=1"
Comment 16 Barak Dagan 2013-09-09 04:57:02 EDT
Thanks for explaining how to use the collections, however that part worked. The second part of changing the type from bladecenter to rsa is the part that failed.
Comment 17 Barak Dagan 2013-09-22 09:05:01 EDT
Verified on is15:


[RHEVM shell]# show host rose03

id                                                : 615d14c4-9c57-4615-ab49-0a0908f7faea
name                                              : rose03
cluster-id                                        : cd46a665-6e33-484f-acc5-04330d4dfede
...
power_management-address                          : 10.35.35.35
power_management-agents-agent-address             : 10.35.35.35
power_management-agents-agent-options-option-name : secure
power_management-agents-agent-options-option-value: false
power_management-agents-agent-options-option-name : slot
power_management-agents-agent-options-option-value: 1
power_management-agents-agent-order               : 1
power_management-agents-agent-type                : bladecenter
power_management-agents-agent-username            : user
power_management-enabled                          : True
power_management-options-option-name              : secure
power_management-options-option-value             : false
power_management-options-option-name              : slot
power_management-options-option-value             : 1
power_management-type                             : bladecenter




[RHEVM shell# update host rose03 --storage_manager-priority 5 --power_management-enabled true --power_management-type 'rsa' --correlation_id 104

id                                                : 615d14c4-9c57-4615-ab49-0a0908f7faea
name                                              : rose03
cluster-id                                        : cd46a665-6e33-484f-acc5-04330d4dfede
...
libvirt_version-build                             : 2
libvirt_version-full_version                      : libvirt-0.10.2-18.el6_4.9
libvirt_version-major                             : 0
libvirt_version-minor                             : 10
libvirt_version-revision                          : 0
...
power_management-address                          : 10.35.35.35
power_management-agents-agent-address             : 10.35.35.35
power_management-agents-agent-options-option-name : secure
power_management-agents-agent-options-option-value: false
power_management-agents-agent-options-option-name : slot
power_management-agents-agent-options-option-value: 1
power_management-agents-agent-order               : 1
power_management-agents-agent-type                : rsa
power_management-agents-agent-username            : user
power_management-enabled                          : True
power_management-options-option-name              : secure
power_management-options-option-value             : false
power_management-options-option-name              : slot
power_management-options-option-value             : 1
power_management-type                             : rsa
Comment 18 Charlie 2013-11-27 19:08:20 EST
This bug is currently attached to errata RHEA-2013:15231. If this change is not to be documented in the text for this errata please either remove it from the errata, set the requires_doc_text flag to minus (-), or leave a "Doc Text" value of "--no tech note required" if you do not have permission to alter the flag.

Otherwise to aid in the development of relevant and accurate release documentation, please fill out the "Doc Text" field above with these four (4) pieces of information:

* Cause: What actions or circumstances cause this bug to present.
* Consequence: What happens when the bug presents.
* Fix: What was done to fix the bug.
* Result: What now happens when the actions or circumstances above occur. (NB: this is not the same as 'the bug doesn't present anymore')

Once filled out, please set the "Doc Type" field to the appropriate value for the type of change made and submit your edits to the bug.

For further details on the Cause, Consequence, Fix, Result format please refer to:

https://bugzilla.redhat.com/page.cgi?id=fields.html#cf_release_notes 

Thanks in advance.
Comment 20 errata-xmlrpc 2014-01-21 12:20:10 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHSA-2014-0038.html

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