Rebase to latest upstream release 3.4.0
Resolves: rhbz#1964341
This commit is contained in:
		
							parent
							
								
									16ec02563c
								
							
						
					
					
						commit
						66ecf7e795
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -133,3 +133,5 @@ | |||||||
| /blivet-3.3.2.tar.gz | /blivet-3.3.2.tar.gz | ||||||
| /blivet-3.3.3-tests.tar.gz | /blivet-3.3.3-tests.tar.gz | ||||||
| /blivet-3.3.3.tar.gz | /blivet-3.3.3.tar.gz | ||||||
|  | /blivet-3.4.0-tests.tar.gz | ||||||
|  | /blivet-3.4.0.tar.gz | ||||||
|  | |||||||
							
								
								
									
										35
									
								
								0001-force-lvm-cli-plugin.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								0001-force-lvm-cli-plugin.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | |||||||
|  | From 2f90040ff66eacc9715e370cd49ffb72d8d1f36f Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Vojtech Trefny <vtrefny@redhat.com> | ||||||
|  | Date: Wed, 11 Jul 2018 15:36:24 +0200 | ||||||
|  | Subject: [PATCH] Force command line based libblockdev LVM plugin | ||||||
|  | 
 | ||||||
|  | ---
 | ||||||
|  |  blivet/__init__.py | 9 +++++++-- | ||||||
|  |  1 file changed, 7 insertions(+), 2 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/blivet/__init__.py b/blivet/__init__.py
 | ||||||
|  | index c5a75bb..cb75917 100644
 | ||||||
|  | --- a/blivet/__init__.py
 | ||||||
|  | +++ b/blivet/__init__.py
 | ||||||
|  | @@ -63,11 +63,16 @@ gi.require_version("BlockDev", "2.0")
 | ||||||
|  |  from gi.repository import GLib | ||||||
|  |  from gi.repository import BlockDev as blockdev | ||||||
|  |  if arch.is_s390(): | ||||||
|  | -    _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
 | ||||||
