Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1786451

Summary: hosted-engine --add-console-password fails with: expected string or bytes-like object
Product: [oVirt] vdsm Reporter: Yedidyah Bar David <didi>
Component: CoreAssignee: Yedidyah Bar David <didi>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Kubica <pkubica>
Severity: high Docs Contact:
Priority: high    
Version: 4.40.0CC: bugs, pkubica
Target Milestone: ovirt-4.4.0Flags: sbonazzo: ovirt-4.4?
sbonazzo: devel_ack+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-20 20:04:07 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:
Embargoed:

Description Yedidyah Bar David 2019-12-25 09:45:38 UTC
Description of problem:

With current master snapshot, after deploy, trying to set a console password fails with:

# hosted-engine --add-console-password --password=pass
Command VM.updateDevice with args {'vmID': 'b3bc7f7b-2b88-4758-8192-05242f61ba21', 'params': {'deviceType': 'graphics', 'existingConnAction': 'keep', 'graphicsType': 'vnc', 'params': {}, 'ttl': '120', 'password': 'pass'}} failed:
(code=100, message=General Exception: ('expected string or bytes-like object',))

In vdsm.log:

2019-12-25 11:39:00,880+0200 INFO  (jsonrpc/3) [api.virt] START updateDevice(params={'deviceType': 'graphics', 'existingConnAction': 'keep', 'graphicsType': 'vnc', 'params': {}, 'ttl': '120'
, 'password': '********'}) from=::1,50446, vmId=b3bc7f7b-2b88-4758-8192-05242f61ba21 (api:48)
2019-12-25 11:39:00,899+0200 ERROR (jsonrpc/3) [api] FINISH updateDevice error=expected string or bytes-like object (api:134)
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/vdsm/common/api.py", line 124, in method
    ret = func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/vdsm/API.py", line 357, in updateDevice
    return self.vm.updateDevice(params)
  File "/usr/lib/python3.6/site-packages/vdsm/virt/vm.py", line 2985, in updateDevice
    return self._updateGraphicsDevice(params)
  File "/usr/lib/python3.6/site-packages/vdsm/virt/vm.py", line 2961, in _updateGraphicsDevice
    params['params']
  File "/usr/lib/python3.6/site-packages/vdsm/virt/vm.py", line 4644, in _setTicketForGraphicDev
    saslpasswd2.remove_vnc_password(vnc_username)
  File "/usr/lib/python3.6/site-packages/vdsm/virt/saslpasswd2.py", line 50, in remove_vnc_password
    return supervdsm.getProxy().saslpasswd2_remove_vnc_password(username)
  File "/usr/lib/python3.6/site-packages/vdsm/common/supervdsm.py", line 56, in __call__
    return callMethod()
  File "/usr/lib/python3.6/site-packages/vdsm/common/supervdsm.py", line 54, in <lambda>
    **kwargs)
  File "<string>", line 2, in saslpasswd2_remove_vnc_password
  File "/usr/lib64/python3.6/multiprocessing/managers.py", line 772, in _callmethod
    raise convert_to_error(kind, result)
TypeError: expected string or bytes-like object

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


How reproducible:
Always, I think.

Steps to Reproduce:
1. Deploy hosted-engine
2. hosted-engine --add-console-password --password=pass
3.

Actual results:
Fails as above

Expected results:
Succeeds

Additional info:

Checking the git log, I think this is a result of:

https://gerrit.ovirt.org/98354

There, the line:

    elif vnc_username is not None:

Was changed to 'else:', so unconditionally we call:

        saslpasswd2.remove_vnc_password(vnc_username)

Since we do not pass a username:

https://github.com/oVirt/ovirt-hosted-engine-setup/blob/master/src/ovirt_hosted_engine_setup/vdsm_helper.py#L96

This fails. Well, I think.

If this change is intended, please move the bug to hosted-engine and tell us what missing params we should pass. Otherwise, please revert that part of the patch, or whatever that's needed to solve this bug. Thanks.

