Bug 770600

Summary: Error message is printed to engine.log with parameter names instead of parameter values
Product: [Retired] oVirt Reporter: Rami Vaknin <rvaknin>
Component: ovirt-engine-coreAssignee: lpeer <lpeer>
Status: CLOSED WONTFIX QA Contact:
Severity: low Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, bazulay, ecohen, iheim, mgoldboi, mpastern, yeylon, ykaul
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-13 08:12:24 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
engine.log none

Description Rami Vaknin 2011-12-27 22:52:03 UTC
Created attachment 549741 [details]
engine.log

Environment:
devel env, last commit's hash: 7a5e62ea22604dee949de6b85483ab44fc741f91, jboss 7

Error message is printed with the "${action}" and "${type}" literals instead of with the values of these parameters:
"Operation Failed: [Cannot ${action} ${type}. Host parameters cannot be modified while Host is operational. ]"

Note that the Action and Type values are printed well in the rest-api response.

Steps to reproduce:
Update IP of Active host using the following example rest-api PUT request:

http://10.35.97.51:8080/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8

<host id='afb1afc2-3082-11e1-b8aa-0f29ac94e6b8' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8'><name>gold-vdsc.qa.lab.tlv.redhat.com</name><actions><link rel='activate' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/activate'/><link rel='iscsilogin' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/iscsilogin'/><link rel='fence' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/fence'/><link rel='deactivate' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/deactivate'/><link rel='commitnetconfig' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/commitnetconfig'/><link rel='install' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/install'/><link rel='approve' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/approve'/><link rel='iscsidiscover' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/iscsidiscover'/></actions><link rel='nics' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/nics'/><link rel='permissions' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/permissions'/><link rel='storage' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/storage'/><link rel='statistics' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/statistics'/><link rel='tags' href='/api/hosts/afb1afc2-3082-11e1-b8aa-0f29ac94e6b8/tags'/><address>10.1.1.1</address><status><state>up</state></status><cluster id='ab8b835a-3082-11e1-91cc-7f4f89555ebe' href='/api/clusters/ab8b835a-3082-11e1-91cc-7f4f89555ebe'><id>ab8b835a-3082-11e1-91cc-7f4f89555ebe</id></cluster><power_management type='rsa'><enabled>false</enabled><address>10.35.35.35</address><username>user</username><options></options></power_management><storage_manager>false</storage_manager><iscsi><initiator>iqn.1994-05.com.redhat:f59061d31269</initiator></iscsi></host> 


From engine's log:
14:25:26,583 INFO  [org.ovirt.engine.core.bll.LoginAdminUserCommand] (http--0.0.0.0-8080-4) Running command: LoginAdminUserCommand internal: false.
14:25:26,610 ERROR [org.ovirt.engine.core.utils.ObjectIdentityChecker] (http--0.0.0.0-8080-4) Field vds_group_id can not be updated when status is Up
14:25:26,610 WARN  [org.ovirt.engine.core.bll.ChangeVDSClusterCommand] (http--0.0.0.0-8080-4) CanDoAction of action ChangeVDSCluster failed. Reasons:VDS_STATUS_NOT_VALID_FOR_UPD
ATE
14:25:26,611 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (http--0.0.0.0-8080-4) Operation Failed: [Cannot ${action} ${type}. Host parameters cannot be modified while Host is operational. ]
14:25:26,618 INFO  [org.ovirt.engine.core.bll.LogoutUserCommand] (http--0.0.0.0-8080-4) Running command: LogoutUserCommand internal: false.

Comment 1 Einav Cohen 2012-02-29 11:36:10 UTC
(In reply to comment #0)
> ...
> Note that the Action and Type values are printed well in the rest-api response.
> ...

This is strange, since according to the engine.log, the "Reasons" contain only the "VDS_STATUS_NOT_VALID_FOR_UPDATE" message, without the action/type messages.
Also, a similar problem has been encountered in the web-admin during configure-local-storage procedure (an error-message has popped-up with the message: "Cannot ${action} ${type}. Host parameters cannot be modified while Host is operational. Please switch Host to Maintenance mode first.")

According to the above, it seems that the backend doesn't return the Action + Type parameters' values along with the error message at all, so I fail to understand how the rest-api is showing these values correctly.

Can you please paste here the rest-api's response to the request that you have documented in the BZ description?

Comment 2 Rami Vaknin 2012-03-04 10:44:21 UTC
I did the same query again on devel env with last commit's hash: d933f3cd24fb971cb20bef59f73f6bf1172b34e6 - first time with ovirt-engine-sdk and second time with REST-API request.

This time, in REST-API I got literals ${action} and ${type} both in the response and to engine.log.

In ovirt-engine-sdk I got the variables' values both in the response and in engine.log.


ovrit-engine-sdk:
-----------------

vm = api.hosts.get('name_of_host')
vm.address='1.1.1.1'
vm.update()

Traceback (most recent call last):
  File "/home/rvaknin/sdk/src/tests2.py", line 19, in <module>
    vm.update()
  File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/brokers.py", line 1398, in update
    body=ParseHelper.toXml(self.superclass))
  File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 39, in update
    return self.request('PUT', url, body, headers)
  File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 52, in request
    conn=self.getConnectionsPool().getConnection())
  File "/usr/lib/python2.6/site-packages/ovirtsdk/infrastructure/proxy.py", line 62, in __doRequest
    raise RequestError, response
