Description of problem: ----------------------- When trying to set hosted-engine shared config for storage, python error is seen - "a bytes-like object is required, not 'str'" Version-Release number of selected component (if applicable): ------------------------------------------------------------- ovirt-hosted-engine-setup-2.4.5-1.el8ev.noarch ovirt-hosted-engine-ha-2.4.3-1.el8ev.noarch How reproducible: ------------------ Always Steps to Reproduce: ------------------- 1. Set the shared storage config - # hosted-engine --set-shared-config storage newhost.example.com Actual results: --------------- Error seen Expected results: ------------------ Successfully modify shared config storage
this is the root cause exception: >>> from ovirt_hosted_engine_ha.client import client >>> ha_cli = client.HAClient() >>> ha_cli.set_shared_config("storage","192.168.100.1:/opt/shared2","he_shared") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/site-packages/ovirt_hosted_engine_ha/client/client.py", line 259, in set_shared_config self._config.set_config_on_shared_storage(key, value, config_type) File "/usr/lib/python3.6/site-packages/ovirt_hosted_engine_ha/env/config.py", line 154, in set_config_on_shared_storage final_type.set_and_write(key, value) File "/usr/lib/python3.6/site-packages/ovirt_hosted_engine_ha/env/config_shared.py", line 80, in set_and_write self._update_content_on_shared_conf(content) File "/usr/lib/python3.6/site-packages/ovirt_hosted_engine_ha/env/config_shared.py", line 92, in _update_content_on_shared_conf volumepath File "/usr/lib/python3.6/site-packages/ovirt_hosted_engine_ha/lib/heconflib.py", line 183, in add_file_to_conf_archive content_by_name[envconst.HEConfFiles.HECONFD_VM_CONF] File "/usr/lib/python3.6/site-packages/ovirt_hosted_engine_ha/lib/heconflib.py", line 304, in _create_temp_archive agentconst.PACKAGE_VERSION, File "/usr/lib/python3.6/site-packages/ovirt_hosted_engine_ha/lib/heconflib.py", line 57, in _add_to_tar tar.addfile(tarinfo=info, fileobj=value) File "/usr/lib64/python3.6/tarfile.py", line 1980, in addfile copyfileobj(fileobj, self.fileobj, tarinfo.size, bufsize=bufsize) File "/usr/lib64/python3.6/tarfile.py", line 258, in copyfileobj dst.write(buf) TypeError: a bytes-like object is required, not 'str'
Hi Evgeny, When testing with the patch merged, I see problem related to 'BytesIO' not impoted. [root@ ]# hosted-engine --set-shared-config storage rhsqa-grafton12.lab.eng.blr.redhat.com:/engine --type=he_shared name 'BytesIO' is not defined In the heconflib.py, just replaced - "from io import StringIO" with "from io import BytesIO", then it worked. Can you include that fix as part of this patch ?
Moving back to assigned as per comment #3
done, sorry about that, I've verified it only with monkey patching :)
Tested with ovirt-hosted-engine-ha-2.4.4-1.el8ev.noarch When setting the shared config, no errors are seen [root@ ]# hosted-engine --set-shared-config storage rhsqa-grafton12.lab.eng.blr.redhat.com:/engine --type=he_shared [root@ ]# echo $? [root@ ]# 0
This bugzilla is included in oVirt 4.4.1 release, published on July 8th 2020. Since the problem described in this bug report should be resolved in oVirt 4.4.1 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.
looks good