NVME Python3 target

Bug #1855855 reported by Lenny
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Fix Released
Undecided
Lenny

Bug Description

cinder/cinder/volume/targets/nvmet.py def _restore function fails in python3

Dec 10 11:20:01.744663 dev-r-vrt-021-008 cinder-volume[4516]: DEBUG oslo_concurrency.lockutils [req-81f24623-a3f7-4733-9815-f353d60013f0 req-56b4e238-584f-4b49-8446-f66cbf2f8986 demo None] Lock "nvmetcli" released by "cinder.volume.targets.nvmet.NVMET.create_nvmeof_target" :: held 4.795s {{(pid=4569) inner /usr/local/lib/python3.6/site-packages/oslo_concurrency/lockutils.py:370}}
Dec 10 11:20:01.752333 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server [req-81f24623-a3f7-4733-9815-f353d60013f0 req-56b4e238-584f-4b49-8446-f66cbf2f8986 demo None] Exception during message handling: TypeError: a bytes-like object is required, not 'str'
Dec 10 11:20:01.753012 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server Traceback (most recent call last):
Dec 10 11:20:01.753452 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python3.6/site-packages/oslo_messaging/rpc/server.py", line 172, in _process_incoming
Dec 10 11:20:01.753880 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server res = self.dispatcher.dispatch(message)
Dec 10 11:20:01.754327 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python3.6/site-packages/oslo_messaging/rpc/dispatcher.py", line 274, in dispatch
Dec 10 11:20:01.754772 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server return self._do_dispatch(endpoint, method, ctxt, args)
Dec 10 11:20:01.755214 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python3.6/site-packages/oslo_messaging/rpc/dispatcher.py", line 194, in _do_dispatch
Dec 10 11:20:01.755633 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server result = func(ctxt, **new_args)
Dec 10 11:20:01.756058 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/manager.py", line 4553, in attachment_update
Dec 10 11:20:01.756515 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server connector)
Dec 10 11:20:01.756987 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/manager.py", line 4481, in _connection_create
Dec 10 11:20:01.757471 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server volume, connector)
Dec 10 11:20:01.757954 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/drivers/lvm.py", line 831, in create_export
Dec 10 11:20:01.758458 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server volume_path)
Dec 10 11:20:01.758923 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/targets/nvmeof.py", line 135, in create_export
Dec 10 11:20:01.759394 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server volume_path)
Dec 10 11:20:01.759844 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/usr/local/lib/python3.6/site-packages/oslo_concurrency/lockutils.py", line 359, in inner
Dec 10 11:20:01.760314 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server return f(*args, **kwargs)
Dec 10 11:20:01.760774 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/targets/nvmet.py", line 66, in create_nvmeof_target
Dec 10 11:20:01.761403 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server ns_id, volume_id, volume_path)
Dec 10 11:20:01.761968 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/targets/nvmet.py", line 140, in _add_nvmf_subsystem
Dec 10 11:20:01.762431 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server self._restore(nvmf_subsystems)
Dec 10 11:20:01.762936 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/opt/stack/cinder/cinder/volume/targets/nvmet.py", line 89, in _restore
Dec 10 11:20:01.763375 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server tmp_fd.write(json.dumps(nvmf_subsystems))
Dec 10 11:20:01.763864 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server File "/usr/lib64/python3.6/tempfile.py", line 485, in func_wrapper
Dec 10 11:20:01.764326 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server return func(*args, **kwargs)
Dec 10 11:20:01.764825 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server TypeError: a bytes-like object is required, not 'str'
Dec 10 11:20:01.765277 dev-r-vrt-021-008 cinder-volume[4516]: ERROR oslo_messaging.rpc.server
"/opt/stack/logs/c-vol.service.log" 3324L, 1015829C

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cinder (master)

Fix proposed to branch: master
Review: https://review.opendev.org/698202

Changed in cinder:
assignee: nobody → Lenny (lennyb)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to cinder (master)

Reviewed: https://review.opendev.org/698202
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=195e12b1c10ed37b425a753a1723aca9f16d4a85
Submitter: Zuul
Branch: master

commit 195e12b1c10ed37b425a753a1723aca9f16d4a85
Author: Lenny Verkhovsky <email address hidden>
Date: Tue Dec 10 11:42:52 2019 +0200

    Fixed open tempfile.NamedTemporaryFile as text in Python3

    Python3 opens tempfile by default as binary[1] and not as ascii,
    and nvmetcli writes json output as ascii.

    This issue was overlooked with Python2, since binary and ascii
    variables are less distiguished there.

    [1] https://docs.python.org/3/library/tempfile.html
    [2] https://bugs.python.org/issue29245

    Change-Id: Ia1f280ab64f0dc90824d4cb9ed20a8537af32ef6
    Closes-Bug: 1855855

Changed in cinder:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/cinder 16.0.0.0b1

This issue was fixed in the openstack/cinder 16.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.