Bug 1745597

Summary: LVM DBus API doesn't work with Python 3.8
Product: [Community] LVM and device-mapper Reporter: Vojtech Trefny <vtrefny>
Component: lvm2Assignee: Marian Csontos <mcsontos>
lvm2 sub component: lvmdbusd QA Contact: cluster-qe <cluster-qe>
Status: CLOSED NEXTRELEASE Docs Contact:
Severity: unspecified    
Priority: unspecified CC: agk, awilliam, heinzm, jbrassow, msnitzer, prajnoha, tasleson, zkabelac
Version: unspecifiedFlags: pm-rhel: lvm-technical-solution?
pm-rhel: lvm-test-coverage?
Target Milestone: ---   
Target Release: ---   
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: 2019-09-25 14:10:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1745740    
Attachments:
Description Flags
patch none

Description Vojtech Trefny 2019-08-26 12:56:45 UTC
Created attachment 1608124 [details]
patch

Changes in Python 3.8 implementation of __str__ method for object class cause lvmdbusd to produce invalid lvm commands.

Error example:

Failed to call the 'LvCreate' method on the '/com/redhat/lvmdbus1/Vg/0' object: GDBus.Error:org.freedesktop.DBus.Python.dbus.exceptions.DBusException: ('com.redhat.lvmdbus1.Vg', 'Exit code 3, stderr =   Invalid argument for --stripes: dbus.Int32(2, variant_level=1)\n  Error during parsing of command line.\n')

The problem is with converting dbus.UInt types to string lvmdbusd:

On Python 3.8:

>>> str(dbus.Int64(1))
'dbus.Int64(1)'

On Python 3.7 (and older):
>>> str(dbus.UInt64(1))
'1'

I have created a simple patch to fix this, it fixes errors discovered by libblockdev test suite.

This might be something that should be fixed in python-dbus, but I also think that lvmdbusd shouldn't rely on dbus __str__ functions to produce a valid string and explicitly converting dbus.UInt types to integer first is a safer solution.

LVM version:

  LVM version:     2.03.05(2) (2019-06-15)
  Library version: 1.02.163 (2019-06-15)
  Driver version:  4.40.0

Comment 1 Tony Asleson 2019-08-27 14:45:35 UTC
Patch committed upstream: https://sourceware.org/git/?p=lvm2.git;a=commit;h=32a8865a272d31d5bc12332a4da0309ce3af9243

Comment 2 Zdenek Kabelac 2019-08-28 14:11:36 UTC
*** Bug 1745740 has been marked as a duplicate of this bug. ***