Bug 1404360

Summary: update on host_broker fails with reason conflict also if nothing has to be updated
Product: [oVirt] ovirt-hosted-engine-setup Reporter: Simone Tiraboschi <stirabos>
Component: GeneralAssignee: Simone Tiraboschi <stirabos>
Status: CLOSED CURRENTRELEASE QA Contact: Artyom <alukiano>
Severity: low Docs Contact:
Priority: unspecified    
Version: ---CC: bugs, mperina, oourfali, stirabos
Target Milestone: ovirt-4.2.0Keywords: Triaged
Target Release: 2.2.0Flags: rule-engine: ovirt-4.2+
rule-engine: planning_ack+
sbonazzo: devel_ack+
mavital: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-20 11:10:59 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Simone Tiraboschi 2016-12-13 16:27:39 UTC
Description of problem:
update on host_broker fails with reason conflict also if nothing has to be updated.

This small python script could reproduce the issue:
 import ovirtsdk.api
 
 fqdn='enginevm.localdomain'
 username='admin@internal'
 password='mypassword'
 
 engine_api = ovirtsdk.api.API(
     url='https://{fqdn}/ovirt-engine/api'.format(
         fqdn=fqdn,
     ),
     username=username,
     password=password,
     insecure=True,
 )
 
 h = engine_api.hosts.list()[0]
 host_broker = engine_api.hosts.get(id=h.get_id())
 host_broker.update()



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


How reproducible:


Steps to Reproduce:
1. run the provided script on an host not in maintenance mode
2.
3.

Actual results:
[root@c72he20161213h1 ~]# python test.py 
Traceback (most recent call last):
  File "test.py", line 18, in <module>
    host_broker.update()
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/brokers.py", line 14157, in update
    headers={"Correlation-Id":correlation_id, "Expect":expect}
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 68, in update
    return self.request('PUT', url, body, headers, cls=cls)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/proxy.py", line 122, in request
    persistent_auth=self.__persistent_auth
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py", line 79, in do_request
    persistent_auth)
  File "/usr/lib/python2.7/site-packages/ovirtsdk/infrastructure/connectionspool.py", line 162, in __do_request
    raise errors.RequestError(response_code, response_reason, response_body)
ovirtsdk.infrastructure.errors.RequestError: 
status: 409
reason: Conflict
detail: Cannot edit Host. Host parameters cannot be modified while Host is operational.
Please switch Host to Maintenance mode first.


Expected results:
If nothing has to be updated, it shouldn't fail

Additional info:
In 3.6 and 4.0 the same code wasn't failing.

Comment 1 Simone Tiraboschi 2016-12-14 13:47:53 UTC
This is currently blocking ovirt-hosted-engine-setup since it uses host_broker.upgrade to poll till the host gets into the right status.

Comment 2 Oved Ourfali 2016-12-14 13:50:59 UTC
(In reply to Simone Tiraboschi from comment #1)
> This is currently blocking ovirt-hosted-engine-setup since it uses
> host_broker.upgrade to poll till the host gets into the right status

It doesn't make sense to use update and poll (HTTP PUT).
Why not to just get the object (HTTP GET)?

Comment 3 Simone Tiraboschi 2016-12-14 14:34:35 UTC
(In reply to Oved Ourfali from comment #2)
> (In reply to Simone Tiraboschi from comment #1)
> > This is currently blocking ovirt-hosted-engine-setup since it uses
> > host_broker.upgrade to poll till the host gets into the right status
> 
> It doesn't make sense to use update and poll (HTTP PUT).
> Why not to just get the object (HTTP GET)?

We just need a patch on ovirt-hosted-engine-setup.
Not that complex.

Comment 4 Sandro Bonazzola 2016-12-14 14:38:31 UTC
(In reply to Oved Ourfali from comment #2)
> (In reply to Simone Tiraboschi from comment #1)
> > This is currently blocking ovirt-hosted-engine-setup since it uses
> > host_broker.upgrade to poll till the host gets into the right status
> 
> It doesn't make sense to use update and poll (HTTP PUT).
> Why not to just get the object (HTTP GET)?

can you please paste here the code to fix to the reproducer code in the bug description?

Comment 5 Oved Ourfali 2016-12-14 14:43:57 UTC
(In reply to Sandro Bonazzola from comment #4)
> (In reply to Oved Ourfali from comment #2)
> > (In reply to Simone Tiraboschi from comment #1)
> > > This is currently blocking ovirt-hosted-engine-setup since it uses
> > > host_broker.upgrade to poll till the host gets into the right status
> > 
> > It doesn't make sense to use update and poll (HTTP PUT).
> > Why not to just get the object (HTTP GET)?
> 
> can you please paste here the code to fix to the reproducer code in the bug
> description?

Seems like Simone knows what to do.
If needed he can contact me offline.

Comment 6 Red Hat Bugzilla Rules Engine 2016-12-27 16:39:47 UTC
This bug report has Keywords: Regression or TestBlocker.
Since no regressions or test blockers are allowed between releases, it is also being identified as a blocker for this release. Please resolve ASAP.

Comment 7 Martin Perina 2017-03-01 11:04:25 UTC
There has been issue about inability to update some host attributes while host is not in maintenance, but AFAIK all of them should be fixed in 4.1.1. So is this still a regression or even a blocker? I know the fix make sense and should be present anyway, but is this still an issue on 4.1.1 even without the fix? If not then we may remove regression/blocker from the bug, right?

Comment 8 Simone Tiraboschi 2017-03-01 11:08:29 UTC
We modified ovirt-hosted-engine-setup code to use GET instead of POST for that requests so for sure it's not a blocker anymore although it's still worth to get it fixed.

Comment 9 Martin Perina 2017-03-01 11:28:23 UTC
OK, removing Regression and blocker? and also moving to Integration, as the fix is provided within HE setup code. If there's something more needed from infra feel free to move back

Comment 10 Artyom 2017-09-17 07:56:52 UTC
Verified on ovirt-hosted-engine-setup-2.2.0-0.0.master.20170913082146.git120d800.el7.centos.noarch

[root@master-vds10 ovirt-hosted-engine-ha]# python test_bug.py 
[root@master-vds10 ovirt-hosted-engine-ha]#

Script pass without any Tracebacks

Comment 11 Sandro Bonazzola 2017-12-20 11:10:59 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.