Bug 1745597 - LVM DBus API doesn't work with Python 3.8
Summary: LVM DBus API doesn't work with Python 3.8
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Marian Csontos
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On:
Blocks: 1745740
TreeView+ depends on / blocked
 
Reported: 2019-08-26 12:56 UTC by Vojtech Trefny
Modified: 2019-09-25 14:10 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2019-09-25 14:10:12 UTC
Embargoed:
pm-rhel: lvm-technical-solution?
pm-rhel: lvm-test-coverage?


Attachments (Terms of Use)
patch (5.08 KB, application/mbox)
2019-08-26 12:56 UTC, Vojtech Trefny
no flags Details

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. ***


Note You need to log in before you can comment on or make changes to this bug.