Comment 1 Yedidyah Bar David 2019-12-25 09:57:14 UTC
Now verified that changing the line as explained in Addition Info indeed fixes the bug and I can get a vnc console.

Comment 2 Tomasz Barański 2020-01-07 11:06:00 UTC
Yeah, I think I simplified the code too much.

Does this fix the problem or is there anything more to it?

Comment 3 Yedidyah Bar David 2020-01-07 11:09:51 UTC
(In reply to Tomasz Barański from comment #2)
> Yeah, I think I simplified the code too much.
> 
> Does this fix the problem or is there anything more to it?

This fixes, see comment 1.

Comment 4 Petr Kubica 2020-01-23 14:32:01 UTC
Still failing:
ovirt-ansible-hosted-engine-setup-1.0.34-1.el8ev.noarch
ovirt-hosted-engine-setup-2.4.0-1.el8ev.noarch
ovirt-hosted-engine-ha-2.4.0-1.el8ev.noarch
vdsm-4.40.0-180.giteba0b75.el8ev.x86_64

# hosted-engine --add-console-password --password=pass
Command VM.updateDevice with args {'vmID': '398121a7-2571-44da-8cab-f5eea646ab1a', 'params': {'deviceType': 'graphics', 'existingConnAction': 'keep', 'graphicsType': 'vnc', 'params': {}, 'ttl': '120', 'password': 'pass'}} failed:
(code=100, message=General Exception: ('expected string or bytes-like object',))

vdsm.log:
2020-01-23 15:28:45,302+0100 ERROR (jsonrpc/7) [api] FINISH updateDevice error=expected string or bytes-like object (api:134)
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/vdsm/common/api.py", line 124, in method
    ret = func(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/vdsm/API.py", line 357, in updateDevice
    return self.vm.updateDevice(params)
  File "/usr/lib/python3.6/site-packages/vdsm/virt/vm.py", line 2985, in updateDevice
    return self._updateGraphicsDevice(params)
  File "/usr/lib/python3.6/site-packages/vdsm/virt/vm.py", line 2961, in _updateGraphicsDevice
    params['params']
  File "/usr/lib/python3.6/site-packages/vdsm/virt/vm.py", line 4644, in _setTicketForGraphicDev
    saslpasswd2.remove_vnc_password(vnc_username)
  File "/usr/lib/python3.6/site-packages/vdsm/virt/saslpasswd2.py", line 50, in remove_vnc_password
    return supervdsm.getProxy().saslpasswd2_remove_vnc_password(username)
  File "/usr/lib/python3.6/site-packages/vdsm/common/supervdsm.py", line 56, in __call__
    return callMethod()
  File "/usr/lib/python3.6/site-packages/vdsm/common/supervdsm.py", line 54, in <lambda>
    **kwargs)
  File "<string>", line 2, in saslpasswd2_remove_vnc_password
  File "/usr/lib64/python3.6/multiprocessing/managers.py", line 772, in _callmethod
    raise convert_to_error(kind, result)
TypeError: expected string or bytes-like object

reproduce steps:
1. deploy hosted-engine
2. hosted-engine --add-console-password --password=pass

Comment 5 Yedidyah Bar David 2020-01-26 07:06:21 UTC
I think that the build you used does not include the fix, please try a newer one. Thanks.

Comment 6 Petr Kubica 2020-01-31 12:15:17 UTC
I used build from 2020-01-17 which came in 9 days after this bug was moved to ON_QA.

But I tried the newest one and it works
"You can now connect the hosted-engine VM with VNC at ..."

Verified in vdsm-4.40.1-1.el8ev.x86_64

Comment 7 Sandro Bonazzola 2020-05-20 20:04:07 UTC
This bugzilla is included in oVirt 4.4.0 release, published on May 20th 2020.

Since the problem described in this bug report should be
resolved in oVirt 4.4.0 release, it has been closed with a resolution of CURRENT RELEASE.

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