From 6313bae883d4ad0ab2abb2ad44dd7f48b9e69305 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 27 Aug 2019 08:03:58 -0700 Subject: [PATCH] Backport fix for converting dbus.UInt to string in Python 3.8 --- ...converting-dbus.UInt-types-to-string.patch | 149 ++++++++++++++++++ lvm2.spec | 7 +- 2 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 lvm2-2_03_06-Fix-converting-dbus.UInt-types-to-string.patch diff --git a/lvm2-2_03_06-Fix-converting-dbus.UInt-types-to-string.patch b/lvm2-2_03_06-Fix-converting-dbus.UInt-types-to-string.patch new file mode 100644 index 0000000..a6a1422 --- /dev/null +++ b/lvm2-2_03_06-Fix-converting-dbus.UInt-types-to-string.patch @@ -0,0 +1,149 @@ +From 32a8865a272d31d5bc12332a4da0309ce3af9243 Mon Sep 17 00:00:00 2001 +From: Vojtech Trefny +Date: Mon, 26 Aug 2019 14:35:51 +0200 +Subject: [PATCH] Fix converting dbus.UInt types to string + +With Python 3.8 converting these directly to string using str() +no longer works, we need to convert these to integer first. + +On Python 3.8: + +>>> str(dbus.Int64(1)) +'dbus.Int64(1)' + +On Python 3.7 (and older): +>>> str(dbus.UInt64(1)) +'1' + +This is probably related to removing __str__ function from method +from int (dbus.UInt is subclass of int) which happened in 3.8, see +https://docs.python.org/3.8/whatsnew/3.8.html + +Signed-off-by: Vojtech Trefny +--- + daemons/lvmdbusd/cmdhandler.py | 35 ++++++++++++++++++---------------- + 1 file changed, 19 insertions(+), 16 deletions(-) + +diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py +index df854eb84..f7f6acdf9 100644 +--- a/daemons/lvmdbusd/cmdhandler.py ++++ b/daemons/lvmdbusd/cmdhandler.py +@@ -217,7 +217,10 @@ def options_to_cli_args(options): + else: + rc.append("--%s" % k) + if v != "": +- rc.append(str(v)) ++ if isinstance(v, int): ++ rc.append(str(int(v))) ++ else: ++ rc.append(str(v)) + return rc + + +@@ -280,7 +283,7 @@ def vg_remove(vg_name, remove_options): + def vg_lv_create(vg_name, create_options, name, size_bytes, pv_dests): + cmd = ['lvcreate'] + cmd.extend(options_to_cli_args(create_options)) +- cmd.extend(['--size', str(size_bytes) + 'B']) ++ cmd.extend(['--size', '%dB' % size_bytes]) + cmd.extend(['--name', name, vg_name, '--yes']) + pv_dest_ranges(cmd, pv_dests) + return call(cmd) +@@ -292,7 +295,7 @@ def vg_lv_snapshot(vg_name, snapshot_options, name, size_bytes): + cmd.extend(["-s"]) + + if size_bytes != 0: +- cmd.extend(['--size', str(size_bytes) + 'B']) ++ cmd.extend(['--size', '%dB' % size_bytes]) + + cmd.extend(['--name', name, vg_name]) + return call(cmd) +@@ -303,9 +306,9 @@ def _vg_lv_create_common_cmd(create_options, size_bytes, thin_pool): + cmd.extend(options_to_cli_args(create_options)) + + if not thin_pool: +- cmd.extend(['--size', str(size_bytes) + 'B']) ++ cmd.extend(['--size', '%dB' % size_bytes]) + else: +- cmd.extend(['--thin', '--size', str(size_bytes) + 'B']) ++ cmd.extend(['--thin', '--size', '%dB' % size_bytes]) + + cmd.extend(['--yes']) + return cmd +@@ -320,10 +323,10 @@ def vg_lv_create_linear(vg_name, create_options, name, size_bytes, thin_pool): + def vg_lv_create_striped(vg_name, create_options, name, size_bytes, + num_stripes, stripe_size_kb, thin_pool): + cmd = _vg_lv_create_common_cmd(create_options, size_bytes, thin_pool) +- cmd.extend(['--stripes', str(num_stripes)]) ++ cmd.extend(['--stripes', str(int(num_stripes))]) + + if stripe_size_kb != 0: +- cmd.extend(['--stripesize', str(stripe_size_kb)]) ++ cmd.extend(['--stripesize', str(int(stripe_size_kb))]) + + cmd.extend(['--name', name, vg_name]) + return call(cmd) +@@ -336,13 +339,13 @@ def _vg_lv_create_raid(vg_name, create_options, name, raid_type, size_bytes, + cmd.extend(options_to_cli_args(create_options)) + + cmd.extend(['--type', raid_type]) +- cmd.extend(['--size', str(size_bytes) + 'B']) ++ cmd.extend(['--size', '%dB' % size_bytes]) + + if num_stripes != 0: +- cmd.extend(['--stripes', str(num_stripes)]) ++ cmd.extend(['--stripes', str(int(num_stripes))]) + + if stripe_size_kb != 0: +- cmd.extend(['--stripesize', str(stripe_size_kb)]) ++ cmd.extend(['--stripesize', str(int(stripe_size_kb))]) + + cmd.extend(['--name', name, vg_name, '--yes']) + return call(cmd) +@@ -363,8 +366,8 @@ def vg_lv_create_mirror( + cmd.extend(options_to_cli_args(create_options)) + + cmd.extend(['--type', 'mirror']) +- cmd.extend(['--mirrors', str(num_copies)]) +- cmd.extend(['--size', str(size_bytes) + 'B']) ++ cmd.extend(['--mirrors', str(int(num_copies))]) ++ cmd.extend(['--size', '%dB' % size_bytes]) + cmd.extend(['--name', name, vg_name, '--yes']) + return call(cmd) + +@@ -418,7 +421,7 @@ def lv_resize(lv_full_name, size_change, pv_dests, + def lv_lv_create(lv_full_name, create_options, name, size_bytes): + cmd = ['lvcreate'] + cmd.extend(options_to_cli_args(create_options)) +- cmd.extend(['--virtualsize', str(size_bytes) + 'B', '-T']) ++ cmd.extend(['--virtualsize', '%dB' % size_bytes, '-T']) + cmd.extend(['--name', name, lv_full_name, '--yes']) + return call(cmd) + +@@ -556,7 +559,7 @@ def pv_resize(device, size_bytes, create_options): + cmd.extend(options_to_cli_args(create_options)) + + if size_bytes != 0: +- cmd.extend(['--yes', '--setphysicalvolumesize', str(size_bytes) + 'B']) ++ cmd.extend(['--yes', '--setphysicalvolumesize', '%dB' % size_bytes]) + + cmd.extend([device]) + return call(cmd) +@@ -652,12 +655,12 @@ def vg_allocation_policy(vg_name, policy, policy_options): + + + def vg_max_pv(vg_name, number, max_options): +- return _vg_value_set(vg_name, ['--maxphysicalvolumes', str(number)], ++ return _vg_value_set(vg_name, ['--maxphysicalvolumes', str(int(number))], + max_options) + + + def vg_max_lv(vg_name, number, max_options): +- return _vg_value_set(vg_name, ['-l', str(number)], max_options) ++ return _vg_value_set(vg_name, ['-l', str(int(number))], max_options) + + + def vg_uuid_gen(vg_name, ignore, options): +-- +2.23.0 + diff --git a/lvm2.spec b/lvm2.spec index 1cf93de..bf4e4ef 100644 --- a/lvm2.spec +++ b/lvm2.spec @@ -57,7 +57,7 @@ Name: lvm2 Epoch: %{rhel} %endif Version: 2.03.05 -Release: 2%{?dist} +Release: 3%{?dist} License: GPLv2 URL: http://sourceware.org/lvm2 #Source0: ftp://sourceware.org/pub/lvm2/releases/LVM2.%%{version}.tgz @@ -66,6 +66,7 @@ Patch0: lvm2-set-default-preferred_names.patch Patch1: lvm2-2_03_06-md-component-detection-for-differing-PV-and-device-size.patch Patch2: lvm2-2_03_06-pvscan-fix-PV-online-when-device-has-a-different-size.patch Patch3: lvm2-2_03_06-lvconvert-allow-stripes-stripesize-in-mirror-conversions.patch +Patch4: lvm2-2_03_06-Fix-converting-dbus.UInt-types-to-string.patch BuildRequires: gcc %if %{enable_testsuite} @@ -125,6 +126,7 @@ or more physical volumes and creating one or more logical volumes %patch1 -p1 -b .md_component_detection_diff_PV_and_dev_size %patch2 -p1 -b .fix_PV_activation_diff_PV_and_dev_size %patch3 -p1 -b .allow_mirror_conversion_with_stripes +%patch4 -p1 -b .fix_converting_dbus.UInt_types_to_string %build %global _default_pid_dir /run @@ -730,6 +732,9 @@ An extensive functional testsuite for LVM2. %endif %changelog +* Tue Aug 27 2019 Adam Williamson - 2.03.05-3 +- Backport fix for converting dbus.UInt to string in Python 3.8 (#1745597) + * Mon Aug 19 2019 Miro HronĨok - 2.03.05-2 - Rebuilt for Python 3.8