ovirtsdk.infrastructure.errors.RequestError: 
status: 400
reason: Bad Request
detail: [Cannot edit Host. Host parameters cannot be modified while Host is operational.
Please switch Host to Maintenance mode first.]


2012-03-04 12:23:32,027 ERROR [org.ovirt.engine.core.utils.ObjectIdentityChecker] (http--0.0.0.0-8080-8) [3b3a7065] Field host_name can not be updated when status is Up
2012-03-04 12:23:32,027 WARN  [org.ovirt.engine.core.utils.ObjectIdentityChecker] (http--0.0.0.0-8080-8) [3b3a7065] ObjectIdentityChecker.IsUpdateValid:: Not updatable field 'host_name' was updated
2012-03-04 12:23:32,028 WARN  [org.ovirt.engine.core.bll.UpdateVdsCommand] (http--0.0.0.0-8080-8) [3b3a7065] CanDoAction of action UpdateVds failed. Reasons:VDS_STATUS_NOT_VALID_FOR_UPDATE,VAR__ACTION__UPDATE,VAR__TYPE__HOST
2012-03-04 12:23:32,028 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (http--0.0.0.0-8080-8) Operation Failed: [Cannot edit Host. Host parameters cannot be modified while Host is operational.
Please switch Host to Maintenance mode first.]

REST-API:
---------

http://rami-upstream-jboss7.qa.lab.tlv.redhat.com:8080/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058

<host id='b5451c38-62ac-11e1-95af-cb24f78bf058'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058'><name>intg-vdsb.qa.lab.tlv.redhat.com</name><actions><link
rel='activate'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/activate'/><link
rel='iscsilogin'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/iscsilogin'/><link
rel='fence' href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/fence'/><link
rel='deactivate'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/deactivate'/><link
rel='commitnetconfig'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/commitnetconfig'/><link
rel='install'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/install'/><link
rel='approve'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/approve'/><link
rel='iscsidiscover'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/iscsidiscover'/></actions><link
rel='nics' href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/nics'/><link
rel='permissions'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/permissions'/><link
rel='storage'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/storage'/><link
rel='statistics'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/statistics'/><link
rel='tags'
href='/api/hosts/b5451c38-62ac-11e1-95af-cb24f78bf058/tags'/><address>10.1.1.1</address><status><state>up</state></status><cluster
id='ab8b835a-3082-11e1-91cc-7f4f89555ebe'
href='/api/clusters/aa2fc21c-62ac-11e1-b777-8b6fbce883d4'><id>aa2fc21c-62ac-11e1-b777-8b6fbce883d4</id></cluster><power_management
type='rsa'><enabled>false</enabled><address>10.35.35.35</address><username>user</username><options></options></power_management><storage_manager>false</storage_manager><iscsi><initiator>iqn.1994-05.com.redhat:f59061d31269</initiator></iscsi></host>



<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<fault>
    <reason>Operation Failed</reason>
    <detail>[Cannot ${action} ${type}. Host parameters cannot be modified while Host is operational.
Please switch Host to Maintenance mode first.]</detail>
</fault>


2012-03-04 12:38:57,419 ERROR [org.ovirt.engine.core.utils.ObjectIdentityChecker] (http--0.0.0.0-8080-2) [11115173] Field vds_group_id can not be updated when status is Up
2012-03-04 12:38:57,422 WARN  [org.ovirt.engine.core.bll.ChangeVDSClusterCommand] (http--0.0.0.0-8080-2) [11115173] CanDoAction of action ChangeVDSCluster failed. Reasons:VDS_STATUS_NOT_VALID_FOR_UPDATE
2012-03-04 12:38:57,424 ERROR [org.ovirt.engine.api.restapi.resource.AbstractBackendResource] (http--0.0.0.0-8080-2) Operation Failed: [Cannot ${action} ${type}. Host parameters cannot be modified while Host is operational.
Please switch Host to Maintenance mode first.]

Comment 3 Einav Cohen 2012-03-04 10:58:49 UTC
OK, now it is clearer:

When updating a Host, we are actually calling to 2 backend commands: UpdateVds and ChangeVDSCluster.
According to the engine.log files, it seems that the error message is sent appropriately (i.e. we get all 3 message components) for failure in UpdateVds, but the error message is not sent appropriately (i.e. we get only 1 out of 3 message components) for failure in ChangeVDSCluster.

[question is, why the general behaviour is different if calling from REST API vs. calling from the sdk]

Comment 4 Itamar Heim 2012-12-13 08:12:24 UTC
Closing old bugs. If this issue is still relevant/important in current version, please re-open the bug.