|  | +    _REQUESTED_PLUGIN_NAMES = set(("btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
 | ||||||
|  |  else: | ||||||
|  | -    _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
 | ||||||
|  | +    _REQUESTED_PLUGIN_NAMES = set(("btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
 | ||||||
|  |   | ||||||
|  |  _requested_plugins = blockdev.plugin_specs_from_names(_REQUESTED_PLUGIN_NAMES) | ||||||
|  | +# XXX force non-dbus LVM plugin
 | ||||||
|  | +lvm_plugin = blockdev.PluginSpec()
 | ||||||
|  | +lvm_plugin.name = blockdev.Plugin.LVM
 | ||||||
|  | +lvm_plugin.so_name = "libbd_lvm.so.2"
 | ||||||
|  | +_requested_plugins.append(lvm_plugin)
 | ||||||
|  |  try: | ||||||
|  |      # do not check for dependencies during libblockdev initializtion, do runtime | ||||||
|  |      # checks instead | ||||||
|  | -- 
 | ||||||
|  | 1.8.3.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										28
									
								
								0002-remove-btrfs-plugin.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								0002-remove-btrfs-plugin.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,28 @@ | |||||||
|  | From 6bf3378d3d2a1b6a4338df0c4dd36a783a641633 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Vojtech Trefny <vtrefny@redhat.com> | ||||||
|  | Date: Mon, 16 Jul 2018 14:26:11 +0200 | ||||||
|  | Subject: [PATCH] Remove btrfs from requested libblockdev plugins | ||||||
|  | 
 | ||||||
|  | ---
 | ||||||
|  |  blivet/__init__.py | 4 ++-- | ||||||
|  |  1 file changed, 2 insertions(+), 2 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/blivet/__init__.py b/blivet/__init__.py
 | ||||||
|  | index cb75917..09f8b1c 100644
 | ||||||
|  | --- a/blivet/__init__.py
 | ||||||
|  | +++ b/blivet/__init__.py
 | ||||||
|  | @@ -63,9 +63,9 @@ gi.require_version("BlockDev", "2.0")
 | ||||||
|  |  from gi.repository import GLib | ||||||
|  |  from gi.repository import BlockDev as blockdev | ||||||
|  |  if arch.is_s390(): | ||||||
|  | -    _REQUESTED_PLUGIN_NAMES = set(("btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
 | ||||||
|  | +    _REQUESTED_PLUGIN_NAMES = set(("swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
 | ||||||
|  |  else: | ||||||
|  | -    _REQUESTED_PLUGIN_NAMES = set(("btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
 | ||||||
|  | +    _REQUESTED_PLUGIN_NAMES = set(("swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
 | ||||||
|  |   | ||||||
|  |  _requested_plugins = blockdev.plugin_specs_from_names(_REQUESTED_PLUGIN_NAMES) | ||||||
|  |  # XXX force non-dbus LVM plugin | ||||||
|  | -- 
 | ||||||
|  | 1.8.3.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										330
									
								
								0003-Revert-More-consistent-lvm-errors.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										330
									
								
								0003-Revert-More-consistent-lvm-errors.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,330 @@ | |||||||
|  | From 3a42d9e2afdf04dbbfd2c507f5b2392193fda25b Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Vojtech Trefny <vtrefny@redhat.com> | ||||||
|  | Date: Wed, 26 May 2021 12:15:54 +0200 | ||||||
|  | Subject: [PATCH] Revert "More consistent lvm errors (API break)" | ||||||
|  | 
 | ||||||
|  | This reverts commit 49ec071c6d0673224a0774d613904387c52c7381. | ||||||
|  | ---
 | ||||||
|  |  blivet/devices/lvm.py          | 72 +++++++++++++++++----------------- | ||||||
|  |  tests/devices_test/lvm_test.py | 14 +++---- | ||||||
|  |  2 files changed, 43 insertions(+), 43 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
 | ||||||
|  | index a55515fc..6d23bfba 100644
 | ||||||
|  | --- a/blivet/devices/lvm.py
 | ||||||
|  | +++ b/blivet/devices/lvm.py
 | ||||||
|  | @@ -307,7 +307,7 @@ class LVMVolumeGroupDevice(ContainerDevice):
 | ||||||
|  |      def _add_log_vol(self, lv): | ||||||
|  |          """ Add an LV to this VG. """ | ||||||
|  |          if lv in self._lvs: | ||||||
|  | -            raise errors.DeviceError("lv is already part of this vg")
 | ||||||
|  | +            raise ValueError("lv is already part of this vg")
 | ||||||
|  |   | ||||||
|  |          # verify we have the space, then add it | ||||||
|  |          # do not verify for growing vg (because of ks) | ||||||
|  | @@ -340,7 +340,7 @@ class LVMVolumeGroupDevice(ContainerDevice):
 | ||||||
|  |      def _remove_log_vol(self, lv): | ||||||
|  |          """ Remove an LV from this VG. """ | ||||||
|  |          if lv not in self.lvs: | ||||||
|  | -            raise errors.DeviceError("specified lv is not part of this vg")
 | ||||||
|  | +            raise ValueError("specified lv is not part of this vg")
 | ||||||
|  |   | ||||||
|  |          self._lvs.remove(lv) | ||||||
|  |   | ||||||
|  | @@ -415,7 +415,7 @@ class LVMVolumeGroupDevice(ContainerDevice):
 | ||||||
|  |      @thpool_reserve.setter | ||||||
|  |      def thpool_reserve(self, value): | ||||||
|  |          if value is not None and not isinstance(value, ThPoolReserveSpec): | ||||||
|  | -            raise AttributeError("Invalid thpool_reserve given, must be of type ThPoolReserveSpec")
 | ||||||
|  | +            raise ValueError("Invalid thpool_reserve given, must be of type ThPoolReserveSpec")
 | ||||||
|  |          self._thpool_reserve = value | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  | @@ -646,14 +646,14 @@ class LVMLogicalVolumeBase(DMDevice, RaidDevice):
 | ||||||
|  |              if seg_type not in [None, "linear", "thin", "thin-pool", "cache", "vdo-pool", "vdo"] + lvm.raid_seg_types: | ||||||
|  |                  raise ValueError("Invalid or unsupported segment type: %s" % seg_type) | ||||||
|  |              if seg_type and seg_type in lvm.raid_seg_types and not pvs: | ||||||
|  | -                raise errors.DeviceError("List of PVs has to be given for every non-linear LV")
 | ||||||
|  | +                raise ValueError("List of PVs has to be given for every non-linear LV")
 | ||||||
|  |              elif (not seg_type or seg_type == "linear") and pvs: | ||||||
|  |                  if not all(isinstance(pv, LVPVSpec) for pv in pvs): | ||||||
|  | -                    raise errors.DeviceError("Invalid specification of PVs for a linear LV: either no or complete "
 | ||||||
|  | -                                             "specification (with all space split into PVs has to be given")
 | ||||||
|  | +                    raise ValueError("Invalid specification of PVs for a linear LV: either no or complete "
 | ||||||
|  | +                                     "specification (with all space split into PVs has to be given")
 | ||||||
|  |                  elif sum(spec.size for spec in pvs) != size: | ||||||
|  | -                    raise errors.DeviceError("Invalid specification of PVs for a linear LV: the sum of space "
 | ||||||
|  | -                                             "assigned to PVs is not equal to the size of the LV")
 | ||||||
|  | +                    raise ValueError("Invalid specification of PVs for a linear LV: the sum of space "
 | ||||||
|  | +                                     "assigned to PVs is not equal to the size of the LV")
 | ||||||
|  |   | ||||||
|  |          # When this device's format is set in the superclass constructor it will | ||||||
|  |          # try to access self.snapshots. | ||||||
|  | @@ -702,13 +702,13 @@ class LVMLogicalVolumeBase(DMDevice, RaidDevice):
 | ||||||
|  |          self._from_lvs = from_lvs | ||||||
|  |          if self._from_lvs: | ||||||
|  |              if exists: | ||||||
|  | -                raise errors.DeviceError("Only new LVs can be created from other LVs")
 | ||||||
|  | +                raise ValueError("Only new LVs can be created from other LVs")
 | ||||||
|  |              if size or maxsize or percent: | ||||||
|  | -                raise errors.DeviceError("Cannot specify size for a converted LV")
 | ||||||
|  | +                raise ValueError("Cannot specify size for a converted LV")
 | ||||||
|  |              if fmt: | ||||||
|  | -                raise errors.DeviceError("Cannot specify format for a converted LV")
 | ||||||
|  | +                raise ValueError("Cannot specify format for a converted LV")
 | ||||||
|  |              if any(lv.vg != self.vg for lv in self._from_lvs): | ||||||
|  | -                raise errors.DeviceError("Conversion of LVs only possible inside a VG")
 | ||||||
|  | +                raise ValueError("Conversion of LVs only possible inside a VG")
 | ||||||
|  |   | ||||||
|  |          self._cache = None | ||||||
|  |          if cache_request and not self.exists: | ||||||
|  | @@ -723,13 +723,13 @@ class LVMLogicalVolumeBase(DMDevice, RaidDevice):
 | ||||||
|  |              elif isinstance(pv_spec, StorageDevice): | ||||||
|  |                  self._pv_specs.append(LVPVSpec(pv_spec, Size(0))) | ||||||
|  |              else: | ||||||
|  | -                raise AttributeError("Invalid PV spec '%s' for the '%s' LV" % (pv_spec, self.name))
 | ||||||
|  | +                raise ValueError("Invalid PV spec '%s' for the '%s' LV" % (pv_spec, self.name))
 | ||||||
|  |          # Make sure any destination PVs are actually PVs in this VG | ||||||
|  |          if not set(spec.pv for spec in self._pv_specs).issubset(set(self.vg.parents)): | ||||||
|  |              missing = [r.name for r in | ||||||
|  |                         set(spec.pv for spec in self._pv_specs).difference(set(self.vg.parents))] | ||||||
|  |              msg = "invalid destination PV(s) %s for LV %s" % (missing, self.name) | ||||||
|  | -            raise errors.DeviceError(msg)
 | ||||||
|  | +            raise ValueError(msg)
 | ||||||
|  |          if self._pv_specs: | ||||||
|  |              self._assign_pv_space() | ||||||
|  |   | ||||||
|  | @@ -1072,7 +1072,7 @@ class LVMLogicalVolumeBase(DMDevice, RaidDevice):
 | ||||||
|  |          else: | ||||||
|  |              msg = "the specified internal LV '%s' doesn't belong to this LV ('%s')" % (int_lv.lv_name, | ||||||
|  |                                                                                         self.name) | ||||||
|  | -            raise errors.DeviceError(msg)
 | ||||||
|  | +            raise ValueError(msg)
 | ||||||
|  |   | ||||||
|  |      def populate_ksdata(self, data): | ||||||
|  |          super(LVMLogicalVolumeBase, self).populate_ksdata(data) | ||||||
|  | @@ -1171,7 +1171,7 @@ class LVMInternalLogicalVolumeMixin(object):
 | ||||||
|  |      def _init_check(self): | ||||||
|  |          # an internal LV should have no parents | ||||||
|  |          if self._parent_lv and self._parents: | ||||||
|  | -            raise errors.DeviceError("an internal LV should have no parents")
 | ||||||
|  | +            raise ValueError("an internal LV should have no parents")
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def is_internal_lv(self): | ||||||
|  | @@ -1231,7 +1231,7 @@ class LVMInternalLogicalVolumeMixin(object):
 | ||||||
|  |   | ||||||
|  |      @readonly.setter | ||||||
|  |      def readonly(self, value):  # pylint: disable=unused-argument | ||||||
|  | -        raise errors.DeviceError("Cannot make an internal LV read-write")
 | ||||||
|  | +        raise ValueError("Cannot make an internal LV read-write")
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def type(self): | ||||||
|  | @@ -1267,7 +1267,7 @@ class LVMInternalLogicalVolumeMixin(object):
 | ||||||
|  |      def _check_parents(self): | ||||||
|  |          # an internal LV should have no parents | ||||||
|  |          if self._parents: | ||||||
|  | -            raise errors.DeviceError("an internal LV should have no parents")
 | ||||||
|  | +            raise ValueError("an internal LV should have no parents")
 | ||||||
|  |   | ||||||
|  |      def _add_to_parents(self): | ||||||
|  |          # nothing to do here, an internal LV has no parents (in the DeviceTree's | ||||||
|  | @@ -1277,13 +1277,13 @@ class LVMInternalLogicalVolumeMixin(object):
 | ||||||
|  |      # internal LVs follow different rules limitting size | ||||||
|  |      def _set_size(self, newsize): | ||||||
|  |          if not isinstance(newsize, Size): | ||||||
|  | -            raise AttributeError("new size must of type Size")
 | ||||||
|  | +            raise ValueError("new size must of type Size")
 | ||||||
|  |   | ||||||
|  |          if not self.takes_extra_space: | ||||||
|  |              if newsize <= self.parent_lv.size:  # pylint: disable=no-member | ||||||
|  |                  self._size = newsize  # pylint: disable=attribute-defined-outside-init | ||||||
|  |              else: | ||||||
|  | -                raise errors.DeviceError("Internal LV cannot be bigger than its parent LV")
 | ||||||
|  | +                raise ValueError("Internal LV cannot be bigger than its parent LV")
 | ||||||
|  |          else: | ||||||
|  |              # same rules apply as for any other LV | ||||||
|  |              raise NotTypeSpecific() | ||||||
|  | @@ -1361,18 +1361,18 @@ class LVMSnapshotMixin(object):
 | ||||||
|  |              return | ||||||
|  |   | ||||||
|  |          if self.origin and not isinstance(self.origin, LVMLogicalVolumeDevice): | ||||||
|  | -            raise errors.DeviceError("lvm snapshot origin must be a logical volume")
 | ||||||
|  | +            raise ValueError("lvm snapshot origin must be a logical volume")
 | ||||||
|  |          if self.vorigin and not self.exists: | ||||||
|  | -            raise errors.DeviceError("only existing vorigin snapshots are supported")
 | ||||||
|  | +            raise ValueError("only existing vorigin snapshots are supported")
 | ||||||
|  |   | ||||||
|  |          if isinstance(self.origin, LVMLogicalVolumeDevice) and \ | ||||||
|  |             isinstance(self.parents[0], LVMVolumeGroupDevice) and \ | ||||||
|  |             self.origin.vg != self.parents[0]: | ||||||
|  | -            raise errors.DeviceError("lvm snapshot and origin must be in the same vg")
 | ||||||
|  | +            raise ValueError("lvm snapshot and origin must be in the same vg")
 | ||||||
|  |   | ||||||
|  |          if self.is_thin_lv: | ||||||
|  |              if self.origin and self.size and not self.exists: | ||||||
|  | -                raise errors.DeviceError("thin snapshot size is determined automatically")
 | ||||||
|  | +                raise ValueError("thin snapshot size is determined automatically")
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def is_snapshot_lv(self): | ||||||
|  | @@ -1544,7 +1544,7 @@ class LVMThinPoolMixin(object):
 | ||||||
|  |      def _check_from_lvs(self): | ||||||
|  |          if self._from_lvs: | ||||||
|  |              if len(self._from_lvs) != 2: | ||||||
|  | -                raise errors.DeviceError("two LVs required to create a thin pool")
 | ||||||
|  | +                raise ValueError("two LVs required to create a thin pool")
 | ||||||
|  |   | ||||||
|  |      def _convert_from_lvs(self): | ||||||
|  |          data_lv, metadata_lv = self._from_lvs | ||||||
|  | @@ -1590,7 +1590,7 @@ class LVMThinPoolMixin(object):
 | ||||||
|  |      def _add_log_vol(self, lv): | ||||||
|  |          """ Add an LV to this pool. """ | ||||||
|  |          if lv in self._lvs: | ||||||
|  | -            raise errors.DeviceError("lv is already part of this vg")
 | ||||||
|  | +            raise ValueError("lv is already part of this vg")
 | ||||||
|  |   | ||||||
|  |          # TODO: add some checking to prevent overcommit for preexisting | ||||||
|  |          self.vg._add_log_vol(lv) | ||||||
|  | @@ -1601,7 +1601,7 @@ class LVMThinPoolMixin(object):
 | ||||||
|  |      def _remove_log_vol(self, lv): | ||||||
|  |          """ Remove an LV from this pool. """ | ||||||
|  |          if lv not in self._lvs: | ||||||
|  | -            raise errors.DeviceError("specified lv is not part of this vg")
 | ||||||
|  | +            raise ValueError("specified lv is not part of this vg")
 | ||||||
|  |   | ||||||
|  |          self._lvs.remove(lv) | ||||||
|  |          self.vg._remove_log_vol(lv) | ||||||
|  | @@ -1711,14 +1711,14 @@ class LVMThinLogicalVolumeMixin(object):
 | ||||||
|  |          """Check that this device has parents as expected""" | ||||||
|  |          if isinstance(self.parents, (list, ParentList)): | ||||||
|  |              if len(self.parents) != 1: | ||||||
|  | -                raise errors.DeviceError("constructor requires a single thin-pool LV")
 | ||||||
|  | +                raise ValueError("constructor requires a single thin-pool LV")
 | ||||||
|  |   | ||||||
|  |              container = self.parents[0] | ||||||
|  |          else: | ||||||
|  |              container = self.parents | ||||||
|  |   | ||||||
|  |          if not container or not isinstance(container, LVMLogicalVolumeDevice) or not container.is_thin_pool: | ||||||
|  | -            raise errors.DeviceError("constructor requires a thin-pool LV")
 | ||||||
|  | +            raise ValueError("constructor requires a thin-pool LV")
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def is_thin_lv(self): | ||||||
|  | @@ -1755,7 +1755,7 @@ class LVMThinLogicalVolumeMixin(object):
 | ||||||
|  |   | ||||||
|  |      def _set_size(self, newsize): | ||||||
|  |          if not isinstance(newsize, Size): | ||||||
|  | -            raise AttributeError("new size must of type Size")
 | ||||||
|  | +            raise ValueError("new size must of type Size")
 | ||||||
|  |   | ||||||
|  |          newsize = self.vg.align(newsize) | ||||||
|  |          newsize = self.vg.align(util.numeric_type(newsize)) | ||||||
|  | @@ -2229,7 +2229,7 @@ class LVMLogicalVolumeDevice(LVMLogicalVolumeBase, LVMInternalLogicalVolumeMixin
 | ||||||
|  |              container = self.parents | ||||||
|  |   | ||||||
|  |          if not isinstance(container, LVMVolumeGroupDevice): | ||||||
|  | -            raise AttributeError("constructor requires a LVMVolumeGroupDevice")
 | ||||||
|  | +            raise ValueError("constructor requires a LVMVolumeGroupDevice")
 | ||||||
|  |   | ||||||
|  |      @type_specific | ||||||
|  |      def _add_to_parents(self): | ||||||
|  | @@ -2240,12 +2240,12 @@ class LVMLogicalVolumeDevice(LVMLogicalVolumeBase, LVMInternalLogicalVolumeMixin
 | ||||||
|  |      @type_specific | ||||||
|  |      def _check_from_lvs(self): | ||||||
|  |          """Check the LVs to create this LV from""" | ||||||
|  | -        raise errors.DeviceError("Cannot create a new LV of type '%s' from other LVs" % self.seg_type)
 | ||||||
|  | +        raise ValueError("Cannot create a new LV of type '%s' from other LVs" % self.seg_type)
 | ||||||
|  |   | ||||||
|  |      @type_specific | ||||||
|  |      def _convert_from_lvs(self): | ||||||
|  |          """Convert the LVs to create this LV from into its internal LVs""" | ||||||
|  | -        raise errors.DeviceError("Cannot create a new LV of type '%s' from other LVs" % self.seg_type)
 | ||||||
|  | +        raise ValueError("Cannot create a new LV of type '%s' from other LVs" % self.seg_type)
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def external_dependencies(self): | ||||||
|  | @@ -2265,7 +2265,7 @@ class LVMLogicalVolumeDevice(LVMLogicalVolumeBase, LVMInternalLogicalVolumeMixin
 | ||||||
|  |      @type_specific | ||||||
|  |      def _set_size(self, newsize): | ||||||
|  |          if not isinstance(newsize, Size): | ||||||
|  | -            raise AttributeError("new size must be of type Size")
 | ||||||
|  | +            raise ValueError("new size must be of type Size")
 | ||||||
|  |   | ||||||
|  |          newsize = self.vg.align(newsize) | ||||||
|  |          log.debug("trying to set lv %s size to %s", self.name, newsize) | ||||||
|  | @@ -2274,7 +2274,7 @@ class LVMLogicalVolumeDevice(LVMLogicalVolumeBase, LVMInternalLogicalVolumeMixin
 | ||||||
|  |          # space for it. A similar reasoning applies to shrinking the LV. | ||||||
|  |          if not self.exists and newsize > self.size and newsize > self.vg.free_space + self.vg_space_used: | ||||||
|  |              log.error("failed to set size: %s short", newsize - (self.vg.free_space + self.vg_space_used)) | ||||||
|  | -            raise errors.DeviceError("not enough free space in volume group")
 | ||||||
|  | +            raise ValueError("not enough free space in volume group")
 | ||||||
|  |   | ||||||
|  |          LVMLogicalVolumeBase._set_size(self, newsize) | ||||||
|  |   | ||||||
|  | @@ -2622,7 +2622,7 @@ class LVMCache(Cache):
 | ||||||
|  |                  spec.size = spec.pv.format.free | ||||||
|  |                  space_to_assign -= spec.pv.format.free | ||||||
|  |          if space_to_assign > 0: | ||||||
|  | -            raise errors.DeviceError("Not enough free space in the PVs for this cache: %s short" % space_to_assign)
 | ||||||
|  | +            raise ValueError("Not enough free space in the PVs for this cache: %s short" % space_to_assign)
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def size(self): | ||||||
|  | diff --git a/tests/devices_test/lvm_test.py b/tests/devices_test/lvm_test.py
 | ||||||
|  | index 670c91c9..4156d0bf 100644
 | ||||||
|  | --- a/tests/devices_test/lvm_test.py
 | ||||||
|  | +++ b/tests/devices_test/lvm_test.py
 | ||||||
|  | @@ -36,10 +36,10 @@ class LVMDeviceTest(unittest.TestCase):
 | ||||||
|  |          lv = LVMLogicalVolumeDevice("testlv", parents=[vg], | ||||||
|  |                                      fmt=blivet.formats.get_format("xfs")) | ||||||
|  |   | ||||||
|  | -        with six.assertRaisesRegex(self, errors.DeviceError, "lvm snapshot origin must be a logical volume"):
 | ||||||
|  | +        with six.assertRaisesRegex(self, ValueError, "lvm snapshot origin must be a logical volume"):
 | ||||||
|  |              LVMLogicalVolumeDevice("snap1", parents=[vg], origin=pv) | ||||||
|  |   | ||||||
|  | -        with six.assertRaisesRegex(self, errors.DeviceError, "only existing vorigin snapshots are supported"):
 | ||||||
|  | +        with six.assertRaisesRegex(self, ValueError, "only existing vorigin snapshots are supported"):
 | ||||||
|  |              LVMLogicalVolumeDevice("snap1", parents=[vg], vorigin=True) | ||||||
|  |   | ||||||
|  |          lv.exists = True | ||||||
|  | @@ -64,7 +64,7 @@ class LVMDeviceTest(unittest.TestCase):
 | ||||||
|  |          pool = LVMLogicalVolumeDevice("pool1", parents=[vg], size=Size("500 MiB"), seg_type="thin-pool") | ||||||
|  |          thinlv = LVMLogicalVolumeDevice("thinlv", parents=[pool], size=Size("200 MiB"), seg_type="thin") | ||||||
|  |   | ||||||
|  | -        with six.assertRaisesRegex(self, errors.DeviceError, "lvm snapshot origin must be a logical volume"):
 | ||||||
|  | +        with six.assertRaisesRegex(self, ValueError, "lvm snapshot origin must be a logical volume"):
 | ||||||
|  |              LVMLogicalVolumeDevice("snap1", parents=[pool], origin=pv, seg_type="thin") | ||||||
|  |   | ||||||
|  |          # now make the constructor succeed so we can test some properties | ||||||
|  | @@ -258,21 +258,21 @@ class LVMDeviceTest(unittest.TestCase):
 | ||||||
|  |          vg = LVMVolumeGroupDevice("testvg", parents=[pv, pv2]) | ||||||
|  |   | ||||||
|  |          # pvs have to be specified for non-linear LVs | ||||||
|  | -        with self.assertRaises(errors.DeviceError):
 | ||||||
|  | +        with self.assertRaises(ValueError):
 | ||||||
|  |              lv = LVMLogicalVolumeDevice("testlv", parents=[vg], size=Size("512 MiB"), | ||||||
|  |                                          fmt=blivet.formats.get_format("xfs"), | ||||||
|  |                                          exists=False, seg_type="raid1") | ||||||
|  | -        with self.assertRaises(errors.DeviceError):
 | ||||||
|  | +        with self.assertRaises(ValueError):
 | ||||||
|  |              lv = LVMLogicalVolumeDevice("testlv", parents=[vg], size=Size("512 MiB"), | ||||||
|  |                                          fmt=blivet.formats.get_format("xfs"), | ||||||
|  |                                          exists=False, seg_type="striped") | ||||||
|  |   | ||||||
|  |          # no or complete specification has to be given for linear LVs | ||||||
|  | -        with self.assertRaises(errors.DeviceError):
 | ||||||
|  | +        with self.assertRaises(ValueError):
 | ||||||
|  |              lv = LVMLogicalVolumeDevice("testlv", parents=[vg], size=Size("512 MiB"), | ||||||
|  |                                          fmt=blivet.formats.get_format("xfs"), | ||||||
|  |                                          exists=False, pvs=[pv]) | ||||||
|  | -        with self.assertRaises(errors.DeviceError):
 | ||||||
|  | +        with self.assertRaises(ValueError):
 | ||||||
|  |              pv_spec = LVPVSpec(pv, Size("256 MiB")) | ||||||
|  |              pv_spec2 = LVPVSpec(pv2, Size("250 MiB")) | ||||||
|  |              lv = LVMLogicalVolumeDevice("testlv", parents=[vg], size=Size("512 MiB"), | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										908
									
								
								0004-Revert-Terminology-cleanups.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										908
									
								
								0004-Revert-Terminology-cleanups.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,908 @@ | |||||||
|  | From 42042e7fb6177d3cfe5568e358a38278925a2624 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Vojtech Trefny <vtrefny@redhat.com> | ||||||
|  | Date: Wed, 26 May 2021 12:27:34 +0200 | ||||||
|  | Subject: [PATCH] Revert "Terminology cleanups" | ||||||
|  | 
 | ||||||
|  | This reverts following commits: | ||||||
|  | - 3d46339fe9cf12e9082fcbe4dc5acc9f92617e8d
 | ||||||
|  | - 63c9c7165e5cdfa4a47dcf0ed9d717b71e7921f2
 | ||||||
|  | - 8956b9af8a785ae25e0e7153d2ef0702ce2f567c
 | ||||||
|  | ---
 | ||||||
|  |  blivet/devicefactory.py               | 24 +++++----- | ||||||
|  |  blivet/devices/dm.py                  |  9 +++- | ||||||
|  |  blivet/devices/loop.py                | 20 ++++---- | ||||||
|  |  blivet/devices/luks.py                | 26 +++++----- | ||||||
|  |  blivet/errors.py                      |  2 +- | ||||||
|  |  blivet/partitioning.py                | 22 +++++++-- | ||||||
|  |  blivet/populator/helpers/dm.py        |  4 +- | ||||||
|  |  blivet/populator/helpers/luks.py      |  4 +- | ||||||
|  |  blivet/populator/helpers/lvm.py       |  2 +- | ||||||
|  |  blivet/populator/helpers/mdraid.py    | 14 +++--- | ||||||
|  |  blivet/populator/helpers/multipath.py |  8 ++-- | ||||||
|  |  blivet/populator/populator.py         | 69 ++++++++++++++------------- | ||||||
|  |  blivet/threads.py                     |  3 +- | ||||||
|  |  blivet/udev.py                        | 34 ++++++------- | ||||||
|  |  tests/devicefactory_test.py           | 10 ++-- | ||||||
|  |  tests/devices_test/size_test.py       |  6 +-- | ||||||
|  |  tests/populator_test.py               | 34 ++++++------- | ||||||
|  |  tests/udev_test.py                    | 12 ++--- | ||||||
|  |  tests/vmtests/vmbackedtestcase.py     |  2 +- | ||||||
|  |  19 files changed, 168 insertions(+), 137 deletions(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/blivet/devicefactory.py b/blivet/devicefactory.py
 | ||||||
|  | index 0f7fdfa1..f56bd9a3 100644
 | ||||||
|  | --- a/blivet/devicefactory.py
 | ||||||
|  | +++ b/blivet/devicefactory.py
 | ||||||
|  | @@ -849,12 +849,12 @@ class DeviceFactory(object):
 | ||||||
|  |                  parent_container.parents.remove(orig_device) | ||||||
|  |   | ||||||
|  |          if self.encrypted and isinstance(self.device, LUKSDevice) and \ | ||||||
|  | -                self.raw_device.format.luks_version != self.luks_version:
 | ||||||
|  | -            self.raw_device.format.luks_version = self.luks_version
 | ||||||
|  | +                self.device.slave.format.luks_version != self.luks_version:
 | ||||||
|  | +            self.device.slave.format.luks_version = self.luks_version
 | ||||||
|  |   | ||||||
|  |          if self.encrypted and isinstance(self.device, LUKSDevice) and \ | ||||||
|  | -                self.raw_device.format.luks_sector_size != self.luks_sector_size:
 | ||||||
|  | -            self.raw_device.format.luks_sector_size = self.luks_sector_size
 | ||||||
|  | +                self.device.slave.format.luks_sector_size != self.luks_sector_size:
 | ||||||
|  | +            self.device.slave.format.luks_sector_size = self.luks_sector_size
 | ||||||
|  |   | ||||||
|  |      def _set_name(self): | ||||||
|  |          if not self.device_name: | ||||||
|  | @@ -1173,11 +1173,11 @@ class PartitionSetFactory(PartitionFactory):
 | ||||||
|  |                      container.parents.remove(member) | ||||||
|  |                  self.storage.destroy_device(member) | ||||||
|  |                  members.remove(member) | ||||||
|  | -                self.storage.format_device(member.raw_device,
 | ||||||
|  | +                self.storage.format_device(member.slave,
 | ||||||
|  |                                             get_format(self.fstype)) | ||||||
|  | -                members.append(member.raw_device)
 | ||||||
|  | +                members.append(member.slave)
 | ||||||
|  |                  if container: | ||||||
|  | -                    container.parents.append(member.raw_device)
 | ||||||
|  | +                    container.parents.append(member.slave)
 | ||||||
|  |   | ||||||
|  |                  continue | ||||||
|  |   | ||||||
|  | @@ -1199,10 +1199,10 @@ class PartitionSetFactory(PartitionFactory):
 | ||||||
|  |   | ||||||
|  |                  continue | ||||||
|  |   | ||||||
|  | -            if member_encrypted and self.encrypted and self.luks_version != member.raw_device.format.luks_version:
 | ||||||
|  | -                member.raw_device.format.luks_version = self.luks_version
 | ||||||
|  | -            if member_encrypted and self.encrypted and self.luks_sector_size != member.raw_device.format.luks_sector_size:
 | ||||||
|  | -                member.raw_device.format.luks_sector_size = self.luks_sector_size
 | ||||||
|  | +            if member_encrypted and self.encrypted and self.luks_version != member.slave.format.luks_version:
 | ||||||
|  | +                member.slave.format.luks_version = self.luks_version
 | ||||||
|  | +            if member_encrypted and self.encrypted and self.luks_sector_size != member.slave.format.luks_sector_size:
 | ||||||
|  | +                member.slave.format.luks_sector_size = self.luks_sector_size
 | ||||||
|  |   | ||||||
|  |          ## | ||||||
|  |          # Prepare previously allocated member partitions for reallocation. | ||||||
|  | @@ -1262,7 +1262,7 @@ class PartitionSetFactory(PartitionFactory):
 | ||||||
|  |   | ||||||
|  |              if isinstance(member, LUKSDevice): | ||||||
|  |                  self.storage.destroy_device(member) | ||||||
|  | -                member = member.raw_device
 | ||||||
|  | +                member = member.slave
 | ||||||
|  |   | ||||||
|  |              self.storage.destroy_device(member) | ||||||
|  |   | ||||||
|  | diff --git a/blivet/devices/dm.py b/blivet/devices/dm.py
 | ||||||
|  | index 3529f61c..508a6f89 100644
 | ||||||
|  | --- a/blivet/devices/dm.py
 | ||||||
|  | +++ b/blivet/devices/dm.py
 | ||||||
|  | @@ -154,6 +154,11 @@ class DMDevice(StorageDevice):
 | ||||||
|  |          log_method_call(self, self.name, status=self.status) | ||||||
|  |          super(DMDevice, self)._set_name(value) | ||||||
|  |   | ||||||
|  | +    @property
 | ||||||
|  | +    def slave(self):
 | ||||||
|  | +        """ This device's backing device. """
 | ||||||
|  | +        return self.parents[0]
 | ||||||
|  | +
 | ||||||
|  |   | ||||||
|  |  class DMLinearDevice(DMDevice): | ||||||
|  |      _type = "dm-linear" | ||||||
|  | @@ -189,8 +194,8 @@ class DMLinearDevice(DMDevice):
 | ||||||
|  |          """ Open, or set up, a device. """ | ||||||
|  |          log_method_call(self, self.name, orig=orig, status=self.status, | ||||||
|  |                          controllable=self.controllable) | ||||||
|  | -        parent_length = self.parents[0].current_size / LINUX_SECTOR_SIZE
 | ||||||
|  | -        blockdev.dm.create_linear(self.name, self.parents[0].path, parent_length,
 | ||||||
|  | +        slave_length = self.slave.current_size / LINUX_SECTOR_SIZE
 | ||||||
|  | +        blockdev.dm.create_linear(self.name, self.slave.path, slave_length,
 | ||||||
|  |                                    self.dm_uuid) | ||||||
|  |   | ||||||
|  |      def _post_setup(self): | ||||||
|  | diff --git a/blivet/devices/loop.py b/blivet/devices/loop.py
 | ||||||
|  | index 0f4d7775..78f88d7d 100644
 | ||||||
|  | --- a/blivet/devices/loop.py
 | ||||||
|  | +++ b/blivet/devices/loop.py
 | ||||||
|  | @@ -73,7 +73,7 @@ class LoopDevice(StorageDevice):
 | ||||||
|  |   | ||||||
|  |      def update_name(self): | ||||||
|  |          """ Update this device's name. """ | ||||||
|  | -        if not self.parents[0].status:
 | ||||||
|  | +        if not self.slave.status:
 | ||||||
|  |              # if the backing device is inactive, so are we | ||||||
|  |              return self.name | ||||||
|  |   | ||||||
|  | @@ -81,7 +81,7 @@ class LoopDevice(StorageDevice):
 | ||||||
|  |              # if our name is loopN we must already be active | ||||||
|  |              return self.name | ||||||
|  |   | ||||||
|  | -        name = blockdev.loop.get_loop_name(self.parents[0].path)
 | ||||||
|  | +        name = blockdev.loop.get_loop_name(self.slave.path)
 | ||||||
|  |          if name.startswith("loop"): | ||||||
|  |              self.name = name | ||||||
|  |   | ||||||
|  | @@ -89,24 +89,24 @@ class LoopDevice(StorageDevice):
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def status(self): | ||||||
|  | -        return (self.parents[0].status and
 | ||||||
|  | +        return (self.slave.status and
 | ||||||
|  |                  self.name.startswith("loop") and | ||||||
|  | -                blockdev.loop.get_loop_name(self.parents[0].path) == self.name)
 | ||||||
|  | +                blockdev.loop.get_loop_name(self.slave.path) == self.name)
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def size(self): | ||||||
|  | -        return self.parents[0].size
 | ||||||
|  | +        return self.slave.size
 | ||||||
|  |   | ||||||
|  |      def _pre_setup(self, orig=False): | ||||||
|  | -        if not os.path.exists(self.parents[0].path):
 | ||||||
|  | -            raise errors.DeviceError("specified file (%s) does not exist" % self.parents[0].path)
 | ||||||
|  | +        if not os.path.exists(self.slave.path):
 | ||||||
|  | +            raise errors.DeviceError("specified file (%s) does not exist" % self.slave.path)
 | ||||||
|  |          return StorageDevice._pre_setup(self, orig=orig) | ||||||
|  |   | ||||||
|  |      def _setup(self, orig=False): | ||||||
|  |          """ Open, or set up, a device. """ | ||||||
|  |          log_method_call(self, self.name, orig=orig, status=self.status, | ||||||
|  |                          controllable=self.controllable) | ||||||
|  | -        blockdev.loop.setup(self.parents[0].path)
 | ||||||
|  | +        blockdev.loop.setup(self.slave.path)
 | ||||||
|  |   | ||||||
|  |      def _post_setup(self): | ||||||
|  |          StorageDevice._post_setup(self) | ||||||
|  | @@ -123,3 +123,7 @@ class LoopDevice(StorageDevice):
 | ||||||
|  |          StorageDevice._post_teardown(self, recursive=recursive) | ||||||
|  |          self.name = "tmploop%d" % self.id | ||||||
|  |          self.sysfs_path = '' | ||||||
|  | +
 | ||||||
|  | +    @property
 | ||||||
|  | +    def slave(self):
 | ||||||
|  | +        return self.parents[0]
 | ||||||
|  | diff --git a/blivet/devices/luks.py b/blivet/devices/luks.py
 | ||||||
|  | index 5d6d6c65..555f1acd 100644
 | ||||||
|  | --- a/blivet/devices/luks.py
 | ||||||
|  | +++ b/blivet/devices/luks.py
 | ||||||
|  | @@ -66,13 +66,17 @@ class LUKSDevice(DMCryptDevice):
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def raw_device(self): | ||||||
|  | +        return self.slave
 | ||||||
|  | +
 | ||||||
|  | +    @property
 | ||||||
|  | +    def slave(self):
 | ||||||
|  |          if self._has_integrity: | ||||||
|  |              return self.parents[0].parents[0] | ||||||
|  |          return self.parents[0] | ||||||
|  |   | ||||||
|  |      def _get_size(self): | ||||||
|  |          if not self.exists: | ||||||
|  | -            size = self.raw_device.size - crypto.LUKS_METADATA_SIZE
 | ||||||
|  | +            size = self.slave.size - crypto.LUKS_METADATA_SIZE
 | ||||||
|  |          elif self.resizable and self.target_size != Size(0): | ||||||
|  |              size = self.target_size | ||||||
|  |          else: | ||||||
|  | @@ -80,8 +84,8 @@ class LUKSDevice(DMCryptDevice):
 | ||||||
|  |          return size | ||||||
|  |   | ||||||
|  |      def _set_size(self, newsize): | ||||||
|  | -        if not self.exists and not self.raw_device.exists:
 | ||||||
|  | -            self.raw_device.size = newsize + crypto.LUKS_METADATA_SIZE
 | ||||||
|  | +        if not self.exists and not self.slave.exists:
 | ||||||
|  | +            self.slave.size = newsize + crypto.LUKS_METADATA_SIZE
 | ||||||
|  |   | ||||||
|  |              # just run the StorageDevice._set_size to make sure we are in the format limits | ||||||
|  |              super(LUKSDevice, self)._set_size(newsize - crypto.LUKS_METADATA_SIZE) | ||||||
|  | @@ -108,22 +112,22 @@ class LUKSDevice(DMCryptDevice):
 | ||||||
|  |              raise ValueError("size is smaller than the minimum for this device") | ||||||
|  |   | ||||||
|  |          # don't allow larger luks than size (or target size) of backing device | ||||||
|  | -        if newsize > (self.raw_device.size - crypto.LUKS_METADATA_SIZE):
 | ||||||
|  | +        if newsize > (self.slave.size - crypto.LUKS_METADATA_SIZE):
 | ||||||
|  |              log.error("requested size %s is larger than size of the backing device %s", | ||||||
|  | -                      newsize, self.raw_device.size)
 | ||||||
|  | +                      newsize, self.slave.size)
 | ||||||
|  |              raise ValueError("size is larger than the size of the backing device") | ||||||
|  |   | ||||||
|  |          if self.align_target_size(newsize) != newsize: | ||||||
|  |              raise ValueError("new size would violate alignment requirements") | ||||||
|  |   | ||||||
|  |      def _get_target_size(self): | ||||||
|  | -        return self.raw_device.format.target_size
 | ||||||
|  | +        return self.slave.format.target_size
 | ||||||
|  |   | ||||||
|  |      @property | ||||||
|  |      def max_size(self): | ||||||
|  |          """ The maximum size this luks device can be. Maximum is based on the | ||||||
|  |              maximum size of the backing device. """ | ||||||
|  | -        max_luks = self.raw_device.max_size - crypto.LUKS_METADATA_SIZE
 | ||||||
|  | +        max_luks = self.slave.max_size - crypto.LUKS_METADATA_SIZE
 | ||||||
|  |          max_format = self.format.max_size | ||||||
|  |          return min(max_luks, max_format) if max_format else max_luks | ||||||
|  |   | ||||||
|  | @@ -131,7 +135,7 @@ class LUKSDevice(DMCryptDevice):
 | ||||||
|  |      def resizable(self): | ||||||
|  |          """ Can this device be resized? """ | ||||||
|  |          return (self._resizable and self.exists and self.format.resizable and | ||||||
|  | -                self.raw_device.resizable and not self._has_integrity)
 | ||||||
|  | +                self.slave.resizable and not self._has_integrity)
 | ||||||
|  |   | ||||||
|  |      def resize(self): | ||||||
|  |          # size of LUKSDevice depends on size of the LUKS format on backing | ||||||
|  | @@ -139,7 +143,7 @@ class LUKSDevice(DMCryptDevice):
 | ||||||
|  |          log_method_call(self, self.name, status=self.status) | ||||||
|  |   | ||||||
|  |      def _post_create(self): | ||||||
|  | -        self.name = self.raw_device.format.map_name
 | ||||||
|  | +        self.name = self.slave.format.map_name
 | ||||||
|  |          StorageDevice._post_create(self) | ||||||
|  |   | ||||||
|  |      def _post_teardown(self, recursive=False): | ||||||
|  | @@ -162,10 +166,10 @@ class LUKSDevice(DMCryptDevice):
 | ||||||
|  |              self.name = new_name | ||||||
|  |   | ||||||
|  |      def dracut_setup_args(self): | ||||||
|  | -        return set(["rd.luks.uuid=luks-%s" % self.raw_device.format.uuid])
 | ||||||
|  | +        return set(["rd.luks.uuid=luks-%s" % self.slave.format.uuid])
 | ||||||
|  |   | ||||||
|  |      def populate_ksdata(self, data): | ||||||
|  | -        self.raw_device.populate_ksdata(data)
 | ||||||
|  | +        self.slave.populate_ksdata(data)
 | ||||||
|  |          data.encrypted = True | ||||||
|  |          super(LUKSDevice, self).populate_ksdata(data) | ||||||
|  |   | ||||||
|  | diff --git a/blivet/errors.py b/blivet/errors.py
 | ||||||
|  | index fd51283f..f6bf853a 100644
 | ||||||
|  | --- a/blivet/errors.py
 | ||||||
|  | +++ b/blivet/errors.py
 | ||||||
|  | @@ -192,7 +192,7 @@ class DeviceTreeError(StorageError):
 | ||||||
|  |      pass | ||||||
|  |   | ||||||
|  |   | ||||||
|  | -class NoParentsError(DeviceTreeError):
 | ||||||
|  | +class NoSlavesError(DeviceTreeError):
 | ||||||
|  |      pass | ||||||
|  |   | ||||||
|  |   | ||||||
|  | diff --git a/blivet/partitioning.py b/blivet/partitioning.py
 | ||||||
|  | index 53f9cc3f..ca0a55d1 100644
 | ||||||
|  | --- a/blivet/partitioning.py
 | ||||||
|  | +++ b/blivet/partitioning.py
 | ||||||
|  | @@ -32,7 +32,7 @@ import _ped
 | ||||||
|  |   | ||||||
|  |  from .errors import DeviceError, PartitioningError, AlignmentError | ||||||
|  |  from .flags import flags | ||||||
|  | -from .devices import Device, PartitionDevice, device_path_to_name
 | ||||||
|  | +from .devices import Device, PartitionDevice, LUKSDevice, device_path_to_name
 | ||||||
|  |  from .size import Size | ||||||
|  |  from .i18n import _ | ||||||
|  |  from .util import stringize, unicodeize, compare | ||||||
|  | @@ -1632,7 +1632,15 @@ class TotalSizeSet(object):
 | ||||||
|  |              :param size: the target combined size | ||||||
|  |              :type size: :class:`~.size.Size` | ||||||
|  |          """ | ||||||
|  | -        self.devices = [d.raw_device for d in devices]
 | ||||||
|  | +        self.devices = []
 | ||||||
|  | +        for device in devices:
 | ||||||
|  | +            if isinstance(device, LUKSDevice):
 | ||||||
|  | +                partition = device.slave
 | ||||||
|  | +            else:
 | ||||||
|  | +                partition = device
 | ||||||
|  | +
 | ||||||
|  | +            self.devices.append(partition)
 | ||||||
|  | +
 | ||||||
|  |          self.size = size | ||||||
|  |   | ||||||
|  |          self.requests = [] | ||||||
|  | @@ -1670,7 +1678,15 @@ class SameSizeSet(object):
 | ||||||
|  |              :keyword max_size: the maximum size for growable devices | ||||||
|  |              :type max_size: :class:`~.size.Size` | ||||||
|  |          """ | ||||||
|  | -        self.devices = [d.raw_device for d in devices]
 | ||||||
|  | +        self.devices = []
 | ||||||
|  | +        for device in devices:
 | ||||||
|  | +            if isinstance(device, LUKSDevice):
 | ||||||
|  | +                partition = device.slave
 | ||||||
|  | +            else:
 | ||||||
|  | +                partition = device
 | ||||||
|  | +
 | ||||||
|  | +            self.devices.append(partition)
 | ||||||
|  | +
 | ||||||
|  |          self.size = size / len(devices) | ||||||
|  |          self.grow = grow | ||||||
|  |          self.max_size = max_size | ||||||
|  | diff --git a/blivet/populator/helpers/dm.py b/blivet/populator/helpers/dm.py
 | ||||||
|  | index 30e99aa1..770736b0 100644
 | ||||||
|  | --- a/blivet/populator/helpers/dm.py
 | ||||||
|  | +++ b/blivet/populator/helpers/dm.py
 | ||||||
|  | @@ -46,13 +46,13 @@ class DMDevicePopulator(DevicePopulator):
 | ||||||
|  |          name = udev.device_get_name(self.data) | ||||||
|  |          log_method_call(self, name=name) | ||||||
|  |          sysfs_path = udev.device_get_sysfs_path(self.data) | ||||||
|  | -        parent_devices = self._devicetree._add_parent_devices(self.data)
 | ||||||
|  | +        slave_devices = self._devicetree._add_slave_devices(self.data)
 | ||||||
|  |          device = self._devicetree.get_device_by_name(name) | ||||||
|  |   | ||||||
|  |          if device is None: | ||||||
|  |              device = DMDevice(name, dm_uuid=self.data.get('DM_UUID'), | ||||||
|  |                                sysfs_path=sysfs_path, exists=True, | ||||||
|  | -                              parents=[parent_devices[0]])
 | ||||||
|  | +                              parents=[slave_devices[0]])
 | ||||||
|  |              device.protected = True | ||||||
|  |              device.controllable = False | ||||||
|  |              self._devicetree._add_device(device) | ||||||
|  | diff --git a/blivet/populator/helpers/luks.py b/blivet/populator/helpers/luks.py
 | ||||||
|  | index 52795a98..51488691 100644
 | ||||||
|  | --- a/blivet/populator/helpers/luks.py
 | ||||||
|  | +++ b/blivet/populator/helpers/luks.py
 | ||||||
|  | @@ -43,7 +43,7 @@ class LUKSDevicePopulator(DevicePopulator):
 | ||||||
|  |          return udev.device_is_dm_luks(data) | ||||||
|  |   | ||||||
|  |      def run(self): | ||||||
|  | -        parents = self._devicetree._add_parent_devices(self.data)
 | ||||||
|  | +        parents = self._devicetree._add_slave_devices(self.data)
 | ||||||
|  |          device = LUKSDevice(udev.device_get_name(self.data), | ||||||
|  |                              sysfs_path=udev.device_get_sysfs_path(self.data), | ||||||
|  |                              parents=parents, | ||||||
|  | @@ -58,7 +58,7 @@ class IntegrityDevicePopulator(DevicePopulator):
 | ||||||
|  |          return udev.device_is_dm_integrity(data) | ||||||
|  |   | ||||||
|  |      def run(self): | ||||||
|  | -        parents = self._devicetree._add_parent_devices(self.data)
 | ||||||
|  | +        parents = self._devicetree._add_slave_devices(self.data)
 | ||||||
|  |          device = IntegrityDevice(udev.device_get_name(self.data), | ||||||
|  |                                   sysfs_path=udev.device_get_sysfs_path(self.data), | ||||||
|  |                                   parents=parents, | ||||||
|  | diff --git a/blivet/populator/helpers/lvm.py b/blivet/populator/helpers/lvm.py
 | ||||||
|  | index c7adfa4e..b1626306 100644
 | ||||||
|  | --- a/blivet/populator/helpers/lvm.py
 | ||||||
|  | +++ b/blivet/populator/helpers/lvm.py
 | ||||||
|  | @@ -57,7 +57,7 @@ class LVMDevicePopulator(DevicePopulator):
 | ||||||
|  |              log.warning("found non-vg device with name %s", vg_name) | ||||||
|  |              device = None | ||||||
|  |   | ||||||
|  | -        self._devicetree._add_parent_devices(self.data)
 | ||||||
|  | +        self._devicetree._add_slave_devices(self.data)
 | ||||||
|  |   | ||||||
|  |          # LVM provides no means to resolve conflicts caused by duplicated VG | ||||||
|  |          # names, so we're just being optimistic here. Woo! | ||||||
|  | diff --git a/blivet/populator/helpers/mdraid.py b/blivet/populator/helpers/mdraid.py
 | ||||||
|  | index 3479e3f7..76aebf25 100644
 | ||||||
|  | --- a/blivet/populator/helpers/mdraid.py
 | ||||||
|  | +++ b/blivet/populator/helpers/mdraid.py
 | ||||||
|  | @@ -31,7 +31,7 @@ from ... import udev
 | ||||||
|  |  from ...devicelibs import raid | ||||||
|  |  from ...devices import MDRaidArrayDevice, MDContainerDevice | ||||||
|  |  from ...devices import device_path_to_name | ||||||
|  | -from ...errors import DeviceError, NoParentsError
 | ||||||
|  | +from ...errors import DeviceError, NoSlavesError
 | ||||||
|  |  from ...flags import flags | ||||||
|  |  from ...storage_log import log_method_call | ||||||
|  |  from .devicepopulator import DevicePopulator | ||||||
|  | @@ -52,12 +52,12 @@ class MDDevicePopulator(DevicePopulator):
 | ||||||
|  |          log_method_call(self, name=name) | ||||||
|  |   | ||||||
|  |          try: | ||||||
|  | -            self._devicetree._add_parent_devices(self.data)
 | ||||||
|  | -        except NoParentsError:
 | ||||||
|  | -            log.error("no parents found for mdarray %s, skipping", name)
 | ||||||
|  | +            self._devicetree._add_slave_devices(self.data)
 | ||||||
|  | +        except NoSlavesError:
 | ||||||
|  | +            log.error("no slaves found for mdarray %s, skipping", name)
 | ||||||
|  |              return None | ||||||
|  |   | ||||||
|  | -        # try to get the device again now that we've got all the parents
 | ||||||
|  | +        # try to get the device again now that we've got all the slaves
 | ||||||
|  |          device = self._devicetree.get_device_by_name(name, incomplete=flags.allow_imperfect_devices) | ||||||
|  |   | ||||||
|  |          if device is None: | ||||||
|  | @@ -74,8 +74,8 @@ class MDDevicePopulator(DevicePopulator):
 | ||||||
|  |              device.name = name | ||||||
|  |   | ||||||
|  |          if device is None: | ||||||
|  | -            # if we get here, we found all of the parent devices and
 | ||||||
|  | -            # something must be wrong -- if all of the parents are in
 | ||||||
|  | +            # if we get here, we found all of the slave devices and
 | ||||||
|  | +            # something must be wrong -- if all of the slaves are in
 | ||||||
|  |              # the tree, this device should be as well | ||||||
|  |              if name is None: | ||||||
|  |                  name = udev.device_get_name(self.data) | ||||||
|  | diff --git a/blivet/populator/helpers/multipath.py b/blivet/populator/helpers/multipath.py
 | ||||||
|  | index 96c0a9ad..10c745bf 100644
 | ||||||
|  | --- a/blivet/populator/helpers/multipath.py
 | ||||||
|  | +++ b/blivet/populator/helpers/multipath.py
 | ||||||
|  | @@ -40,13 +40,13 @@ class MultipathDevicePopulator(DevicePopulator):
 | ||||||
|  |          name = udev.device_get_name(self.data) | ||||||
|  |          log_method_call(self, name=name) | ||||||
|  |   | ||||||
|  | -        parent_devices = self._devicetree._add_parent_devices(self.data)
 | ||||||
|  | +        slave_devices = self._devicetree._add_slave_devices(self.data)
 | ||||||
|  |   | ||||||
|  |          device = None | ||||||
|  | -        if parent_devices:
 | ||||||
|  | -            device = MultipathDevice(name, parents=parent_devices,
 | ||||||
|  | +        if slave_devices:
 | ||||||
|  | +            device = MultipathDevice(name, parents=slave_devices,
 | ||||||
|  |                                       sysfs_path=udev.device_get_sysfs_path(self.data), | ||||||
|  | -                                     wwn=parent_devices[0].wwn)
 | ||||||
|  | +                                     wwn=slave_devices[0].wwn)
 | ||||||
|  |              self._devicetree._add_device(device) | ||||||
|  |   | ||||||
|  |          return device | ||||||
|  | diff --git a/blivet/populator/populator.py b/blivet/populator/populator.py
 | ||||||
|  | index 75bb1741..d252281d 100644
 | ||||||
|  | --- a/blivet/populator/populator.py
 | ||||||
|  | +++ b/blivet/populator/populator.py
 | ||||||
|  | @@ -31,7 +31,7 @@ gi.require_version("BlockDev", "2.0")
 | ||||||
|  |   | ||||||
|  |  from gi.repository import BlockDev as blockdev | ||||||
|  |   | ||||||
|  | -from ..errors import DeviceError, DeviceTreeError, NoParentsError
 | ||||||
|  | +from ..errors import DeviceError, DeviceTreeError, NoSlavesError
 | ||||||
|  |  from ..devices import DMLinearDevice, DMRaidArrayDevice | ||||||
|  |  from ..devices import FileDevice, LoopDevice | ||||||
|  |  from ..devices import MDRaidArrayDevice | ||||||
|  | @@ -92,55 +92,56 @@ class PopulatorMixin(object):
 | ||||||
|  |   | ||||||
|  |          self._cleanup = False | ||||||
|  |   | ||||||
|  | -    def _add_parent_devices(self, info):
 | ||||||
|  | -        """ Add all parents of a device, raising DeviceTreeError on failure.
 | ||||||
|  | +    def _add_slave_devices(self, info):
 | ||||||
|  | +        """ Add all slaves of a device, raising DeviceTreeError on failure.
 | ||||||
|  |   | ||||||
|  |              :param :class:`pyudev.Device` info: the device's udev info | ||||||
|  | -            :raises: :class:`~.errors.DeviceTreeError if no parents are found or
 | ||||||
|  | -                     if we fail to add any parent
 | ||||||
|  | -            :returns: a list of parent devices
 | ||||||
|  | +            :raises: :class:`~.errors.DeviceTreeError if no slaves are found or
 | ||||||
|  | +                     if we fail to add any slave
 | ||||||
|  | +            :returns: a list of slave devices
 | ||||||
|  |              :rtype: list of :class:`~.StorageDevice` | ||||||
|  |          """ | ||||||
|  |          name = udev.device_get_name(info) | ||||||
|  |          sysfs_path = udev.device_get_sysfs_path(info) | ||||||
|  | -        parent_dir = os.path.normpath("%s/slaves" % sysfs_path)
 | ||||||
|  | -        parent_names = os.listdir(parent_dir)
 | ||||||
|  | -        parent_devices = []
 | ||||||
|  | -        if not parent_names:
 | ||||||
|  | -            log.error("no parents found for %s", name)
 | ||||||
|  | -            raise NoParentsError("no parents found for device %s" % name)
 | ||||||
|  | -
 | ||||||
|  | -        for parent_name in parent_names:
 | ||||||
|  | -            path = os.path.normpath("%s/%s" % (parent_dir, parent_name))
 | ||||||
|  | -            parent_info = udev.get_device(os.path.realpath(path))
 | ||||||
|  | -
 | ||||||
|  | -            if not parent_info:
 | ||||||
|  | -                msg = "unable to get udev info for %s" % parent_name
 | ||||||
|  | +        slave_dir = os.path.normpath("%s/slaves" % sysfs_path)
 | ||||||
|  | +        slave_names = os.listdir(slave_dir)
 | ||||||
|  | +        slave_devices = []
 | ||||||
|  | +        if not slave_names:
 | ||||||
|  | +            log.error("no slaves found for %s", name)
 | ||||||
|  | +            raise NoSlavesError("no slaves found for device %s" % name)
 | ||||||
|  | +
 | ||||||
|  | +        for slave_name in slave_names:
 | ||||||
|  | +            path = os.path.normpath("%s/%s" % (slave_dir, slave_name))
 | ||||||
|  | +            slave_info = udev.get_device(os.path.realpath(path))
 | ||||||
|  | +
 | ||||||
|  | +            if not slave_info:
 | ||||||
|  | +                msg = "unable to get udev info for %s" % slave_name
 | ||||||
|  |                  raise DeviceTreeError(msg) | ||||||
|  |   | ||||||
|  |              # cciss in sysfs is "cciss!cXdYpZ" but we need "cciss/cXdYpZ" | ||||||
|  | -            parent_name = udev.device_get_name(parent_info).replace("!", "/")
 | ||||||
|  | -
 | ||||||
|  | -            parent_dev = self.get_device_by_name(parent_name)
 | ||||||
|  | -            if not parent_dev and parent_info:
 | ||||||
|  | -                # we haven't scanned the parent yet, so do it now
 | ||||||
|  | -                self.handle_device(parent_info)
 | ||||||
|  | -                parent_dev = self.get_device_by_name(parent_name)
 | ||||||
|  | -                if parent_dev is None:
 | ||||||
|  | +            slave_name = udev.device_get_name(slave_info).replace("!", "/")
 | ||||||
|  | +
 | ||||||
|  | +            slave_dev = self.get_device_by_name(slave_name)
 | ||||||
|  | +            if not slave_dev and slave_info:
 | ||||||
|  | +                # we haven't scanned the slave yet, so do it now
 | ||||||
|  | +                self.handle_device(slave_info)
 | ||||||
|  | +                slave_dev = self.get_device_by_name(slave_name)
 | ||||||
|  | +                if slave_dev is None:
 | ||||||
|  |                      if udev.device_is_dm_lvm(info): | ||||||
|  | -                        if parent_name not in lvs_info.cache:
 | ||||||
|  | +                        if slave_name not in lvs_info.cache:
 | ||||||
|  |                              # we do not expect hidden lvs to be in the tree | ||||||
|  |                              continue | ||||||
|  |   | ||||||
|  | -                    # if the current parent is still not in
 | ||||||
|  | +                    # if the current slave is still not in
 | ||||||
|  |                      # the tree, something has gone wrong | ||||||
|  | -                    log.error("failure scanning device %s: could not add parent %s", name, parent_name)
 | ||||||
|  | -                    msg = "failed to add parent %s of device %s" % (parent_name, name)
 | ||||||
|  | +                    log.error("failure scanning device %s: could not add slave %s", name, slave_name)
 | ||||||
|  | +                    msg = "failed to add slave %s of device %s" % (slave_name,
 | ||||||
|  | +                                                                   name)
 | ||||||
|  |                      raise DeviceTreeError(msg) | ||||||
|  |   | ||||||
|  | -            parent_devices.append(parent_dev)
 | ||||||
|  | +            slave_devices.append(slave_dev)
 | ||||||
|  |   | ||||||
|  | -        return parent_devices
 | ||||||
|  | +        return slave_devices
 | ||||||
|  |   | ||||||
|  |      def _add_name(self, name): | ||||||
|  |          if name not in self.names: | ||||||
|  | @@ -317,7 +318,7 @@ class PopulatorMixin(object):
 | ||||||
|  |                  continue | ||||||
|  |   | ||||||
|  |              # Make sure lvm doesn't get confused by PVs that belong to | ||||||
|  | -            # incomplete VGs. We will remove the PVs from the reject list when/if
 | ||||||
|  | +            # incomplete VGs. We will remove the PVs from the blacklist when/if
 | ||||||
|  |              # the time comes to remove the incomplete VG and its PVs. | ||||||
|  |              for pv in vg.pvs: | ||||||
|  |                  lvm.lvm_cc_addFilterRejectRegexp(pv.name) | ||||||
|  | diff --git a/blivet/threads.py b/blivet/threads.py
 | ||||||
|  | index 7e6d3105..a70deb69 100644
 | ||||||
|  | --- a/blivet/threads.py
 | ||||||
|  | +++ b/blivet/threads.py
 | ||||||
|  | @@ -63,11 +63,12 @@ class SynchronizedMeta(type):
 | ||||||
|  |      """ | ||||||
|  |      def __new__(cls, name, bases, dct): | ||||||
|  |          new_dct = {} | ||||||
|  | +        blacklist = dct.get('_unsynchronized_methods', [])
 | ||||||
|  |   | ||||||
|  |          for n in dct: | ||||||
|  |              obj = dct[n] | ||||||
|  |              # Do not decorate class or static methods. | ||||||
|  | -            if n in dct.get('_unsynchronized_methods', []):
 | ||||||
|  | +            if n in blacklist:
 | ||||||
|  |                  pass | ||||||
|  |              elif isinstance(obj, FunctionType): | ||||||
|  |                  obj = exclusive(obj) | ||||||
|  | diff --git a/blivet/udev.py b/blivet/udev.py
 | ||||||
|  | index a8297f3f..e1b67845 100644
 | ||||||
|  | --- a/blivet/udev.py
 | ||||||
|  | +++ b/blivet/udev.py
 | ||||||
|  | @@ -39,7 +39,7 @@ from gi.repository import BlockDev as blockdev
 | ||||||
|  |  global_udev = pyudev.Context() | ||||||
|  |  log = logging.getLogger("blivet") | ||||||
|  |   | ||||||
|  | -ignored_device_names = []
 | ||||||
|  | +device_name_blacklist = []
 | ||||||
|  |  """ device name regexes to ignore; this should be empty by default """ | ||||||
|  |   | ||||||
|  |   | ||||||
|  | @@ -77,7 +77,7 @@ def get_devices(subsystem="block"):
 | ||||||
|  |   | ||||||
|  |      result = [] | ||||||
|  |      for device in global_udev.list_devices(subsystem=subsystem): | ||||||
|  | -        if not __is_ignored_blockdev(device.sys_name):
 | ||||||
|  | +        if not __is_blacklisted_blockdev(device.sys_name):
 | ||||||
|  |              dev = device_to_dict(device) | ||||||
|  |              result.append(dev) | ||||||
|  |   | ||||||
|  | @@ -176,13 +176,13 @@ def resolve_glob(glob):
 | ||||||
|  |      return ret | ||||||
|  |   | ||||||
|  |   | ||||||
|  | -def __is_ignored_blockdev(dev_name):
 | ||||||
|  | +def __is_blacklisted_blockdev(dev_name):
 | ||||||
|  |      """Is this a blockdev we never want for an install?""" | ||||||
|  |      if dev_name.startswith("ram") or dev_name.startswith("fd"): | ||||||
|  |          return True | ||||||
|  |   | ||||||
|  | -    if ignored_device_names:
 | ||||||
|  | -        if any(re.search(expr, dev_name) for expr in ignored_device_names):
 | ||||||
|  | +    if device_name_blacklist:
 | ||||||
|  | +        if any(re.search(expr, dev_name) for expr in device_name_blacklist):
 | ||||||
|  |              return True | ||||||
|  |   | ||||||
|  |      dev_path = "/sys/class/block/%s" % dev_name | ||||||
|  | @@ -374,7 +374,7 @@ def device_is_disk(info):
 | ||||||
|  |                   device_is_dm_lvm(info) or | ||||||
|  |                   device_is_dm_crypt(info) or | ||||||
|  |                   (device_is_md(info) and | ||||||
|  | -                  (not device_get_md_container(info) and not all(device_is_disk(d) for d in device_get_parents(info))))))
 | ||||||
|  | +                  (not device_get_md_container(info) and not all(device_is_disk(d) for d in device_get_slaves(info))))))
 | ||||||
|  |   | ||||||
|  |   | ||||||
|  |  def device_is_partition(info): | ||||||
|  | @@ -453,18 +453,18 @@ def device_get_devname(info):
 | ||||||
|  |      return info.get('DEVNAME') | ||||||
|  |   | ||||||
|  |   | ||||||
|  | -def device_get_parents(info):
 | ||||||
|  | -    """ Return a list of udev device objects representing this device's parents. """
 | ||||||
|  | -    parents_dir = device_get_sysfs_path(info) + "/slaves/"
 | ||||||
|  | +def device_get_slaves(info):
 | ||||||
|  | +    """ Return a list of udev device objects representing this device's slaves. """
 | ||||||
|  | +    slaves_dir = device_get_sysfs_path(info) + "/slaves/"
 | ||||||
|  |      names = list() | ||||||
|  | -    if os.path.isdir(parents_dir):
 | ||||||
|  | -        names = os.listdir(parents_dir)
 | ||||||
|  | +    if os.path.isdir(slaves_dir):
 | ||||||
|  | +        names = os.listdir(slaves_dir)
 | ||||||
|  |   | ||||||
|  | -    parents = list()
 | ||||||
|  | +    slaves = list()
 | ||||||
|  |      for name in names: | ||||||
|  | -        parents.append(get_device(device_node="/dev/" + name))
 | ||||||
|  | +        slaves.append(get_device(device_node="/dev/" + name))
 | ||||||
|  |   | ||||||
|  | -    return parents
 | ||||||
|  | +    return slaves
 | ||||||
|  |   | ||||||
|  |   | ||||||
|  |  def device_get_holders(info): | ||||||
|  | @@ -736,7 +736,7 @@ def device_get_partition_disk(info):
 | ||||||
|  |      disk = None | ||||||
|  |      majorminor = info.get("ID_PART_ENTRY_DISK") | ||||||
|  |      sysfs_path = device_get_sysfs_path(info) | ||||||
|  | -    parents_dir = "%s/slaves" % sysfs_path
 | ||||||
|  | +    slaves_dir = "%s/slaves" % sysfs_path
 | ||||||
|  |      if majorminor: | ||||||
|  |          major, minor = majorminor.split(":") | ||||||
|  |          for device in get_devices(): | ||||||
|  | @@ -744,8 +744,8 @@ def device_get_partition_disk(info):
 | ||||||
|  |                  disk = device_get_name(device) | ||||||
|  |                  break | ||||||
|  |      elif device_is_dm_partition(info): | ||||||
|  | -        if os.path.isdir(parents_dir):
 | ||||||
|  | -            parents = os.listdir(parents_dir)
 | ||||||
|  | +        if os.path.isdir(slaves_dir):
 | ||||||
|  | +            parents = os.listdir(slaves_dir)
 | ||||||
|  |              if len(parents) == 1: | ||||||
|  |                  disk = resolve_devspec(parents[0].replace('!', '/')) | ||||||
|  |      else: | ||||||
|  | diff --git a/tests/devicefactory_test.py b/tests/devicefactory_test.py
 | ||||||
|  | index dc0d6408..dfd78a7a 100644
 | ||||||
|  | --- a/tests/devicefactory_test.py
 | ||||||
|  | +++ b/tests/devicefactory_test.py
 | ||||||
|  | @@ -112,9 +112,9 @@ class DeviceFactoryTestCase(unittest.TestCase):
 | ||||||
|  |                           kwargs.get("encrypted", False) or | ||||||
|  |                           kwargs.get("container_encrypted", False)) | ||||||
|  |          if kwargs.get("encrypted", False): | ||||||
|  | -            self.assertEqual(device.parents[0].format.luks_version,
 | ||||||
|  | +            self.assertEqual(device.slave.format.luks_version,
 | ||||||
|  |                               kwargs.get("luks_version", crypto.DEFAULT_LUKS_VERSION)) | ||||||
|  | -            self.assertEqual(device.raw_device.format.luks_sector_size,
 | ||||||
|  | +            self.assertEqual(device.slave.format.luks_sector_size,
 | ||||||
|  |                               kwargs.get("luks_sector_size", 0)) | ||||||
|  |   | ||||||
|  |          self.assertTrue(set(device.disks).issubset(kwargs["disks"])) | ||||||
|  | @@ -354,7 +354,7 @@ class LVMFactoryTestCase(DeviceFactoryTestCase):
 | ||||||
|  |          device = args[0] | ||||||
|  |   | ||||||
|  |          if kwargs.get("encrypted"): | ||||||
|  | -            container = device.parents[0].container
 | ||||||
|  | +            container = device.slave.container
 | ||||||
|  |          else: | ||||||
|  |              container = device.container | ||||||
|  |   | ||||||
|  | @@ -373,7 +373,7 @@ class LVMFactoryTestCase(DeviceFactoryTestCase):
 | ||||||
|  |              self.assertIsInstance(pv, member_class) | ||||||
|  |   | ||||||
|  |              if pv.encrypted: | ||||||
|  | -                self.assertEqual(pv.parents[0].format.luks_version,
 | ||||||
|  | +                self.assertEqual(pv.slave.format.luks_version,
 | ||||||
|  |                                   kwargs.get("luks_version", crypto.DEFAULT_LUKS_VERSION)) | ||||||
|  |   | ||||||
|  |      @patch("blivet.formats.lvmpv.LVMPhysicalVolume.formattable", return_value=True) | ||||||
|  | @@ -589,7 +589,7 @@ class LVMThinPFactoryTestCase(LVMFactoryTestCase):
 | ||||||
|  |          device = args[0] | ||||||
|  |   | ||||||
|  |          if kwargs.get("encrypted", False): | ||||||
|  | -            thinlv = device.parents[0]
 | ||||||
|  | +            thinlv = device.slave
 | ||||||
|  |          else: | ||||||
|  |              thinlv = device | ||||||
|  |   | ||||||
|  | diff --git a/tests/devices_test/size_test.py b/tests/devices_test/size_test.py
 | ||||||
|  | index d0c0a3f4..a1efa86d 100644
 | ||||||
|  | --- a/tests/devices_test/size_test.py
 | ||||||
|  | +++ b/tests/devices_test/size_test.py
 | ||||||
|  | @@ -107,8 +107,8 @@ class LUKSDeviceSizeTest(StorageDeviceSizeTest):
 | ||||||
|  |   | ||||||
|  |      def _get_device(self, *args, **kwargs): | ||||||
|  |          exists = kwargs.get("exists", False) | ||||||
|  | -        parent = StorageDevice(*args, size=kwargs["size"] + crypto.LUKS_METADATA_SIZE, exists=exists)
 | ||||||
|  | -        return LUKSDevice(*args, **kwargs, parents=[parent])
 | ||||||
|  | +        slave = StorageDevice(*args, size=kwargs["size"] + crypto.LUKS_METADATA_SIZE, exists=exists)
 | ||||||
|  | +        return LUKSDevice(*args, **kwargs, parents=[slave])
 | ||||||
|  |   | ||||||
|  |      def test_size_getter(self): | ||||||
|  |          initial_size = Size("10 GiB") | ||||||
|  | @@ -116,4 +116,4 @@ class LUKSDeviceSizeTest(StorageDeviceSizeTest):
 | ||||||
|  |   | ||||||
|  |          # for LUKS size depends on the backing device size | ||||||
|  |          self.assertEqual(dev.size, initial_size) | ||||||
|  | -        self.assertEqual(dev.raw_device.size, initial_size + crypto.LUKS_METADATA_SIZE)
 | ||||||
|  | +        self.assertEqual(dev.slave.size, initial_size + crypto.LUKS_METADATA_SIZE)
 | ||||||
|  | diff --git a/tests/populator_test.py b/tests/populator_test.py
 | ||||||
|  | index a7748a9d..531ec74b 100644
 | ||||||
|  | --- a/tests/populator_test.py
 | ||||||
|  | +++ b/tests/populator_test.py
 | ||||||
|  | @@ -81,7 +81,7 @@ class DMDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |      @patch.object(DeviceTree, "get_device_by_name") | ||||||
|  |      @patch.object(DMDevice, "status", return_value=True) | ||||||
|  |      @patch.object(DMDevice, "update_sysfs_path") | ||||||
|  | -    @patch.object(DeviceTree, "_add_parent_devices")
 | ||||||
|  | +    @patch.object(DeviceTree, "_add_slave_devices")
 | ||||||
|  |      @patch("blivet.udev.device_get_name") | ||||||
|  |      @patch("blivet.udev.device_get_sysfs_path", return_value=sentinel.sysfs_path) | ||||||
|  |      def test_run(self, *args): | ||||||
|  | @@ -90,7 +90,7 @@ class DMDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |   | ||||||
|  |          devicetree = DeviceTree() | ||||||
|  |   | ||||||
|  | -        # The general case for dm devices is that adding the parent devices
 | ||||||
|  | +        # The general case for dm devices is that adding the slave/parent devices
 | ||||||
|  |          # will result in the dm device itself being in the tree. | ||||||
|  |          device = Mock() | ||||||
|  |          devicetree.get_device_by_name.return_value = device | ||||||
|  | @@ -99,7 +99,7 @@ class DMDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |   | ||||||
|  |          parent = Mock() | ||||||
|  |          parent.parents = [] | ||||||
|  | -        devicetree._add_parent_devices.return_value = [parent]
 | ||||||
|  | +        devicetree._add_slave_devices.return_value = [parent]
 | ||||||
|  |          devicetree._add_device(parent) | ||||||
|  |          devicetree.get_device_by_name.return_value = None | ||||||
|  |          device_name = "dmdevice" | ||||||
|  | @@ -228,7 +228,7 @@ class LVMDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |          # could be the first helper class checked. | ||||||
|  |   | ||||||
|  |      @patch.object(DeviceTree, "get_device_by_name") | ||||||
|  | -    @patch.object(DeviceTree, "_add_parent_devices")
 | ||||||
|  | +    @patch.object(DeviceTree, "_add_slave_devices")
 | ||||||
|  |      @patch("blivet.udev.device_get_name") | ||||||
|  |      @patch("blivet.udev.device_get_lv_vg_name") | ||||||
|  |      def test_run(self, *args): | ||||||
|  | @@ -240,7 +240,7 @@ class LVMDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |          devicetree = DeviceTree() | ||||||
|  |          data = Mock() | ||||||
|  |   | ||||||
|  | -        # Add parent devices and then look up the device.
 | ||||||
|  | +        # Add slave/parent devices and then look up the device.
 | ||||||
|  |          device_get_name.return_value = sentinel.lv_name | ||||||
|  |          devicetree.get_device_by_name.return_value = None | ||||||
|  |   | ||||||
|  | @@ -260,7 +260,7 @@ class LVMDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |               call(sentinel.vg_name), | ||||||
|  |               call(sentinel.lv_name)]) | ||||||
|  |   | ||||||
|  | -        # Add parent devices, but the device is still not in the tree
 | ||||||
|  | +        # Add slave/parent devices, but the device is still not in the tree
 | ||||||
|  |          get_device_by_name.side_effect = None | ||||||
|  |          get_device_by_name.return_value = None | ||||||
|  |          self.assertEqual(helper.run(), None) | ||||||
|  | @@ -625,7 +625,7 @@ class MDDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |          # could be the first helper class checked. | ||||||
|  |   | ||||||
|  |      @patch.object(DeviceTree, "get_device_by_name") | ||||||
|  | -    @patch.object(DeviceTree, "_add_parent_devices")
 | ||||||
|  | +    @patch.object(DeviceTree, "_add_slave_devices")
 | ||||||
|  |      @patch("blivet.udev.device_get_name") | ||||||
|  |      @patch("blivet.udev.device_get_md_uuid") | ||||||
|  |      @patch("blivet.udev.device_get_md_name") | ||||||
|  | @@ -636,7 +636,7 @@ class MDDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |   | ||||||
|  |          devicetree = DeviceTree() | ||||||
|  |   | ||||||
|  | -        # base case: _add_parent_devices gets the array into the tree
 | ||||||
|  | +        # base case: _add_slave_devices gets the array into the tree
 | ||||||
|  |          data = Mock() | ||||||
|  |          device = Mock() | ||||||
|  |          device.parents = [] | ||||||
|  | @@ -699,12 +699,12 @@ class MultipathDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |          # could be the first helper class checked. | ||||||
|  |   | ||||||
|  |      @patch("blivet.udev.device_get_sysfs_path") | ||||||
|  | -    @patch.object(DeviceTree, "_add_parent_devices")
 | ||||||
|  | +    @patch.object(DeviceTree, "_add_slave_devices")
 | ||||||
|  |      @patch("blivet.udev.device_get_name") | ||||||
|  |      def test_run(self, *args): | ||||||
|  |          """Test multipath device populator.""" | ||||||
|  |          device_get_name = args[0] | ||||||
|  | -        add_parent_devices = args[1]
 | ||||||
|  | +        add_slave_devices = args[1]
 | ||||||
|  |   | ||||||
|  |          devicetree = DeviceTree() | ||||||
|  |          # set up some fake udev data to verify handling of specific entries | ||||||
|  | @@ -719,13 +719,13 @@ class MultipathDevicePopulatorTestCase(PopulatorHelperTestCase):
 | ||||||
|  |   | ||||||
|  |          device_name = "mpathtest" | ||||||
|  |          device_get_name.return_value = device_name | ||||||
|  | -        parent_1 = Mock(tags=set(), wwn=wwn[2:])
 | ||||||
|  | -        parent_1.parents = []
 | ||||||
|  | -        parent_2 = Mock(tags=set(), wwn=wwn[2:])
 | ||||||
|  | -        parent_2.parents = []
 | ||||||
|  | -        devicetree._add_device(parent_1)
 | ||||||
|  | -        devicetree._add_device(parent_2)
 | ||||||
|  | -        add_parent_devices.return_value = [parent_1, parent_2]
 | ||||||
|  | +        slave_1 = Mock(tags=set(), wwn=wwn[2:])
 | ||||||
|  | +        slave_1.parents = []
 | ||||||
|  | +        slave_2 = Mock(tags=set(), wwn=wwn[2:])
 | ||||||
|  | +        slave_2.parents = []
 | ||||||
|  | +        devicetree._add_device(slave_1)
 | ||||||
|  | +        devicetree._add_device(slave_2)
 | ||||||
|  | +        add_slave_devices.return_value = [slave_1, slave_2]
 | ||||||
|  |   | ||||||
|  |          helper = self.helper_class(devicetree, data) | ||||||
|  |   | ||||||
|  | diff --git a/tests/udev_test.py b/tests/udev_test.py
 | ||||||
|  | index f9b10620..d30a647b 100644
 | ||||||
|  | --- a/tests/udev_test.py
 | ||||||
|  | +++ b/tests/udev_test.py
 | ||||||
|  | @@ -45,11 +45,11 @@ class UdevTest(unittest.TestCase):
 | ||||||
|  |      @mock.patch('blivet.udev.device_is_dm_crypt', return_value=False) | ||||||
|  |      @mock.patch('blivet.udev.device_is_md') | ||||||
|  |      @mock.patch('blivet.udev.device_get_md_container') | ||||||
|  | -    @mock.patch('blivet.udev.device_get_parents')
 | ||||||
|  | +    @mock.patch('blivet.udev.device_get_slaves')
 | ||||||
|  |      def test_udev_device_is_disk_md(self, *args): | ||||||
|  |          import blivet.udev | ||||||
|  |          info = dict(DEVTYPE='disk', SYS_PATH=mock.sentinel.md_path) | ||||||
|  | -        (device_get_parents, device_get_md_container, device_is_md) = args[:3]  # pylint: disable=unbalanced-tuple-unpacking
 | ||||||
|  | +        (device_get_slaves, device_get_md_container, device_is_md) = args[:3]  # pylint: disable=unbalanced-tuple-unpacking
 | ||||||
|  |   | ||||||
|  |          disk_parents = [dict(DEVTYPE="disk", SYS_PATH='/fake/path/2'), | ||||||
|  |                          dict(DEVTYPE="disk", SYS_PATH='/fake/path/3')] | ||||||
|  | @@ -64,20 +64,20 @@ class UdevTest(unittest.TestCase):
 | ||||||
|  |          # Intel FW RAID (MD RAID w/ container layer) | ||||||
|  |          # device_get_container will return some mock value which will evaluate to True | ||||||
|  |          device_get_md_container.return_value = mock.sentinel.md_container | ||||||
|  | -        device_get_parents.side_effect = lambda info: list()
 | ||||||
|  | +        device_get_slaves.side_effect = lambda info: list()
 | ||||||
|  |          self.assertTrue(blivet.udev.device_is_disk(info)) | ||||||
|  |   | ||||||
|  |          # Normal MD RAID | ||||||
|  | -        device_get_parents.side_effect = lambda info: partition_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
 | ||||||
|  | +        device_get_slaves.side_effect = lambda info: partition_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
 | ||||||
|  |          device_get_md_container.return_value = None | ||||||
|  |          self.assertFalse(blivet.udev.device_is_disk(info)) | ||||||
|  |   | ||||||
|  |          # Dell FW RAID (MD RAID whose members are all whole disks) | ||||||
|  | -        device_get_parents.side_effect = lambda info: disk_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
 | ||||||
|  | +        device_get_slaves.side_effect = lambda info: disk_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
 | ||||||
|  |          self.assertTrue(blivet.udev.device_is_disk(info)) | ||||||
|  |   | ||||||
|  |          # Normal MD RAID (w/ at least one non-disk member) | ||||||
|  | -        device_get_parents.side_effect = lambda info: mixed_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
 | ||||||
|  | +        device_get_slaves.side_effect = lambda info: mixed_parents if info['SYS_PATH'] == mock.sentinel.md_path else list()
 | ||||||
|  |          self.assertFalse(blivet.udev.device_is_disk(info)) | ||||||
|  |   | ||||||
|  |   | ||||||
|  | diff --git a/tests/vmtests/vmbackedtestcase.py b/tests/vmtests/vmbackedtestcase.py
 | ||||||
|  | index 797bac85..6255104f 100644
 | ||||||
|  | --- a/tests/vmtests/vmbackedtestcase.py
 | ||||||
|  | +++ b/tests/vmtests/vmbackedtestcase.py
 | ||||||
|  | @@ -50,7 +50,7 @@ class VMBackedTestCase(unittest.TestCase):
 | ||||||
|  |              defined in set_up_disks. | ||||||
|  |          """ | ||||||
|  |   | ||||||
|  | -        udev.ignored_device_names = [r'^zram']
 | ||||||
|  | +        udev.device_name_blacklist = [r'^zram']
 | ||||||
|  |   | ||||||
|  |          # | ||||||
|  |          # create disk images | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										538
									
								
								0005-Fix-unify-importing-mock-module-in-tests.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										538
									
								
								0005-Fix-unify-importing-mock-module-in-tests.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,538 @@ | |||||||
|  | From ad34dfa2f983bb3159af8b5780193e0427b505e9 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Vojtech Trefny <vtrefny@redhat.com> | ||||||
|  | Date: Thu, 10 Jun 2021 15:01:26 +0200 | ||||||
|  | Subject: [PATCH] Fix/unify importing mock module in tests | ||||||
|  | 
 | ||||||
|  | mock is available in the unittest module since Python 3.3, we need | ||||||
|  | to use the old mock module not only with Python 2 but also with | ||||||
|  | the early versions of Python 3. | ||||||
|  | ---
 | ||||||
|  |  tests/action_test.py                         |  5 ++- | ||||||
|  |  tests/dbus_test.py                           |  9 +++-- | ||||||
|  |  tests/devicefactory_test.py                  |  6 ++-- | ||||||
|  |  tests/devicelibs_test/disk_test.py           |  6 ++-- | ||||||
|  |  tests/devicelibs_test/edd_test.py            |  6 +++- | ||||||
|  |  tests/devices_test/dependencies_test.py      |  6 ++-- | ||||||
|  |  tests/devices_test/device_methods_test.py    |  8 +++-- | ||||||
|  |  tests/devices_test/device_names_test.py      |  6 ++-- | ||||||
|  |  tests/devices_test/device_properties_test.py |  8 ++--- | ||||||
|  |  tests/devices_test/disk_test.py              |  7 ++-- | ||||||
|  |  tests/devices_test/lvm_test.py               |  7 ++-- | ||||||
|  |  tests/devices_test/partition_test.py         |  6 ++-- | ||||||
|  |  tests/devices_test/tags_test.py              |  6 ++-- | ||||||
|  |  tests/devicetree_test.py                     |  6 ++-- | ||||||
|  |  tests/events_test.py                         |  6 ++-- | ||||||
|  |  tests/formats_test/disklabel_test.py         |  6 ++-- | ||||||
|  |  tests/formats_test/luks_test.py              |  6 ++-- | ||||||
|  |  tests/formats_test/lvmpv_test.py             |  2 -- | ||||||
|  |  tests/formats_test/methods_test.py           |  6 ++-- | ||||||
|  |  tests/formats_test/selinux_test.py           |  6 ++-- | ||||||
|  |  tests/formats_test/swap_test.py              |  2 -- | ||||||
|  |  tests/misc_test.py                           |  6 ++-- | ||||||
|  |  tests/partitioning_test.py                   |  6 ++-- | ||||||
|  |  tests/populator_test.py                      |  6 ++-- | ||||||
|  |  tests/storagetestcase.py                     |  5 ++- | ||||||
|  |  tests/test_compat.py                         | 38 -------------------- | ||||||
|  |  tests/udev_test.py                           |  6 +++- | ||||||
|  |  tests/unsupported_disklabel_test.py          |  7 ++-- | ||||||
|  |  tests/util_test.py                           |  6 ++-- | ||||||
|  |  29 files changed, 104 insertions(+), 102 deletions(-) | ||||||
|  |  delete mode 100644 tests/test_compat.py | ||||||
|  | 
 | ||||||
|  | diff --git a/tests/action_test.py b/tests/action_test.py
 | ||||||
|  | index 38a2e872..f60cf5d7 100644
 | ||||||
|  | --- a/tests/action_test.py
 | ||||||
|  | +++ b/tests/action_test.py
 | ||||||
|  | @@ -1,9 +1,8 @@
 | ||||||
|  | -from six import PY3
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | -if PY3:
 | ||||||
|  | +try:
 | ||||||
|  |      from unittest.mock import Mock | ||||||
|  | -else:
 | ||||||
|  | +except ImportError:
 | ||||||
|  |      from mock import Mock | ||||||
|  |   | ||||||
|  |  from tests.storagetestcase import StorageTestCase | ||||||
|  | diff --git a/tests/dbus_test.py b/tests/dbus_test.py
 | ||||||
|  | index 293ac073..9bb9102a 100644
 | ||||||
|  | --- a/tests/dbus_test.py
 | ||||||
|  | +++ b/tests/dbus_test.py
 | ||||||
|  | @@ -1,7 +1,10 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | -
 | ||||||
|  |  import random | ||||||
|  | -from six.moves.mock import Mock, patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  | +
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, Mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, Mock
 | ||||||
|  | +
 | ||||||
|  |  from unittest import TestCase | ||||||
|  |   | ||||||
|  |  import dbus | ||||||
|  | diff --git a/tests/devicefactory_test.py b/tests/devicefactory_test.py
 | ||||||
|  | index dc0d6408..93c8bdb7 100644
 | ||||||
|  | --- a/tests/devicefactory_test.py
 | ||||||
|  | +++ b/tests/devicefactory_test.py
 | ||||||
|  | @@ -4,8 +4,10 @@ import unittest
 | ||||||
|  |  from decimal import Decimal | ||||||
|  |  import os | ||||||
|  |   | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | -from six.moves.mock import patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch
 | ||||||
|  |   | ||||||
|  |  import blivet | ||||||
|  |   | ||||||
|  | diff --git a/tests/devicelibs_test/disk_test.py b/tests/devicelibs_test/disk_test.py
 | ||||||
|  | index e67ef5b1..9cb39951 100644
 | ||||||
|  | --- a/tests/devicelibs_test/disk_test.py
 | ||||||
|  | +++ b/tests/devicelibs_test/disk_test.py
 | ||||||
|  | @@ -1,8 +1,10 @@
 | ||||||
|  |  # pylint: skip-file | ||||||
|  | -import test_compat
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import Mock, patch, sentinel
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import Mock, patch, sentinel
 | ||||||
|  |   | ||||||
|  |  import six | ||||||
|  | -from six.moves.mock import Mock, patch, sentinel
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  |  from blivet.devicelibs import disk as disklib | ||||||
|  | diff --git a/tests/devicelibs_test/edd_test.py b/tests/devicelibs_test/edd_test.py
 | ||||||
|  | index 23d736f4..21bbcffc 100644
 | ||||||
|  | --- a/tests/devicelibs_test/edd_test.py
 | ||||||
|  | +++ b/tests/devicelibs_test/edd_test.py
 | ||||||
|  | @@ -1,5 +1,9 @@
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest import mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    import mock
 | ||||||
|  | +
 | ||||||
|  |  import unittest | ||||||
|  | -import mock
 | ||||||
|  |  import os | ||||||
|  |  import inspect | ||||||
|  |  import logging | ||||||
|  | diff --git a/tests/devices_test/dependencies_test.py b/tests/devices_test/dependencies_test.py
 | ||||||
|  | index c012751d..493d1c9f 100644
 | ||||||
|  | --- a/tests/devices_test/dependencies_test.py
 | ||||||
|  | +++ b/tests/devices_test/dependencies_test.py
 | ||||||
|  | @@ -1,8 +1,6 @@
 | ||||||
|  | -# vim:set fileencoding=utf-8
 | ||||||
|  | -from six import PY3
 | ||||||
|  | -if PY3:
 | ||||||
|  | +try:
 | ||||||
|  |      from unittest.mock import patch, PropertyMock | ||||||
|  | -else:
 | ||||||
|  | +except ImportError:
 | ||||||
|  |      from mock import patch, PropertyMock | ||||||
|  |   | ||||||
|  |  import unittest | ||||||
|  | diff --git a/tests/devices_test/device_methods_test.py b/tests/devices_test/device_methods_test.py
 | ||||||
|  | index f00509be..8a70b5bb 100644
 | ||||||
|  | --- a/tests/devices_test/device_methods_test.py
 | ||||||
|  | +++ b/tests/devices_test/device_methods_test.py
 | ||||||
|  | @@ -1,9 +1,11 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | -
 | ||||||
|  |  import six | ||||||
|  | -from six.moves.mock import patch, Mock, PropertyMock  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, Mock, PropertyMock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, PropertyMock
 | ||||||
|  | +
 | ||||||
|  |  from blivet.devices import StorageDevice | ||||||
|  |  from blivet.devices import DiskDevice, PartitionDevice | ||||||
|  |  from blivet.devices import LVMVolumeGroupDevice, LVMLogicalVolumeDevice | ||||||
|  | diff --git a/tests/devices_test/device_names_test.py b/tests/devices_test/device_names_test.py
 | ||||||
|  | index 2a66f983..ca44d38c 100644
 | ||||||
|  | --- a/tests/devices_test/device_names_test.py
 | ||||||
|  | +++ b/tests/devices_test/device_names_test.py
 | ||||||
|  | @@ -1,7 +1,9 @@
 | ||||||
|  |  # vim:set fileencoding=utf-8 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch
 | ||||||
|  |   | ||||||
|  | -from six.moves.mock import patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import six | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | diff --git a/tests/devices_test/device_properties_test.py b/tests/devices_test/device_properties_test.py
 | ||||||
|  | index 240ac088..8928707f 100644
 | ||||||
|  | --- a/tests/devices_test/device_properties_test.py
 | ||||||
|  | +++ b/tests/devices_test/device_properties_test.py
 | ||||||
|  | @@ -1,6 +1,3 @@
 | ||||||
|  | -# vim:set fileencoding=utf-8
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | -
 | ||||||
|  |  import six | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | @@ -9,7 +6,10 @@ gi.require_version("BlockDev", "2.0")
 | ||||||
|  |   | ||||||
|  |  from gi.repository import BlockDev as blockdev | ||||||
|  |   | ||||||
|  | -from six.moves.mock import Mock, patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, Mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, Mock
 | ||||||
|  |   | ||||||
|  |  import blivet | ||||||
|  |   | ||||||
|  | diff --git a/tests/devices_test/disk_test.py b/tests/devices_test/disk_test.py
 | ||||||
|  | index e9852303..cc8454e1 100644
 | ||||||
|  | --- a/tests/devices_test/disk_test.py
 | ||||||
|  | +++ b/tests/devices_test/disk_test.py
 | ||||||
|  | @@ -1,7 +1,8 @@
 | ||||||
|  |  # pylint: skip-file | ||||||
|  | -import test_compat
 | ||||||
|  | -
 | ||||||
|  | -from six.moves.mock import patch
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  |  from blivet.devices import DiskDevice | ||||||
|  | diff --git a/tests/devices_test/lvm_test.py b/tests/devices_test/lvm_test.py
 | ||||||
|  | index 670c91c9..f50933c4 100644
 | ||||||
|  | --- a/tests/devices_test/lvm_test.py
 | ||||||
|  | +++ b/tests/devices_test/lvm_test.py
 | ||||||
|  | @@ -1,8 +1,9 @@
 | ||||||
|  | -# vim:set fileencoding=utf-8
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, PropertyMock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, PropertyMock
 | ||||||
|  |   | ||||||
|  |  import six | ||||||
|  | -from six.moves.mock import patch, PropertyMock  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  |  import blivet | ||||||
|  | diff --git a/tests/devices_test/partition_test.py b/tests/devices_test/partition_test.py
 | ||||||
|  | index 0abd88df..4748dafe 100644
 | ||||||
|  | --- a/tests/devices_test/partition_test.py
 | ||||||
|  | +++ b/tests/devices_test/partition_test.py
 | ||||||
|  | @@ -1,5 +1,4 @@
 | ||||||
|  |  # vim:set fileencoding=utf-8 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  |   | ||||||
|  |  from collections import namedtuple | ||||||
|  |  import os | ||||||
|  | @@ -7,7 +6,10 @@ import six
 | ||||||
|  |  import unittest | ||||||
|  |  import parted | ||||||
|  |   | ||||||
|  | -from six.moves.mock import Mock, patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, Mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, Mock
 | ||||||
|  |   | ||||||
|  |  from blivet.devices import DiskFile | ||||||
|  |  from blivet.devices import PartitionDevice | ||||||
|  | diff --git a/tests/devices_test/tags_test.py b/tests/devices_test/tags_test.py
 | ||||||
|  | index 1edc37f6..49a2d72e 100644
 | ||||||
|  | --- a/tests/devices_test/tags_test.py
 | ||||||
|  | +++ b/tests/devices_test/tags_test.py
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch
 | ||||||
|  |   | ||||||
|  | -from six.moves.mock import patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  |  from blivet.devices import DiskDevice, FcoeDiskDevice, iScsiDiskDevice, MultipathDevice, StorageDevice, ZFCPDiskDevice | ||||||
|  | diff --git a/tests/devicetree_test.py b/tests/devicetree_test.py
 | ||||||
|  | index 11f8469d..fbf31c77 100644
 | ||||||
|  | --- a/tests/devicetree_test.py
 | ||||||
|  | +++ b/tests/devicetree_test.py
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, Mock, PropertyMock, sentinel
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, Mock, PropertyMock, sentinel
 | ||||||
|  |   | ||||||
|  | -from six.moves.mock import Mock, patch, PropertyMock, sentinel  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import os | ||||||
|  |  import six | ||||||
|  |  import unittest | ||||||
|  | diff --git a/tests/events_test.py b/tests/events_test.py
 | ||||||
|  | index 5906b4e2..22666f6d 100644
 | ||||||
|  | --- a/tests/events_test.py
 | ||||||
|  | +++ b/tests/events_test.py
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, Mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, Mock
 | ||||||
|  |   | ||||||
|  | -from six.moves.mock import Mock, patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import time | ||||||
|  |  from unittest import TestCase | ||||||
|  |   | ||||||
|  | diff --git a/tests/formats_test/disklabel_test.py b/tests/formats_test/disklabel_test.py
 | ||||||
|  | index 0cfa736d..f514a778 100644
 | ||||||
|  | --- a/tests/formats_test/disklabel_test.py
 | ||||||
|  | +++ b/tests/formats_test/disklabel_test.py
 | ||||||
|  | @@ -1,7 +1,9 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest import mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    import mock
 | ||||||
|  |   | ||||||
|  |  import parted | ||||||
|  | -from six.moves import mock  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  |  import blivet | ||||||
|  | diff --git a/tests/formats_test/luks_test.py b/tests/formats_test/luks_test.py
 | ||||||
|  | index be0d50b0..1edbdcb2 100644
 | ||||||
|  | --- a/tests/formats_test/luks_test.py
 | ||||||
|  | +++ b/tests/formats_test/luks_test.py
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch
 | ||||||
|  |   | ||||||
|  | -from six.moves.mock import patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  |  from blivet.formats.luks import LUKS | ||||||
|  | diff --git a/tests/formats_test/lvmpv_test.py b/tests/formats_test/lvmpv_test.py
 | ||||||
|  | index 792a2f1d..cbd2c419 100644
 | ||||||
|  | --- a/tests/formats_test/lvmpv_test.py
 | ||||||
|  | +++ b/tests/formats_test/lvmpv_test.py
 | ||||||
|  | @@ -1,5 +1,3 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | -
 | ||||||
|  |  from blivet.formats.lvmpv import LVMPhysicalVolume | ||||||
|  |   | ||||||
|  |  from blivet.size import Size | ||||||
|  | diff --git a/tests/formats_test/methods_test.py b/tests/formats_test/methods_test.py
 | ||||||
|  | index b2674ea7..2743b7db 100644
 | ||||||
|  | --- a/tests/formats_test/methods_test.py
 | ||||||
|  | +++ b/tests/formats_test/methods_test.py
 | ||||||
|  | @@ -1,7 +1,9 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, sentinel, PropertyMock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, sentinel, PropertyMock
 | ||||||
|  |   | ||||||
|  |  import six | ||||||
|  | -from six.moves.mock import patch, sentinel, PropertyMock  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  |  from blivet.errors import DeviceFormatError | ||||||
|  | diff --git a/tests/formats_test/selinux_test.py b/tests/formats_test/selinux_test.py
 | ||||||
|  | index 02e39011..26df5fe9 100644
 | ||||||
|  | --- a/tests/formats_test/selinux_test.py
 | ||||||
|  | +++ b/tests/formats_test/selinux_test.py
 | ||||||
|  | @@ -1,9 +1,9 @@
 | ||||||
|  |  # pylint: disable=unused-import | ||||||
|  |  import os | ||||||
|  | -from six import PY3
 | ||||||
|  | -if PY3:
 | ||||||
|  | +
 | ||||||
|  | +try:
 | ||||||
|  |      from unittest.mock import patch, ANY | ||||||
|  | -else:
 | ||||||
|  | +except ImportError:
 | ||||||
|  |      from mock import patch, ANY | ||||||
|  |   | ||||||
|  |  import unittest | ||||||
|  | diff --git a/tests/formats_test/swap_test.py b/tests/formats_test/swap_test.py
 | ||||||
|  | index 56356144..8968ca15 100644
 | ||||||
|  | --- a/tests/formats_test/swap_test.py
 | ||||||
|  | +++ b/tests/formats_test/swap_test.py
 | ||||||
|  | @@ -1,5 +1,3 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | -
 | ||||||
|  |  import six | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | diff --git a/tests/misc_test.py b/tests/misc_test.py
 | ||||||
|  | index 3c8cf344..10ea1320 100644
 | ||||||
|  | --- a/tests/misc_test.py
 | ||||||
|  | +++ b/tests/misc_test.py
 | ||||||
|  | @@ -1,7 +1,9 @@
 | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | -from six.moves.mock import patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch
 | ||||||
|  |   | ||||||
|  |  import blivet | ||||||
|  |   | ||||||
|  | diff --git a/tests/partitioning_test.py b/tests/partitioning_test.py
 | ||||||
|  | index b7aa5045..9b27f0c0 100644
 | ||||||
|  | --- a/tests/partitioning_test.py
 | ||||||
|  | +++ b/tests/partitioning_test.py
 | ||||||
|  | @@ -1,6 +1,8 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, Mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, Mock
 | ||||||
|  |   | ||||||
|  | -from six.moves.mock import Mock, patch  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import six | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | diff --git a/tests/populator_test.py b/tests/populator_test.py
 | ||||||
|  | index a7748a9d..2a8532f0 100644
 | ||||||
|  | --- a/tests/populator_test.py
 | ||||||
|  | +++ b/tests/populator_test.py
 | ||||||
|  | @@ -1,7 +1,9 @@
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import call, patch, sentinel, Mock, PropertyMock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import call, patch, sentinel, Mock, PropertyMock
 | ||||||
|  |   | ||||||
|  |  import gi | ||||||
|  | -from six.moves.mock import call, patch, sentinel, Mock, PropertyMock  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import six | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | diff --git a/tests/storagetestcase.py b/tests/storagetestcase.py
 | ||||||
|  | index 1844dec5..1b856914 100644
 | ||||||
|  | --- a/tests/storagetestcase.py
 | ||||||
|  | +++ b/tests/storagetestcase.py
 | ||||||
|  | @@ -1,6 +1,9 @@
 | ||||||
|  |   | ||||||
|  |  import unittest | ||||||
|  | -from mock import Mock
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import Mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import Mock
 | ||||||
|  |   | ||||||
|  |  import parted | ||||||
|  |   | ||||||
|  | diff --git a/tests/test_compat.py b/tests/test_compat.py
 | ||||||
|  | deleted file mode 100644 | ||||||
|  | index d0859e24..00000000
 | ||||||
|  | --- a/tests/test_compat.py
 | ||||||
|  | +++ /dev/null
 | ||||||
|  | @@ -1,38 +0,0 @@
 | ||||||
|  | -# test_compat.py
 | ||||||
|  | -# Python (2 -v- 3) compatibility functions.
 | ||||||
|  | -#
 | ||||||
|  | -# Copyright (C) 2017  Red Hat, Inc.
 | ||||||
|  | -#
 | ||||||
|  | -# This copyrighted material is made available to anyone wishing to use,
 | ||||||
|  | -# modify, copy, or redistribute it subject to the terms and conditions of
 | ||||||
|  | -# the GNU Lesser General Public License v.2, or (at your option) any later
 | ||||||
|  | -# version. This program is distributed in the hope that it will be useful,
 | ||||||
|  | -# but WITHOUT ANY WARRANTY expressed or implied, including the implied
 | ||||||
|  | -# warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
 | ||||||
|  | -# the GNU Lesser General Public License for more details.  You should have
 | ||||||
|  | -# received a copy of the GNU Lesser General Public License along with this
 | ||||||
|  | -# program; if not, write to the Free Software Foundation, Inc., 51 Franklin
 | ||||||
|  | -# Street, Fifth Floor, Boston, MA 02110-1301, USA.  Any Red Hat trademarks
 | ||||||
|  | -# that are incorporated in the source code or documentation are not subject
 | ||||||
|  | -# to the GNU Lesser General Public License and may only be used or
 | ||||||
|  | -# replicated with the express permission of Red Hat, Inc.
 | ||||||
|  | -#
 | ||||||
|  | -# Red Hat Author(s): David Lehman <dlehman@redhat.com>
 | ||||||
|  | -#
 | ||||||
|  | -
 | ||||||
|  | -import six as _six
 | ||||||
|  | -
 | ||||||
|  | -mock_move = _six.MovedModule('mock', 'mock', 'unittest.mock')
 | ||||||
|  | -
 | ||||||
|  | -
 | ||||||
|  | -def add_move(mod):
 | ||||||
|  | -    _six.add_move(mod)
 | ||||||
|  | -    # https://bitbucket.org/gutworth/six/issues/116/enable-importing-from-within-custom
 | ||||||
|  | -    _six._importer._add_module(mod, "moves." + mod.name)
 | ||||||
|  | -
 | ||||||
|  | -
 | ||||||
|  | -def setup():
 | ||||||
|  | -    add_move(mock_move)
 | ||||||
|  | -
 | ||||||
|  | -
 | ||||||
|  | -setup()
 | ||||||
|  | diff --git a/tests/udev_test.py b/tests/udev_test.py
 | ||||||
|  | index f9b10620..569a144e 100644
 | ||||||
|  | --- a/tests/udev_test.py
 | ||||||
|  | +++ b/tests/udev_test.py
 | ||||||
|  | @@ -1,6 +1,10 @@
 | ||||||
|  |   | ||||||
|  |  import unittest | ||||||
|  | -import mock
 | ||||||
|  | +
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest import mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    import mock
 | ||||||
|  |   | ||||||
|  |  from udev_data import raid_data | ||||||
|  |   | ||||||
|  | diff --git a/tests/unsupported_disklabel_test.py b/tests/unsupported_disklabel_test.py
 | ||||||
|  | index f5b24779..38055333 100644
 | ||||||
|  | --- a/tests/unsupported_disklabel_test.py
 | ||||||
|  | +++ b/tests/unsupported_disklabel_test.py
 | ||||||
|  | @@ -1,7 +1,8 @@
 | ||||||
|  | -# vim:set fileencoding=utf-8
 | ||||||
|  | -import test_compat  # pylint: disable=unused-import
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest.mock import patch, sentinel, DEFAULT
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    from mock import patch, sentinel, DEFAULT
 | ||||||
|  |   | ||||||
|  | -from six.moves.mock import patch, sentinel, DEFAULT  # pylint: disable=no-name-in-module,import-error
 | ||||||
|  |  import six | ||||||
|  |  import unittest | ||||||
|  |   | ||||||
|  | diff --git a/tests/util_test.py b/tests/util_test.py
 | ||||||
|  | index 853b6166..b4f82c1b 100644
 | ||||||
|  | --- a/tests/util_test.py
 | ||||||
|  | +++ b/tests/util_test.py
 | ||||||
|  | @@ -1,7 +1,9 @@
 | ||||||
|  |  # pylint: skip-file | ||||||
|  | -import test_compat
 | ||||||
|  | +try:
 | ||||||
|  | +    from unittest import mock
 | ||||||
|  | +except ImportError:
 | ||||||
|  | +    import mock
 | ||||||
|  |   | ||||||
|  | -from six.moves import mock
 | ||||||
|  |  import os | ||||||
|  |  import six | ||||||
|  |  import tempfile | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
							
								
								
									
										23
									
								
								0006-Fix-util.virt_detect-on-Xen.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								0006-Fix-util.virt_detect-on-Xen.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | From d609cebba48744c97ac7e0461f8827ab63198026 Mon Sep 17 00:00:00 2001 | ||||||
|  | From: Vojtech Trefny <vtrefny@redhat.com> | ||||||
|  | Date: Thu, 10 Jun 2021 16:58:42 +0200 | ||||||
|  | Subject: [PATCH] Fix util.virt_detect on Xen | ||||||
|  | 
 | ||||||
|  | Xen is apparently still alive so we should return True for it too. | ||||||
|  | ---
 | ||||||
|  |  blivet/util.py | 2 +- | ||||||
|  |  1 file changed, 1 insertion(+), 1 deletion(-) | ||||||
|  | 
 | ||||||
|  | diff --git a/blivet/util.py b/blivet/util.py
 | ||||||
|  | index 3bebb003..af60210b 100644
 | ||||||
|  | --- a/blivet/util.py
 | ||||||
|  | +++ b/blivet/util.py
 | ||||||
|  | @@ -1130,4 +1130,4 @@ def detect_virt():
 | ||||||
|  |      except (safe_dbus.DBusCallError, safe_dbus.DBusPropertyError): | ||||||
|  |          return False | ||||||
|  |      else: | ||||||
|  | -        return vm[0] in ('qemu', 'kvm')
 | ||||||
|  | +        return vm[0] in ('qemu', 'kvm', 'xen')
 | ||||||
|  | -- 
 | ||||||
|  | 2.31.1 | ||||||
|  | 
 | ||||||
| @ -19,28 +19,30 @@ | |||||||
| Summary:  A python module for system storage configuration | Summary:  A python module for system storage configuration | ||||||
| Name: python-blivet | Name: python-blivet | ||||||
| Url: https://storageapis.wordpress.com/projects/blivet | Url: https://storageapis.wordpress.com/projects/blivet | ||||||
| Version: 3.3.3 | Version: 3.4.0 | ||||||
| 
 | 
 | ||||||
| #%%global prerelease .b2 | #%%global prerelease .b2 | ||||||
| # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 | # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 | ||||||
| Release: 2%{?prerelease}%{?dist} | Release: 1%{?prerelease}%{?dist} | ||||||
| Epoch: 1 | Epoch: 1 | ||||||
| License: LGPLv2+ | License: LGPLv2+ | ||||||
| %global realname blivet | %global realname blivet | ||||||
| %global realversion %{version}%{?prerelease} | %global realversion %{version}%{?prerelease} | ||||||
| Source0: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}.tar.gz | Source0: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}.tar.gz | ||||||
| Source1: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}-tests.tar.gz | Source1: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}-tests.tar.gz | ||||||
| 
 | Patch0: 0001-force-lvm-cli-plugin.patch | ||||||
| %if 0%{?rhel} >= 9 | Patch1: 0002-remove-btrfs-plugin.patch | ||||||
| Patch0: 0001-remove-btrfs-plugin.patch | Patch2: 0003-Revert-More-consistent-lvm-errors.patch | ||||||
| %endif | Patch3: 0004-Revert-Terminology-cleanups.patch | ||||||
|  | Patch4: 0005-Fix-unify-importing-mock-module-in-tests.patch | ||||||
|  | Patch5: 0006-Fix-util.virt_detect-on-Xen.patch | ||||||
| 
 | 
 | ||||||
| # Versions of required components (done so we make sure the buildrequires | # Versions of required components (done so we make sure the buildrequires | ||||||
| # match the requires versions of things). | # match the requires versions of things). | ||||||
| %global partedver 1.8.1 | %global partedver 3.2 | ||||||
| %global pypartedver 3.10.4 | %global pypartedver 3.10.4 | ||||||
| %global utillinuxver 2.15.1 | %global utillinuxver 2.15.1 | ||||||
| %global libblockdevver 2.19 | %global libblockdevver 2.24 | ||||||
| %global libbytesizever 0.3 | %global libbytesizever 0.3 | ||||||
| %global pyudevver 0.18 | %global pyudevver 0.18 | ||||||
| 
 | 
 | ||||||
| @ -73,7 +75,7 @@ BuildRequires: gettext | |||||||
| BuildRequires: python3-devel | BuildRequires: python3-devel | ||||||
| BuildRequires: python3-setuptools | BuildRequires: python3-setuptools | ||||||
| 
 | 
 | ||||||
| Requires: python3 | %{?__python3:Requires: %{__python3}} | ||||||
| Requires: python3-six | Requires: python3-six | ||||||
| Requires: python3-pyudev >= %{pyudevver} | Requires: python3-pyudev >= %{pyudevver} | ||||||
| Requires: parted >= %{partedver} | Requires: parted >= %{partedver} | ||||||
| @ -196,6 +198,10 @@ configuration. | |||||||
| %endif | %endif | ||||||
| 
 | 
 | ||||||
| %changelog | %changelog | ||||||
|  | * Wed Jun 9 2021 Vojtech Trefny <vtrefny@redhat.com> - 3.4.0-1 | ||||||
|  | - Rebase to latest upstream release 3.4.0 | ||||||
|  |   Resolves: rhbz#1964341 | ||||||
|  | 
 | ||||||
| * Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1:3.3.3-2 | * Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 1:3.3.3-2 | ||||||
| - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 | - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										4
									
								
								sources
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								sources
									
									
									
									
									
								
							| @ -1,2 +1,2 @@ | |||||||
| SHA512 (blivet-3.3.3-tests.tar.gz) = d884db3699762563d8ec9968f127a694a29f089eb783cd74adcadc41b9eccc25416cb1a32d81c9534e20b206c060d0b117fb2846778f879611fc2e511ef4cc59 | SHA512 (blivet-3.4.0-tests.tar.gz) = 98351de3a3121d777b644537fedd24596843e609b9e8d9fa6f61729d6bf726bc343c2bb7712ba41138f82738235654756122a290645293df6c2a22944e0a08f7 | ||||||
| SHA512 (blivet-3.3.3.tar.gz) = c4eb96f6856a6dc7c6cd78bda064f5dd890951714a627b231488327b8790f16160a088842c9c3627ecb8551b25379402a4af9e777e8c610e7d5810baf5a0a41a | SHA512 (blivet-3.4.0.tar.gz) = c6797765b82313c55157169489be3e52d03f7656978c6c75bb87c6f1715ceb2447f9fe79cbc3d1d2d00c56329fabca524e1ab7ab074877f6edc8daf62f524038 | ||||||
|  | |||||||
| @ -1,16 +1,21 @@ | |||||||
| --- | --- | ||||||
|  | # - hosts: localhost | ||||||
| - hosts: all | - hosts: all | ||||||
|   roles: |   roles: | ||||||
|  |     - role: standard-test-source | ||||||
|  |       tags: | ||||||
|  |         - always | ||||||
|  | 
 | ||||||
|     - role: standard-test-basic |     - role: standard-test-basic | ||||||
|       tags: |       tags: | ||||||
|  |         - atomic | ||||||
|         - classic |         - classic | ||||||
|  |       required_packages: | ||||||
|  |         - python3 | ||||||
|  |         - python3-dbus | ||||||
|  |         - libblockdev-plugins-all | ||||||
|       tests: |       tests: | ||||||
|         - list-devices-1: |         - unit-tests: | ||||||
|             dir: . |             dir: . | ||||||
|             run: python3 /usr/share/doc/python3-blivet/examples/list_devices.py |             run: ./unit_testing.sh | ||||||
|         - lvm-factory: | 
 | ||||||
|             dir: . |  | ||||||
|             run: python3 ./lvm_factory.py --disks=vdb,vdc |  | ||||||
|         - list-devices-2: |  | ||||||
|             dir: . |  | ||||||
|             run: python3 /usr/share/doc/python3-blivet/examples/list_devices.py |  | ||||||
|  | |||||||
							
								
								
									
										12
									
								
								tests/unit_testing.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tests/unit_testing.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,12 @@ | |||||||
|  | #!/bin/bash | ||||||
|  | 
 | ||||||
|  | # Bail out if anything goes wrong | ||||||
|  | set -e | ||||||
|  | 
 | ||||||
|  | # Get path to blivet | ||||||
|  | blivet_path=$(find /usr/ -path */site-packages/) | ||||||
|  | 
 | ||||||
|  | # Run upstream unit tests | ||||||
|  | cd ./source/ | ||||||
|  | PYTHONPATH=$PYTHONPATH:$blivet_path python3 -m unittest discover -v -s ./tests/ -p '*_test.py' | ||||||
|  | 
 | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user