forked from rpms/python-blivet
		
	import python-blivet-3.2.2-3.el8
This commit is contained in:
		
							parent
							
								
									dcfe6beab6
								
							
						
					
					
						commit
						ade2f5b6d3
					
				
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1,2 +1,2 @@ | ||||
| SOURCES/blivet-3.1.0-tests.tar.gz | ||||
| SOURCES/blivet-3.1.0.tar.gz | ||||
| SOURCES/blivet-3.2.2-tests.tar.gz | ||||
| SOURCES/blivet-3.2.2.tar.gz | ||||
|  | ||||
| @ -1,2 +1,2 @@ | ||||
| 4bd8abd1cb7bffa644cffb017f6583a2fd7c19f9 SOURCES/blivet-3.1.0-tests.tar.gz | ||||
| f388d30e55dfaa9c22415c2e9e3f9670f9d08f27 SOURCES/blivet-3.1.0.tar.gz | ||||
| 84988ad63a9a9ddd9f2075b82b36bd98261df9e9 SOURCES/blivet-3.2.2-tests.tar.gz | ||||
| a89000bc2e9cfc8a1cfe09a58bf5e4e609f9b517 SOURCES/blivet-3.2.2.tar.gz | ||||
|  | ||||
| @ -0,0 +1,29 @@ | ||||
| From 760f08bbf7b801acd393a6d2b7447ca6ff28d590 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Fri, 22 May 2020 12:35:11 +0200 | ||||
| Subject: [PATCH] Skip test_mounting for filesystems that are not mountable | ||||
| 
 | ||||
| We can have tools to create the filesystem without having kernel | ||||
| module for mounting it. | ||||
| ---
 | ||||
|  tests/formats_test/fstesting.py | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/tests/formats_test/fstesting.py b/tests/formats_test/fstesting.py
 | ||||
| index aa1b42e5..62f806f9 100644
 | ||||
| --- a/tests/formats_test/fstesting.py
 | ||||
| +++ b/tests/formats_test/fstesting.py
 | ||||
| @@ -156,8 +156,8 @@ class FSAsRoot(loopbackedtestcase.LoopBackedTestCase):
 | ||||
|          # FIXME: BTRFS fails to mount | ||||
|          if isinstance(an_fs, fs.BTRFS): | ||||
|              self.skipTest("no mounting filesystem %s" % an_fs.name) | ||||
| -        if not an_fs.formattable:
 | ||||
| -            self.skipTest("can not create filesystem %s" % an_fs.name)
 | ||||
| +        if not an_fs.formattable or not an_fs.mountable:
 | ||||
| +            self.skipTest("can not create or mount filesystem %s" % an_fs.name)
 | ||||
|          an_fs.device = self.loop_devices[0] | ||||
|          self.assertIsNone(an_fs.create()) | ||||
|          self.assertTrue(an_fs.test_mount()) | ||||
| -- 
 | ||||
| 2.25.4 | ||||
| 
 | ||||
| @ -1,56 +0,0 @@ | ||||
| From cd85b0a41f16c571675f04c58ec4c1a428a88a61 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Thu, 16 Aug 2018 13:00:35 +0200 | ||||
| Subject: [PATCH] Create a separate availability check for dmraid support | ||||
| 
 | ||||
| Resolves: rhbz#1617958 | ||||
| ---
 | ||||
|  blivet/devices/disk.py       | 2 +- | ||||
|  blivet/tasks/availability.py | 9 +++++++-- | ||||
|  2 files changed, 8 insertions(+), 3 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py
 | ||||
| index 5b52330..012413c 100644
 | ||||
| --- a/blivet/devices/disk.py
 | ||||
| +++ b/blivet/devices/disk.py
 | ||||
| @@ -225,7 +225,7 @@ class DMRaidArrayDevice(DMDevice, ContainerDevice):
 | ||||
|      _is_disk = True | ||||
|      _format_class_name = property(lambda s: "dmraidmember") | ||||
|      _format_uuid_attr = property(lambda s: None) | ||||
| -    _external_dependencies = [availability.BLOCKDEV_DM_PLUGIN]
 | ||||
| +    _external_dependencies = [availability.BLOCKDEV_DM_PLUGIN_RAID]
 | ||||
|   | ||||
|      def __init__(self, name, fmt=None, | ||||
|                   size=None, parents=None, sysfs_path='', wwn=None): | ||||
| diff --git a/blivet/tasks/availability.py b/blivet/tasks/availability.py
 | ||||
| index 24909a2..7f64c10 100644
 | ||||
| --- a/blivet/tasks/availability.py
 | ||||
| +++ b/blivet/tasks/availability.py
 | ||||
| @@ -331,10 +331,14 @@ BLOCKDEV_DM_ALL_MODES = (blockdev.DMTechMode.CREATE_ACTIVATE |
 | ||||
|                           blockdev.DMTechMode.QUERY) | ||||
|  BLOCKDEV_DM = BlockDevTechInfo(plugin_name="dm", | ||||
|                                 check_fn=blockdev.dm_is_tech_avail, | ||||
| -                               technologies={blockdev.DMTech.MAP: BLOCKDEV_DM_ALL_MODES,
 | ||||
| -                                             blockdev.DMTech.RAID: BLOCKDEV_DM_ALL_MODES})
 | ||||
| +                               technologies={blockdev.DMTech.MAP: BLOCKDEV_DM_ALL_MODES})
 | ||||
|  BLOCKDEV_DM_TECH = BlockDevMethod(BLOCKDEV_DM) | ||||
|   | ||||
| +BLOCKDEV_DM_RAID = BlockDevTechInfo(plugin_name="dm",
 | ||||
| +                               check_fn=blockdev.dm_is_tech_avail,
 | ||||
| +                               technologies={blockdev.DMTech.RAID: BLOCKDEV_DM_ALL_MODES})
 | ||||
| +BLOCKDEV_DM_TECH_RAID = BlockDevMethod(BLOCKDEV_DM_RAID)
 | ||||
| +
 | ||||
|  # libblockdev loop plugin required technologies and modes | ||||
|  BLOCKDEV_LOOP_ALL_MODES = (blockdev.LoopTechMode.CREATE | | ||||
|                             blockdev.LoopTechMode.CREATE | | ||||
| @@ -399,6 +403,7 @@ BLOCKDEV_SWAP_TECH = BlockDevMethod(BLOCKDEV_SWAP)
 | ||||
|  BLOCKDEV_BTRFS_PLUGIN = blockdev_plugin("btrfs", BLOCKDEV_BTRFS_TECH) | ||||
|  BLOCKDEV_CRYPTO_PLUGIN = blockdev_plugin("crypto", BLOCKDEV_CRYPTO_TECH) | ||||
|  BLOCKDEV_DM_PLUGIN = blockdev_plugin("dm", BLOCKDEV_DM_TECH) | ||||
| +BLOCKDEV_DM_PLUGIN_RAID = blockdev_plugin("dm", BLOCKDEV_DM_TECH_RAID)
 | ||||
|  BLOCKDEV_LOOP_PLUGIN = blockdev_plugin("loop", BLOCKDEV_LOOP_TECH) | ||||
|  BLOCKDEV_LVM_PLUGIN = blockdev_plugin("lvm", BLOCKDEV_LVM_TECH) | ||||
|  BLOCKDEV_MDRAID_PLUGIN = blockdev_plugin("mdraid", BLOCKDEV_MD_TECH) | ||||
| -- 
 | ||||
| 1.8.3.1 | ||||
| 
 | ||||
							
								
								
									
										38
									
								
								SOURCES/0004-Add-extra-sleep-after-pvremove-call.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								SOURCES/0004-Add-extra-sleep-after-pvremove-call.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,38 @@ | ||||
| From 6a62a81d326a1121a2768735e52a8e1c5e5d6f0d Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 24 Jun 2020 14:43:47 +0200 | ||||
| Subject: [PATCH] Add extra sleep after pvremove call | ||||
| 
 | ||||
| To give enough time for the async pvscan to finish scanning the | ||||
| partition before removing it. | ||||
| 
 | ||||
| Resolves: rhbz#1640601 | ||||
| ---
 | ||||
|  blivet/formats/lvmpv.py | 4 ++++ | ||||
|  1 file changed, 4 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/formats/lvmpv.py b/blivet/formats/lvmpv.py
 | ||||
| index e4182adb..9f53ec6b 100644
 | ||||
| --- a/blivet/formats/lvmpv.py
 | ||||
| +++ b/blivet/formats/lvmpv.py
 | ||||
| @@ -26,6 +26,7 @@ gi.require_version("BlockDev", "2.0")
 | ||||
|  from gi.repository import BlockDev as blockdev | ||||
|   | ||||
|  import os | ||||
| +import time
 | ||||
|   | ||||
|  from ..storage_log import log_method_call | ||||
|  from parted import PARTITION_LVM | ||||
| @@ -137,6 +138,9 @@ class LVMPhysicalVolume(DeviceFormat):
 | ||||
|              DeviceFormat._destroy(self, **kwargs) | ||||
|          finally: | ||||
|              udev.settle() | ||||
| +            # LVM now has async pvscan jobs so udev.settle doesn't help and if we try to remove
 | ||||
| +            # the partition immediately after the pvremove we get an error
 | ||||
| +            time.sleep(5)
 | ||||
|   | ||||
|      @property | ||||
|      def destroyable(self): | ||||
| -- 
 | ||||
| 2.25.4 | ||||
| 
 | ||||
| @ -1,104 +0,0 @@ | ||||
| From fd07d14ad1f19c700d5344c8af11be6a1e314ceb Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 12 Sep 2018 10:45:41 +0200 | ||||
| Subject: [PATCH 1/2] Allow removing btrfs volumes without btrfs support | ||||
| 
 | ||||
| Btrfs volumes are removed using wipefs so we don't need to check | ||||
| for device dependencies availability when removing the volume | ||||
| (btrfs support depends on libblockdev btrfs plugin). | ||||
| 
 | ||||
| Resolves: rhbz#1605213 | ||||
| ---
 | ||||
|  blivet/deviceaction.py | 23 ++++++++++++++++++----- | ||||
|  1 file changed, 18 insertions(+), 5 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
 | ||||
| index 3e337e18..b3e9e5f1 100644
 | ||||
| --- a/blivet/deviceaction.py
 | ||||
| +++ b/blivet/deviceaction.py
 | ||||
| @@ -160,15 +160,19 @@ def __init__(self, device):
 | ||||
|          if not isinstance(device, StorageDevice): | ||||
|              raise ValueError("arg 1 must be a StorageDevice instance") | ||||
|   | ||||
| -        unavailable_dependencies = device.unavailable_dependencies
 | ||||
| -        if unavailable_dependencies:
 | ||||
| -            dependencies_str = ", ".join(str(d) for d in unavailable_dependencies)
 | ||||
| -            raise DependencyError("device type %s requires unavailable_dependencies: %s" % (device.type, dependencies_str))
 | ||||
| -
 | ||||
|          self.device = device | ||||
| +
 | ||||
| +        self._check_device_dependencies()
 | ||||
| +
 | ||||
|          self.container = getattr(self.device, "container", None) | ||||
|          self._applied = False | ||||
|   | ||||
| +    def _check_device_dependencies(self):
 | ||||
| +        unavailable_dependencies = self.device.unavailable_dependencies
 | ||||
| +        if unavailable_dependencies:
 | ||||
| +            dependencies_str = ", ".join(str(d) for d in unavailable_dependencies)
 | ||||
| +            raise DependencyError("device type %s requires unavailable_dependencies: %s" % (self.device.type, dependencies_str))
 | ||||
| +
 | ||||
|      def apply(self): | ||||
|          """ apply changes related to the action to the device(s) """ | ||||
|          self._applied = True | ||||
| @@ -379,6 +383,15 @@ def __init__(self, device):
 | ||||
|          # XXX should we insist that device.fs be None? | ||||
|          DeviceAction.__init__(self, device) | ||||
|   | ||||
| +    def _check_device_dependencies(self):
 | ||||
| +        if self.device.type == "btrfs volume":
 | ||||
| +            # XXX destroying a btrfs volume is a special case -- we don't destroy
 | ||||
| +            # the device, but use wipefs to destroy format on its parents so we
 | ||||
| +            # don't need btrfs plugin or btrfs-progs for this
 | ||||
| +            return
 | ||||
| +
 | ||||
| +        super(ActionDestroyDevice, self)._check_device_dependencies()
 | ||||
| +
 | ||||
|      def execute(self, callbacks=None): | ||||
|          super(ActionDestroyDevice, self).execute(callbacks=callbacks) | ||||
|          self.device.destroy() | ||||
| 
 | ||||
| From b9f1b4acb654c5fb70be1a2200bcf3a34dcde467 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Mon, 17 Sep 2018 10:25:24 +0200 | ||||
| Subject: [PATCH 2/2] Check device dependencies only for device actions | ||||
| 
 | ||||
| We don't want to check device dependencies for format actions. | ||||
| It should be possible to for example format an opened LUKS device | ||||
| without libblockdev crypto plugin. | ||||
| 
 | ||||
| Related: rhbz#1605213 | ||||
| ---
 | ||||
|  blivet/deviceaction.py                  | 3 ++- | ||||
|  tests/devices_test/dependencies_test.py | 4 ---- | ||||
|  2 files changed, 2 insertions(+), 5 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
 | ||||
| index b3e9e5f1..14a06ff0 100644
 | ||||
| --- a/blivet/deviceaction.py
 | ||||
| +++ b/blivet/deviceaction.py
 | ||||
| @@ -162,7 +162,8 @@ def __init__(self, device):
 | ||||
|   | ||||
|          self.device = device | ||||
|   | ||||
| -        self._check_device_dependencies()
 | ||||
| +        if self.is_device:
 | ||||
| +            self._check_device_dependencies()
 | ||||
|   | ||||
|          self.container = getattr(self.device, "container", None) | ||||
|          self._applied = False | ||||
| diff --git a/tests/devices_test/dependencies_test.py b/tests/devices_test/dependencies_test.py
 | ||||
| index 0b44493e..e6b5bdb4 100644
 | ||||
| --- a/tests/devices_test/dependencies_test.py
 | ||||
| +++ b/tests/devices_test/dependencies_test.py
 | ||||
| @@ -97,10 +97,6 @@ def test_availability_mdraidplugin(self):
 | ||||
|              ActionCreateDevice(self.luks) | ||||
|          with self.assertRaises(DependencyError): | ||||
|              ActionDestroyDevice(self.dev) | ||||
| -        with self.assertRaises(DependencyError):
 | ||||
| -            ActionCreateFormat(self.dev)
 | ||||
| -        with self.assertRaises(DependencyError):
 | ||||
| -            ActionDestroyFormat(self.dev)
 | ||||
|   | ||||
|      def _clean_up(self): | ||||
|          availability.BLOCKDEV_MDRAID_PLUGIN._method = self.mdraid_method | ||||
| @ -0,0 +1,48 @@ | ||||
| From dc964f10d24499ea7fc90fd896a8b50c9c5e2d74 Mon Sep 17 00:00:00 2001 | ||||
| From: "Samantha N. Bueno" <sbueno+anaconda@redhat.com> | ||||
| Date: Wed, 8 Jun 2016 13:47:40 -0400 | ||||
| Subject: [PATCH] Round down to nearest MiB value when writing ks parittion | ||||
|  info. | ||||
| 
 | ||||
| On s390x in particular, some partition alignment issue is causing fractional | ||||
| sizes to be reported. Pykickstart doesn't take anything except int values for | ||||
| partition info, hence the call to roundToNearest. | ||||
| 
 | ||||
| This change only affects the data that is written to ks.cfg. | ||||
| 
 | ||||
| Resolves: rhbz#1850670 | ||||
| --- | ||||
|  blivet/devices/partition.py | 9 ++++++--- | ||||
|  1 file changed, 6 insertions(+), 3 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py | ||||
| index 0c56a6e7..76048aed 100644 | ||||
| --- a/blivet/devices/partition.py | ||||
| +++ b/blivet/devices/partition.py | ||||
| @@ -35,7 +35,7 @@ | ||||
|  from ..storage_log import log_method_call | ||||
|  from .. import udev | ||||
|  from ..formats import DeviceFormat, get_format | ||||
| -from ..size import Size, MiB | ||||
| +from ..size import Size, MiB, ROUND_DOWN | ||||
|   | ||||
|  import logging | ||||
|  log = logging.getLogger("blivet") | ||||
| @@ -967,7 +967,8 @@ def populate_ksdata(self, data): | ||||
|          data.resize = (self.exists and self.target_size and | ||||
|                         self.target_size != self.current_size) | ||||
|          if not self.exists: | ||||
| -            data.size = self.req_base_size.convert_to(MiB) | ||||
| +            # round this to nearest MiB before doing anything else | ||||
| +            data.size = self.req_base_size.round_to_nearest(MiB, rounding=ROUND_DOWN).convert_to(spec=MiB) | ||||
|              data.grow = self.req_grow | ||||
|              if self.req_grow: | ||||
|                  data.max_size_mb = self.req_max_size.convert_to(MiB) | ||||
| @@ -980,4 +981,6 @@ def populate_ksdata(self, data): | ||||
|              data.on_part = self.name                     # by-id | ||||
|   | ||||
|              if data.resize: | ||||
| -                data.size = self.size.convert_to(MiB) | ||||
| +                # on s390x in particular, fractional sizes are reported, which | ||||
| +                # cause issues when writing to ks.cfg | ||||
| +                data.size = self.size.round_to_nearest(MiB, rounding=ROUND_DOWN).convert_to(spec=MiB) | ||||
| @ -1,272 +0,0 @@ | ||||
| From 12a2bdf3fc5a7a4568ff56b244d3067b73f82681 Mon Sep 17 00:00:00 2001 | ||||
| From: Peter Robinson <pbrobinson@gmail.com> | ||||
| Date: Tue, 7 Aug 2018 15:11:56 +0100 | ||||
| Subject: [PATCH 1/6] arch: arm: drop omap specifics for partitioning | ||||
| 
 | ||||
| We've long stopped supporting or using any specifics around OMAP | ||||
| ARM machines and all ARM platforms support the extlinux means of | ||||
| doing things one way or another. | ||||
| 
 | ||||
| Signed-off-by: Peter Robinson <pbrobinson@gmail.com> | ||||
| ---
 | ||||
|  blivet/arch.py              | 4 ---- | ||||
|  blivet/devices/partition.py | 3 --- | ||||
|  2 files changed, 7 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/arch.py b/blivet/arch.py
 | ||||
| index 20fe4f57..f30b2d8b 100644
 | ||||
| --- a/blivet/arch.py
 | ||||
| +++ b/blivet/arch.py
 | ||||
| @@ -352,10 +352,6 @@ def is_ipseries():
 | ||||
|      return is_ppc() and get_ppc_machine() in ("iSeries", "pSeries") | ||||
|   | ||||
|   | ||||
| -def is_omap_arm():
 | ||||
| -    return is_arm() and get_arm_machine() == "omap"
 | ||||
| -
 | ||||
| -
 | ||||
|  def get_arch(): | ||||
|      """ | ||||
|      :return: The hardware architecture | ||||
| diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
 | ||||
| index 47ff547b..623e1c9d 100644
 | ||||
| --- a/blivet/devices/partition.py
 | ||||
| +++ b/blivet/devices/partition.py
 | ||||
| @@ -421,9 +421,6 @@ def _get_weight(self):
 | ||||
|              # On ARM images '/' must be the last partition. | ||||
|              if self.format.mountpoint == "/": | ||||
|                  weight = -100 | ||||
| -            elif (arch.is_omap_arm() and
 | ||||
| -                  self.format.mountpoint == "/boot/uboot" and self.format.type == "vfat"):
 | ||||
| -                weight = 5000
 | ||||
|          elif arch.is_ppc(): | ||||
|              if arch.is_pmac() and self.format.type == "appleboot": | ||||
|                  weight = 5000 | ||||
| 
 | ||||
| From ec978c3c625c74c387a9c8074d2378c4ecbeac47 Mon Sep 17 00:00:00 2001 | ||||
| From: Peter Robinson <pbrobinson@gmail.com> | ||||
| Date: Thu, 16 Aug 2018 14:32:19 +0100 | ||||
| Subject: [PATCH 2/6] arch: arm: drop get_arm_machine function | ||||
| 
 | ||||
| The get_arm_machine function was used when we had to have detection for which | ||||
| arm specific kernel to install. The last userr of this was the omap check for | ||||
| special partitioning which is no longer used due to extlinux support so we can | ||||
| now drop this function too. | ||||
| 
 | ||||
| Signed-off-by: Peter Robinson <pbrobinson@gmail.com> | ||||
| ---
 | ||||
|  blivet/arch.py  | 22 ---------------------- | ||||
|  blivet/flags.py |  2 -- | ||||
|  2 files changed, 24 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/arch.py b/blivet/arch.py
 | ||||
| index f30b2d8b..55ce8108 100644
 | ||||
| --- a/blivet/arch.py
 | ||||
| +++ b/blivet/arch.py
 | ||||
| @@ -33,7 +33,6 @@
 | ||||
|   | ||||
|  import os | ||||
|   | ||||
| -from .flags import flags
 | ||||
|  from .storage_log import log_exception_info | ||||
|   | ||||
|  import logging | ||||
| @@ -182,27 +181,6 @@ def is_aarch64():
 | ||||
|      return os.uname()[4] == 'aarch64' | ||||
|   | ||||
|   | ||||
| -def get_arm_machine():
 | ||||
| -    """
 | ||||
| -    :return: The ARM processor variety type, or None if not ARM.
 | ||||
| -    :rtype: string
 | ||||
| -
 | ||||
| -    """
 | ||||
| -    if not is_arm():
 | ||||
| -        return None
 | ||||
| -
 | ||||
| -    if flags.arm_platform:
 | ||||
| -        return flags.arm_platform
 | ||||
| -
 | ||||
| -    arm_machine = os.uname()[2].rpartition('.')[2]
 | ||||
| -
 | ||||
| -    if arm_machine.startswith('arm'):
 | ||||
| -        # @TBD - Huh? Don't you want the arm machine name here?
 | ||||
| -        return None
 | ||||
| -    else:
 | ||||
| -        return arm_machine
 | ||||
| -
 | ||||
| -
 | ||||
|  def is_cell(): | ||||
|      """ | ||||
|      :return: True if the hardware is the Cell platform, False otherwise. | ||||
| diff --git a/blivet/flags.py b/blivet/flags.py
 | ||||
| index 18401218..4e26d82f 100644
 | ||||
| --- a/blivet/flags.py
 | ||||
| +++ b/blivet/flags.py
 | ||||
| @@ -57,8 +57,6 @@ def __init__(self):
 | ||||
|          self.jfs = True | ||||
|          self.reiserfs = True | ||||
|   | ||||
| -        self.arm_platform = None
 | ||||
| -
 | ||||
|          self.gpt = False | ||||
|   | ||||
|          # for this flag to take effect, | ||||
| 
 | ||||
| From e75049e9e9edac9da789cee2add2b4190159805d Mon Sep 17 00:00:00 2001 | ||||
| From: Peter Robinson <pbrobinson@gmail.com> | ||||
| Date: Thu, 16 Aug 2018 14:35:30 +0100 | ||||
| Subject: [PATCH 3/6] Aarch64 platforms: Fix gpt defaults for 64 bit arm | ||||
|  platforms | ||||
| 
 | ||||
| The 46165f589d commit added support for msdos needed on some aarch64 devices | ||||
| but it messed up the gpt defaults, this was fixed in 4908746c3a but this now | ||||
| defaults back to msdos so we put in an aarch64 options to put gpt first again. | ||||
| 
 | ||||
| Signed-off-by: Peter Robinson <pbrobinson@gmail.com> | ||||
| ---
 | ||||
|  blivet/formats/disklabel.py | 2 ++ | ||||
|  1 file changed, 2 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
 | ||||
| index 44f9834c..e93a4c13 100644
 | ||||
| --- a/blivet/formats/disklabel.py
 | ||||
| +++ b/blivet/formats/disklabel.py
 | ||||
| @@ -223,6 +223,8 @@ def get_platform_label_types(cls):
 | ||||
|          label_types = ["msdos", "gpt"] | ||||
|          if arch.is_pmac(): | ||||
|              label_types = ["mac"] | ||||
| +        elif arch.is_aarch64():
 | ||||
| +            label_types = ["gpt", "msdos"]
 | ||||
|          elif arch.is_efi() and not arch.is_aarch64(): | ||||
|              label_types = ["gpt"] | ||||
|          elif arch.is_s390(): | ||||
| 
 | ||||
| From dda51536e902def437872fcdb3005efaff231703 Mon Sep 17 00:00:00 2001 | ||||
| From: Peter Robinson <pbrobinson@gmail.com> | ||||
| Date: Thu, 16 Aug 2018 14:38:16 +0100 | ||||
| Subject: [PATCH 4/6] arm: add support for EFI on ARMv7 | ||||
| 
 | ||||
| We now can support EFI for ARMv7 so add/enabled the checks for ARM too. | ||||
| 
 | ||||
| Signed-off-by: Peter Robinson <pbrobinson@gmail.com> | ||||
| ---
 | ||||
|  blivet/formats/disklabel.py | 2 ++ | ||||
|  1 file changed, 2 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
 | ||||
| index e93a4c13..e13ab2f8 100644
 | ||||
| --- a/blivet/formats/disklabel.py
 | ||||
| +++ b/blivet/formats/disklabel.py
 | ||||
| @@ -225,6 +225,8 @@ def get_platform_label_types(cls):
 | ||||
|              label_types = ["mac"] | ||||
|          elif arch.is_aarch64(): | ||||
|              label_types = ["gpt", "msdos"] | ||||
| +        elif arch.is_efi() and arch.is_arm():
 | ||||
| +            label_types = ["msdos", "gpt"]
 | ||||
|          elif arch.is_efi() and not arch.is_aarch64(): | ||||
|              label_types = ["gpt"] | ||||
|          elif arch.is_s390(): | ||||
| 
 | ||||
| From 1cdd509f2034f456402f39045425cbdfe62bde97 Mon Sep 17 00:00:00 2001 | ||||
| From: Peter Robinson <pbrobinson@gmail.com> | ||||
| Date: Thu, 23 Aug 2018 14:23:38 +0100 | ||||
| Subject: [PATCH 5/6] Update disk label tests for ARM platforms | ||||
| 
 | ||||
| UEFI supports either gpt or msdos but different platforms have different | ||||
| requirements. Update the disk label tests to test the following: | ||||
| - aarch64: gpt default but msdos option also supported
 | ||||
| - ARMv7 UEFI: msdos default but gpt option also supported
 | ||||
| - ARMv7 extlinux: msdos default, also support gpt
 | ||||
| 
 | ||||
| Signed-off-by: Peter Robinson <pbrobinson@gmail.com> | ||||
| ---
 | ||||
|  tests/formats_test/disklabel_test.py | 12 ++++++++++++ | ||||
|  1 file changed, 12 insertions(+) | ||||
| 
 | ||||
| diff --git a/tests/formats_test/disklabel_test.py b/tests/formats_test/disklabel_test.py
 | ||||
| index 4b6608f5..3edbdb0b 100644
 | ||||
| --- a/tests/formats_test/disklabel_test.py
 | ||||
| +++ b/tests/formats_test/disklabel_test.py
 | ||||
| @@ -71,6 +71,7 @@ def test_platform_label_types(self, arch):
 | ||||
|          arch.is_s390.return_value = False | ||||
|          arch.is_efi.return_value = False | ||||
|          arch.is_aarch64.return_value = False | ||||
| +        arch.is_arm.return_value = False
 | ||||
|          arch.is_pmac.return_value = False | ||||
|   | ||||
|          self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt"]) | ||||
| @@ -81,8 +82,18 @@ def test_platform_label_types(self, arch):
 | ||||
|   | ||||
|          arch.is_efi.return_value = True | ||||
|          self.assertEqual(disklabel_class.get_platform_label_types(), ["gpt"]) | ||||
| +        arch.is_aarch64.return_value = True
 | ||||
| +        self.assertEqual(disklabel_class.get_platform_label_types(), ["gpt", "msdos"])
 | ||||
| +        arch.is_aarch64.return_value = False
 | ||||
| +        arch.is_arm.return_value = True
 | ||||
| +        self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt"])
 | ||||
| +        arch.is_arm.return_value = False
 | ||||
|          arch.is_efi.return_value = False | ||||
|   | ||||
| +        arch.is_arm.return_value = True
 | ||||
| +        self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt"])
 | ||||
| +        arch.is_arm.return_value = False
 | ||||
| +
 | ||||
|          arch.is_s390.return_value = True | ||||
|          self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "dasd"]) | ||||
|          arch.is_s390.return_value = False | ||||
| @@ -123,6 +134,7 @@ def test_best_label_type(self, arch):
 | ||||
|          arch.is_s390.return_value = False | ||||
|          arch.is_efi.return_value = False | ||||
|          arch.is_aarch64.return_value = False | ||||
| +        arch.is_arm.return_value = False
 | ||||
|          arch.is_pmac.return_value = False | ||||
|   | ||||
|          with mock.patch.object(dl, '_label_type_size_check') as size_check: | ||||
| 
 | ||||
| From e0e6ac41cea805c3bf56852bfe2cd67d4bfe0b83 Mon Sep 17 00:00:00 2001 | ||||
| From: Peter Robinson <pbrobinson@gmail.com> | ||||
| Date: Thu, 23 Aug 2018 15:54:51 +0100 | ||||
| Subject: [PATCH 6/6] Drop omap partition table tests on ARM platforms | ||||
| 
 | ||||
| We no longer need to test the /boot/uboot tests for omap platforms so | ||||
| drop them as they're obsolete. | ||||
| 
 | ||||
| Signed-off-by: Peter Robinson <pbrobinson@gmail.com> | ||||
| ---
 | ||||
|  tests/devices_test/partition_test.py | 14 ++------------ | ||||
|  1 file changed, 2 insertions(+), 12 deletions(-) | ||||
| 
 | ||||
| diff --git a/tests/devices_test/partition_test.py b/tests/devices_test/partition_test.py
 | ||||
| index 394ffc27..08c0447d 100644
 | ||||
| --- a/tests/devices_test/partition_test.py
 | ||||
| +++ b/tests/devices_test/partition_test.py
 | ||||
| @@ -26,11 +26,9 @@
 | ||||
|              Weighted(fstype="efi", mountpoint="/boot/efi", true_funcs=['is_efi'], weight=5000), | ||||
|              Weighted(fstype="prepboot", mountpoint=None, true_funcs=['is_ppc', 'is_ipseries'], weight=5000), | ||||
|              Weighted(fstype="appleboot", mountpoint=None, true_funcs=['is_ppc', 'is_pmac'], weight=5000), | ||||
| -            Weighted(fstype="vfat", mountpoint="/boot/uboot", true_funcs=['is_arm', 'is_omap_arm'], weight=5000),
 | ||||
| -            Weighted(fstype=None, mountpoint="/", true_funcs=['is_arm'], weight=-100),
 | ||||
| -            Weighted(fstype=None, mountpoint="/", true_funcs=['is_arm', 'is_omap_arm'], weight=-100)]
 | ||||
| +            Weighted(fstype=None, mountpoint="/", true_funcs=['is_arm'], weight=-100)]
 | ||||
|   | ||||
| -arch_funcs = ['is_arm', 'is_efi', 'is_ipseries', 'is_omap_arm', 'is_pmac', 'is_ppc', 'is_x86']
 | ||||
| +arch_funcs = ['is_arm', 'is_efi', 'is_ipseries', 'is_pmac', 'is_ppc', 'is_x86']
 | ||||
|   | ||||
|   | ||||
|  class PartitionDeviceTestCase(unittest.TestCase): | ||||
| @@ -309,14 +307,6 @@ def test_weight_1(self, *patches):
 | ||||
|              fmt.mountpoint = "/" | ||||
|              self.assertEqual(dev.weight, -100) | ||||
|   | ||||
| -            arch.is_omap_arm.return_value = False
 | ||||
| -            fmt.mountpoint = "/boot/uboot"
 | ||||
| -            fmt.type = "vfat"
 | ||||
| -            self.assertEqual(dev.weight, 0)
 | ||||
| -
 | ||||
| -            arch.is_omap_arm.return_value = True
 | ||||
| -            self.assertEqual(dev.weight, 5000)
 | ||||
| -
 | ||||
|              # | ||||
|              # ppc | ||||
|              # | ||||
| @ -1,44 +0,0 @@ | ||||
| From 04dc595e3921879fa3e5b0f82506d63fdea4d2c8 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 3 Oct 2018 14:11:08 +0200 | ||||
| Subject: [PATCH] Fix options for ISCSI functions | ||||
| 
 | ||||
| Correct mutual authentication options in UDisks are | ||||
| "reverse-username" and "reverse-password". | ||||
| 
 | ||||
| Resolves: rhbz#1635569 | ||||
| ---
 | ||||
|  blivet/iscsi.py | 8 ++++---- | ||||
|  1 file changed, 4 insertions(+), 4 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/iscsi.py b/blivet/iscsi.py
 | ||||
| index b979e01c..ca51f8ed 100644
 | ||||
| --- a/blivet/iscsi.py
 | ||||
| +++ b/blivet/iscsi.py
 | ||||
| @@ -385,9 +385,9 @@ class iSCSI(object):
 | ||||
|              if password: | ||||
|                  auth_info["password"] = GLib.Variant("s", password) | ||||
|              if r_username: | ||||
| -                auth_info["r_username"] = GLib.Variant("s", r_username)
 | ||||
| +                auth_info["reverse-username"] = GLib.Variant("s", r_username)
 | ||||
|              if r_password: | ||||
| -                auth_info["r_password"] = GLib.Variant("s", r_password)
 | ||||
| +                auth_info["reverse-password"] = GLib.Variant("s", r_password)
 | ||||
|   | ||||
|              args = GLib.Variant("(sqa{sv})", (ipaddr, int(port), auth_info)) | ||||
|              nodes, _n_nodes = self._call_initiator_method("DiscoverSendTargets", args) | ||||
| @@ -423,9 +423,9 @@ class iSCSI(object):
 | ||||
|          if password: | ||||
|              auth_info["password"] = GLib.Variant("s", password) | ||||
|          if r_username: | ||||
| -            auth_info["r_username"] = GLib.Variant("s", r_username)
 | ||||
| +            auth_info["reverse-username"] = GLib.Variant("s", r_username)
 | ||||
|          if r_password: | ||||
| -            auth_info["r_password"] = GLib.Variant("s", r_password)
 | ||||
| +            auth_info["reverse-password"] = GLib.Variant("s", r_password)
 | ||||
|   | ||||
|          try: | ||||
|              self._login(node, auth_info) | ||||
| -- 
 | ||||
| 2.17.2 | ||||
| 
 | ||||
| @ -1,45 +0,0 @@ | ||||
| From 0b6f818f46e3b7c5b9be33216ef8438f59d7bcf1 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Thu, 18 Oct 2018 10:07:31 -0400 | ||||
| Subject: [PATCH] Wipe all stale metadata after creating md array. (#1639682) | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/devices/md.py                      | 4 ++++ | ||||
|  tests/devices_test/device_methods_test.py | 3 ++- | ||||
|  2 files changed, 6 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/md.py b/blivet/devices/md.py
 | ||||
| index dad099e8..6a837df0 100644
 | ||||
| --- a/blivet/devices/md.py
 | ||||
| +++ b/blivet/devices/md.py
 | ||||
| @@ -31,6 +31,7 @@
 | ||||
|  from ..devicelibs import mdraid, raid | ||||
|   | ||||
|  from .. import errors | ||||
| +from ..formats import DeviceFormat
 | ||||
|  from .. import util | ||||
|  from ..static_data import pvs_info | ||||
|  from ..storage_log import log_method_call | ||||
| @@ -563,6 +564,9 @@ def remove_stale_lvm():
 | ||||
|   | ||||
|          remove_stale_lvm() | ||||
|   | ||||
| +        # remove any other stale metadata before proceeding
 | ||||
| +        DeviceFormat(device=self.path, exists=True).destroy()
 | ||||
| +
 | ||||
|      def _create(self): | ||||
|          """ Create the device. """ | ||||
|          log_method_call(self, self.name, status=self.status) | ||||
| diff --git a/tests/devices_test/device_methods_test.py b/tests/devices_test/device_methods_test.py
 | ||||
| index 8e40e6b6..12d5f7d8 100644
 | ||||
| --- a/tests/devices_test/device_methods_test.py
 | ||||
| +++ b/tests/devices_test/device_methods_test.py
 | ||||
| @@ -404,6 +404,7 @@ def test_setup(self):
 | ||||
|          self.assertTrue(self.patches["md"].activate.called) | ||||
|   | ||||
|      def test_create(self): | ||||
| -        super(MDRaidArrayDeviceMethodsTestCase, self).test_create()
 | ||||
| +        with patch("blivet.devices.md.DeviceFormat"):
 | ||||
| +            super(MDRaidArrayDeviceMethodsTestCase, self).test_create()
 | ||||
|          self.device._create() | ||||
|          self.assertTrue(self.patches["md"].create.called) | ||||
| @ -1,29 +0,0 @@ | ||||
| From 653a3df662d10d0c8cc7f34138efd89a61f531a3 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 9 Jan 2019 13:03:49 +0100 | ||||
| Subject: [PATCH] Copy the iSCSI initiator name file to the installed system | ||||
| 
 | ||||
| The initiatorname.iscsi file is used (sometimes) during boot so | ||||
| we need to write the configuration to the installed system. | ||||
| 
 | ||||
| Resolves: rhbz#1664587 | ||||
| ---
 | ||||
|  blivet/iscsi.py | 5 +++++ | ||||
|  1 file changed, 5 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/iscsi.py b/blivet/iscsi.py
 | ||||
| index 3e44e6ed..f053577d 100644
 | ||||
| --- a/blivet/iscsi.py
 | ||||
| +++ b/blivet/iscsi.py
 | ||||
| @@ -563,6 +563,11 @@ def write(self, root, storage):  # pylint: disable=unused-argument
 | ||||
|              shutil.copytree("/var/lib/iscsi", root + "/var/lib/iscsi", | ||||
|                              symlinks=True) | ||||
|   | ||||
| +        # copy the initiator file too
 | ||||
| +        if not os.path.isdir(root + "/etc/iscsi"):
 | ||||
| +            os.makedirs(root + "/etc/iscsi", 0o755)
 | ||||
| +        shutil.copyfile(INITIATOR_FILE, root + INITIATOR_FILE)
 | ||||
| +
 | ||||
|      def get_node(self, name, address, port, iface): | ||||
|          for node in self.active_nodes(): | ||||
|              if node.name == name and node.address == address and \ | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @ -1,33 +0,0 @@ | ||||
| From 8adbf9cf56f486f2f974cf6cdfda657293aff141 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Fri, 19 Oct 2018 09:49:56 -0400 | ||||
| Subject: [PATCH 1/2] Require libfc instead of fcoe for offloaded FCoE. | ||||
|  (#1575953) | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/fcoe.py | 4 ++-- | ||||
|  1 file changed, 2 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/fcoe.py b/blivet/fcoe.py
 | ||||
| index 1a2cf9d4..3a1887dc 100644
 | ||||
| --- a/blivet/fcoe.py
 | ||||
| +++ b/blivet/fcoe.py
 | ||||
| @@ -32,13 +32,13 @@ _fcoe_module_loaded = False
 | ||||
|  def has_fcoe(): | ||||
|      global _fcoe_module_loaded | ||||
|      if not _fcoe_module_loaded: | ||||
| -        util.run_program(["modprobe", "fcoe"])
 | ||||
| +        util.run_program(["modprobe", "libfc"])
 | ||||
|          _fcoe_module_loaded = True | ||||
|          if "bnx2x" in util.lsmod(): | ||||
|              log.info("fcoe: loading bnx2fc") | ||||
|              util.run_program(["modprobe", "bnx2fc"]) | ||||
|   | ||||
| -    return os.access("/sys/module/fcoe", os.X_OK)
 | ||||
| +    return os.access("/sys/module/libfc", os.X_OK)
 | ||||
|   | ||||
|   | ||||
|  class FCoE(object): | ||||
| -- 
 | ||||
| 2.17.2 | ||||
| 
 | ||||
| @ -1,64 +0,0 @@ | ||||
| From 8bdade5e60b746e8d992289e71123ad27146a7f1 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Wed, 24 Oct 2018 20:08:48 -0400 | ||||
| Subject: [PATCH] Use udev to determine if disk is a multipath member. | ||||
| 
 | ||||
| Related: rhbz#1575953 | ||||
| ---
 | ||||
|  blivet/populator/helpers/disklabel.py | 3 +-- | ||||
|  tests/populator_test.py               | 6 ++---- | ||||
|  2 files changed, 3 insertions(+), 6 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/populator/helpers/disklabel.py b/blivet/populator/helpers/disklabel.py
 | ||||
| index c2acb117..db10638e 100644
 | ||||
| --- a/blivet/populator/helpers/disklabel.py
 | ||||
| +++ b/blivet/populator/helpers/disklabel.py
 | ||||
| @@ -28,7 +28,6 @@
 | ||||
|  from ...errors import InvalidDiskLabelError | ||||
|  from ...storage_log import log_exception_info, log_method_call | ||||
|  from .formatpopulator import FormatPopulator | ||||
| -from ...static_data import mpath_members
 | ||||
|   | ||||
|  import logging | ||||
|  log = logging.getLogger("blivet") | ||||
| @@ -44,7 +43,7 @@ def match(cls, data, device):
 | ||||
|          return (bool(udev.device_get_disklabel_type(data)) and | ||||
|                  not udev.device_is_biosraid_member(data) and | ||||
|                  udev.device_get_format(data) != "iso9660" and | ||||
| -                not (device.is_disk and mpath_members.is_mpath_member(device.path)))
 | ||||
| +                not (device.is_disk and udev.device_get_format(data) == "mpath_member"))
 | ||||
|   | ||||
|      def _get_kwargs(self): | ||||
|          kwargs = super(DiskLabelFormatPopulator, self)._get_kwargs() | ||||
| diff --git a/tests/populator_test.py b/tests/populator_test.py
 | ||||
| index b6f70319..d9c326d7 100644
 | ||||
| --- a/tests/populator_test.py
 | ||||
| +++ b/tests/populator_test.py
 | ||||
| @@ -827,7 +827,6 @@ class HFSPopulatorTestCase(FormatPopulatorTestCase):
 | ||||
|  class DiskLabelPopulatorTestCase(PopulatorHelperTestCase): | ||||
|      helper_class = DiskLabelFormatPopulator | ||||
|   | ||||
| -    @patch("blivet.static_data.mpath_members.is_mpath_member", return_value=False)
 | ||||
|      @patch("blivet.udev.device_is_biosraid_member", return_value=False) | ||||
|      @patch("blivet.udev.device_get_format", return_value=None) | ||||
|      @patch("blivet.udev.device_get_disklabel_type", return_value="dos") | ||||
| @@ -836,7 +835,6 @@ def test_match(self, *args):
 | ||||
|          device_get_disklabel_type = args[0] | ||||
|          device_get_format = args[1] | ||||
|          device_is_biosraid_member = args[2] | ||||
| -        is_mpath_member = args[3]
 | ||||
|   | ||||
|          device = Mock() | ||||
|          device.is_disk = True | ||||
| @@ -861,9 +859,9 @@ def test_match(self, *args):
 | ||||
|          device_is_biosraid_member.return_value = False | ||||
|   | ||||
|          # no match for multipath members | ||||
| -        is_mpath_member.return_value = True
 | ||||
| +        device_get_format.return_value = "mpath_member"
 | ||||
|          self.assertFalse(self.helper_class.match(data, device)) | ||||
| -        is_mpath_member.return_value = False
 | ||||
| +        device_get_format.return_value = None
 | ||||
|   | ||||
|      @patch("blivet.static_data.mpath_members.is_mpath_member", return_value=False) | ||||
|      @patch("blivet.udev.device_is_biosraid_member", return_value=False) | ||||
| @ -1,45 +0,0 @@ | ||||
| From 5b0b1ffcf0d27306e52476984ebd8eb3af4a11aa Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Mon, 25 Feb 2019 11:14:30 -0500 | ||||
| Subject: [PATCH] Don't crash if blockdev mpath plugin isn't available. | ||||
|  (#1672971) | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/static_data/mpath_info.py | 7 +++++-- | ||||
|  1 file changed, 5 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/static_data/mpath_info.py b/blivet/static_data/mpath_info.py
 | ||||
| index b16f3c65..49ba4709 100644
 | ||||
| --- a/blivet/static_data/mpath_info.py
 | ||||
| +++ b/blivet/static_data/mpath_info.py
 | ||||
| @@ -27,6 +27,8 @@ from gi.repository import BlockDev as blockdev
 | ||||
|  import logging | ||||
|  log = logging.getLogger("blivet") | ||||
|   | ||||
| +from ..tasks import availability
 | ||||
| +
 | ||||
|   | ||||
|  class MpathMembers(object): | ||||
|      """A cache for querying multipath member devices""" | ||||
| @@ -40,7 +42,7 @@ class MpathMembers(object):
 | ||||
|          :param str device: path of the device to query | ||||
|   | ||||
|          """ | ||||
| -        if self._members is None:
 | ||||
| +        if self._members is None and availability.BLOCKDEV_MPATH_PLUGIN.available:
 | ||||
|              self._members = set(blockdev.mpath.get_mpath_members()) | ||||
|   | ||||
|          device = os.path.realpath(device) | ||||
| @@ -56,7 +58,8 @@ class MpathMembers(object):
 | ||||
|          """ | ||||
|          device = os.path.realpath(device) | ||||
|          device = device[len("/dev/"):] | ||||
| -        if blockdev.mpath.is_mpath_member(device):
 | ||||
| +
 | ||||
| +        if availability.BLOCKDEV_MPATH_PLUGIN.available and blockdev.mpath.is_mpath_member(device):
 | ||||
|              self._members.add(device) | ||||
|   | ||||
|      def drop_cache(self): | ||||
| -- 
 | ||||
| 2.17.2 | ||||
| 
 | ||||
| @ -1,31 +0,0 @@ | ||||
| From d01281a69e317d7bae4a7698edb6583b6310d5c1 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Tue, 19 Mar 2019 11:51:47 -0400 | ||||
| Subject: [PATCH] Ensure correct type of mpath cache member list. | ||||
| 
 | ||||
| Related: rhbz#1672971 | ||||
| ---
 | ||||
|  blivet/static_data/mpath_info.py | 7 +++++-- | ||||
|  1 file changed, 5 insertions(+), 2 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/static_data/mpath_info.py b/blivet/static_data/mpath_info.py
 | ||||
| index 49ba4709..64958ba8 100644
 | ||||
| --- a/blivet/static_data/mpath_info.py
 | ||||
| +++ b/blivet/static_data/mpath_info.py
 | ||||
| @@ -42,8 +42,11 @@ class MpathMembers(object):
 | ||||
|          :param str device: path of the device to query | ||||
|   | ||||
|          """ | ||||
| -        if self._members is None and availability.BLOCKDEV_MPATH_PLUGIN.available:
 | ||||
| -            self._members = set(blockdev.mpath.get_mpath_members())
 | ||||
| +        if self._members is None:
 | ||||
| +            if availability.BLOCKDEV_MPATH_PLUGIN.available:
 | ||||
| +                self._members = set(blockdev.mpath.get_mpath_members())
 | ||||
| +            else:
 | ||||
| +                self._members = set()
 | ||||
|   | ||||
|          device = os.path.realpath(device) | ||||
|          device = device[len("/dev/"):] | ||||
| -- 
 | ||||
| 2.20.1 | ||||
| 
 | ||||
| @ -1,122 +0,0 @@ | ||||
| From c495f74951caa0104636032e00704a83ab5f73b1 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Tue, 26 Mar 2019 12:58:53 +0100 | ||||
| Subject: [PATCH 1/3] Properly clean after availability test case | ||||
| 
 | ||||
| We need to set availability of the 'mkfs.hfsplus' utility back to | ||||
| it's real value after changing it to "always available" for this | ||||
| test case. | ||||
| ---
 | ||||
|  tests/devices_test/dependencies_test.py | 3 +++ | ||||
|  1 file changed, 3 insertions(+) | ||||
| 
 | ||||
| diff --git a/tests/devices_test/dependencies_test.py b/tests/devices_test/dependencies_test.py
 | ||||
| index 9dbdd24d..76bf758b 100644
 | ||||
| --- a/tests/devices_test/dependencies_test.py
 | ||||
| +++ b/tests/devices_test/dependencies_test.py
 | ||||
| @@ -69,6 +69,7 @@ class MockingDeviceDependenciesTestCase1(unittest.TestCase):
 | ||||
|   | ||||
|          self.mdraid_method = availability.BLOCKDEV_MDRAID_PLUGIN._method | ||||
|          self.dm_method = availability.BLOCKDEV_DM_PLUGIN._method | ||||
| +        self.hfsplus_method = availability.MKFS_HFSPLUS_APP._method
 | ||||
|          self.cache_availability = availability.CACHE_AVAILABILITY | ||||
|   | ||||
|          self.addCleanup(self._clean_up) | ||||
| @@ -105,10 +106,12 @@ class MockingDeviceDependenciesTestCase1(unittest.TestCase):
 | ||||
|      def _clean_up(self): | ||||
|          availability.BLOCKDEV_MDRAID_PLUGIN._method = self.mdraid_method | ||||
|          availability.BLOCKDEV_DM_PLUGIN._method = self.dm_method | ||||
| +        availability.MKFS_HFSPLUS_APP._method = self.hfsplus_method
 | ||||
|   | ||||
|          availability.CACHE_AVAILABILITY = False | ||||
|          availability.BLOCKDEV_MDRAID_PLUGIN.available  # pylint: disable=pointless-statement | ||||
|          availability.BLOCKDEV_DM_PLUGIN.available  # pylint: disable=pointless-statement | ||||
| +        availability.MKFS_HFSPLUS_APP.available  # pylint: disable=pointless-statement
 | ||||
|   | ||||
|          availability.CACHE_AVAILABILITY = self.cache_availability | ||||
|   | ||||
| -- 
 | ||||
| 2.20.1 | ||||
| 
 | ||||
| 
 | ||||
| From a6798882f5ba5b1e0ea655255d6f1fd5eda85f64 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Tue, 26 Mar 2019 13:00:40 +0100 | ||||
| Subject: [PATCH 2/3] Skip weak dependencies test if we don't have all | ||||
|  libblockdev plugins | ||||
| 
 | ||||
| This test checks that creating devices works when we have all | ||||
| plugins and fails "nicely" if we don't have all plugins so we | ||||
| actually need all the plugins for this test case. | ||||
| ---
 | ||||
|  tests/devices_test/dependencies_test.py | 5 +++++ | ||||
|  1 file changed, 5 insertions(+) | ||||
| 
 | ||||
| diff --git a/tests/devices_test/dependencies_test.py b/tests/devices_test/dependencies_test.py
 | ||||
| index 76bf758b..308d6192 100644
 | ||||
| --- a/tests/devices_test/dependencies_test.py
 | ||||
| +++ b/tests/devices_test/dependencies_test.py
 | ||||
| @@ -157,6 +157,11 @@ class MissingWeakDependenciesTestCase(unittest.TestCase):
 | ||||
|          self.disk1_file = create_sparse_tempfile("disk1", Size("2GiB")) | ||||
|          self.plugins = blockdev.plugin_specs_from_names(blockdev.get_available_plugin_names()) | ||||
|   | ||||
| +        loaded_plugins = self.load_all_plugins()
 | ||||
| +        if not all(p in loaded_plugins for p in ("btrfs", "crypto", "lvm", "md")):
 | ||||
| +            # we don't have all plugins needed for this test case
 | ||||
| +            self.skipTest("Missing libblockdev plugins needed from weak dependencies test.")
 | ||||
| +
 | ||||
|      def _clean_up(self): | ||||
|          # reload all libblockdev plugins | ||||
|          self.load_all_plugins() | ||||
| -- 
 | ||||
| 2.20.1 | ||||
| 
 | ||||
| 
 | ||||
| From 151fce2c9a98dc5a7943b314828518518a755ec8 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Tue, 26 Mar 2019 13:36:31 +0100 | ||||
| Subject: [PATCH 3/3] Check for format tools availability in action_test | ||||
| 
 | ||||
| ---
 | ||||
|  tests/action_test.py | 16 ++++++++++++++++ | ||||
|  1 file changed, 16 insertions(+) | ||||
| 
 | ||||
| diff --git a/tests/action_test.py b/tests/action_test.py
 | ||||
| index 93ed9e57..101d5a21 100644
 | ||||
| --- a/tests/action_test.py
 | ||||
| +++ b/tests/action_test.py
 | ||||
| @@ -19,6 +19,13 @@ from blivet.devices import MDRaidArrayDevice
 | ||||
|  from blivet.devices import LVMVolumeGroupDevice | ||||
|  from blivet.devices import LVMLogicalVolumeDevice | ||||
|   | ||||
| +# format classes
 | ||||
| +from blivet.formats.fs import Ext2FS
 | ||||
| +from blivet.formats.fs import Ext3FS
 | ||||
| +from blivet.formats.fs import Ext4FS
 | ||||
| +from blivet.formats.fs import FATFS
 | ||||
| +from blivet.formats.fs import XFS
 | ||||
| +
 | ||||
|  # action classes | ||||
|  from blivet.deviceaction import ActionCreateDevice | ||||
|  from blivet.deviceaction import ActionResizeDevice | ||||
| @@ -39,8 +46,17 @@ DEVICE_CLASSES = [
 | ||||
|      LVMLogicalVolumeDevice | ||||
|  ] | ||||
|   | ||||
| +FORMAT_CLASSES = [
 | ||||
| +    Ext2FS,
 | ||||
| +    Ext3FS,
 | ||||
| +    Ext4FS,
 | ||||
| +    FATFS,
 | ||||
| +    XFS
 | ||||
| +]
 | ||||
| +
 | ||||
|   | ||||
|  @unittest.skipUnless(not any(x.unavailable_type_dependencies() for x in DEVICE_CLASSES), "some unsupported device classes required for this test") | ||||
| +@unittest.skipUnless(not any(x().utils_available for x in FORMAT_CLASSES), "some unsupported format classes required for this test")
 | ||||
|  class DeviceActionTestCase(StorageTestCase): | ||||
|   | ||||
|      """ DeviceActionTestSuite """ | ||||
| -- 
 | ||||
| 2.20.1 | ||||
| 
 | ||||
| @ -1,110 +0,0 @@ | ||||
| From 545c41e6750d5e28743a7da9e43175302c4fa812 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Thu, 4 Apr 2019 13:52:54 -0400 | ||||
| Subject: [PATCH 1/4] Remove profanity from an old comment. | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/blivet.py | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/blivet.py b/blivet/blivet.py
 | ||||
| index 8128347f..ff4410ae 100644
 | ||||
| --- a/blivet/blivet.py
 | ||||
| +++ b/blivet/blivet.py
 | ||||
| @@ -875,7 +875,7 @@ def safe_device_name(self, name):
 | ||||
|   | ||||
|              LVM limits lv names to 128 characters. I don't know the limits for | ||||
|              the other various device types, so I'm going to pick a number so | ||||
| -            that we don't have to have an entire fucking library to determine
 | ||||
| +            that we don't have to have an entire library to determine
 | ||||
|              device name limits. | ||||
|          """ | ||||
|          max_len = 96    # No, you don't need longer names than this. Really. | ||||
| 
 | ||||
| From 7395fb481b7b7a5054a3ba12e07f40ba1c8d926a Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Mon, 22 Apr 2019 17:44:42 -0400 | ||||
| Subject: [PATCH 2/4] Add a target to create an archive of the unit tests. | ||||
| 
 | ||||
| ---
 | ||||
|  Makefile | 4 ++++ | ||||
|  1 file changed, 4 insertions(+) | ||||
| 
 | ||||
| diff --git a/Makefile b/Makefile
 | ||||
| index 76817278..f9b2066e 100644
 | ||||
| --- a/Makefile
 | ||||
| +++ b/Makefile
 | ||||
| @@ -120,6 +120,10 @@ archive: po-pull
 | ||||
|  	git checkout -- po/$(PKGNAME).pot | ||||
|  	@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz" | ||||
|   | ||||
| +tests-archive:
 | ||||
| +	git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(VERSION_TAG) tests/ | gzip -9 > $(PKGNAME)-$(VERSION)-tests.tar.gz
 | ||||
| +	@echo "The test archive is in $(PKGNAME)-$(VERSION)-tests.tar.gz"
 | ||||
| +
 | ||||
|  local: po-pull | ||||
|  	@make -B ChangeLog | ||||
|  	$(PYTHON) setup.py -q sdist --dist-dir . | ||||
| 
 | ||||
| From 28959739b46d22698c05f34494d2d9c67f37f0c4 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Mon, 22 Apr 2019 17:45:19 -0400 | ||||
| Subject: [PATCH 3/4] Add spec file logic to include unit tests in SRPM. | ||||
| 
 | ||||
| ---
 | ||||
|  python-blivet.spec | 4 +++- | ||||
|  1 file changed, 3 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/python-blivet.spec b/python-blivet.spec
 | ||||
| index 668e0913..23fa07f6 100644
 | ||||
| --- a/python-blivet.spec
 | ||||
| +++ b/python-blivet.spec
 | ||||
| @@ -29,6 +29,7 @@ License: LGPLv2+
 | ||||
|  %global realname blivet | ||||
|  %global realversion %{version}%{?prerelease} | ||||
|  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
 | ||||
|   | ||||
|  # Versions of required components (done so we make sure the buildrequires | ||||
|  # match the requires versions of things). | ||||
| @@ -165,7 +166,8 @@ configuration.
 | ||||
|  %endif | ||||
|   | ||||
|  %prep | ||||
| -%autosetup -n %{realname}-%{realversion} -p1
 | ||||
| +%autosetup -n %{realname}-%{realversion} -N
 | ||||
| +%autosetup -n %{realname}-%{realversion} -b1 -p1
 | ||||
|   | ||||
|  %build | ||||
|  %{?with_python2:make PYTHON=%{__python2}} | ||||
| 
 | ||||
| From 305c9b52ee5682baf53be660c501b7b263029699 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Fri, 26 Apr 2019 16:39:35 -0400 | ||||
| Subject: [PATCH 4/4] Include tests archive where appropriate in make targets. | ||||
| 
 | ||||
| ---
 | ||||
|  Makefile | 3 +++ | ||||
|  1 file changed, 3 insertions(+) | ||||
| 
 | ||||
| diff --git a/Makefile b/Makefile
 | ||||
| index f9b2066e..552550a6 100644
 | ||||
| --- a/Makefile
 | ||||
| +++ b/Makefile
 | ||||
| @@ -119,6 +119,7 @@ archive: po-pull
 | ||||
|  	rm -rf $(PKGNAME)-$(VERSION) | ||||
|  	git checkout -- po/$(PKGNAME).pot | ||||
|  	@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz" | ||||
| +	@make tests-archive
 | ||||
|   | ||||
|  tests-archive: | ||||
|  	git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(VERSION_TAG) tests/ | gzip -9 > $(PKGNAME)-$(VERSION)-tests.tar.gz | ||||
| @@ -128,6 +129,8 @@ local: po-pull
 | ||||
|  	@make -B ChangeLog | ||||
|  	$(PYTHON) setup.py -q sdist --dist-dir . | ||||
|  	@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz" | ||||
| +	git ls-files tests/ | tar -T- -czf $(PKGNAME)-$(VERSION)-tests.tar.gz
 | ||||
| +	@echo "The test archive is in $(PKGNAME)-$(VERSION)-tests.tar.gz"
 | ||||
|   | ||||
|  rpmlog: | ||||
|  	@git log --pretty="format:- %s (%ae)" $(RELEASE_TAG).. |sed -e 's/@.*)/)/' | ||||
| @ -1,47 +0,0 @@ | ||||
| From 6528bb0149720b336c9da7b57eaea048d693871c Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Wed, 20 Jun 2018 16:37:24 -0400 | ||||
| Subject: [PATCH] Deactivate incomplete VGs along with everything else. | ||||
| 
 | ||||
| (cherry picked from commit 39637796ca1aa2f03c89b5ec86ac246eecca1570) | ||||
| ---
 | ||||
|  blivet/devices/lvm.py | 18 ++++++++++++++---- | ||||
|  1 file changed, 14 insertions(+), 4 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
 | ||||
| index 0cb1a2ac..1e9da2a8 100644
 | ||||
| --- a/blivet/devices/lvm.py
 | ||||
| +++ b/blivet/devices/lvm.py
 | ||||
| @@ -216,15 +216,25 @@ class LVMVolumeGroupDevice(ContainerDevice):
 | ||||
|              if lv.status: | ||||
|                  return True | ||||
|   | ||||
| +        # special handling for incomplete VGs
 | ||||
| +        if not self.complete:
 | ||||
| +            try:
 | ||||
| +                lvs_info = blockdev.lvm.lvs(vg_name=self.name)
 | ||||
| +            except blockdev.LVMError:
 | ||||
| +                lvs_info = dict()
 | ||||
| +
 | ||||
| +            for lv_info in lvs_info.values():
 | ||||
| +                lv_attr = udev.device_get_lv_attr(lv_info)
 | ||||
| +                if lv_attr and lv_attr[4] == 'a':
 | ||||
| +                    return True
 | ||||
| +
 | ||||
| +            return False
 | ||||
| +
 | ||||
|          # if any of our PVs are not active then we cannot be | ||||
|          for pv in self.pvs: | ||||
|              if not pv.status: | ||||
|                  return False | ||||
|   | ||||
| -        # if we are missing some of our PVs we cannot be active
 | ||||
| -        if not self.complete:
 | ||||
| -            return False
 | ||||
| -
 | ||||
|          return True | ||||
|   | ||||
|      def _pre_setup(self, orig=False): | ||||
| -- 
 | ||||
| 2.20.1 | ||||
| 
 | ||||
| @ -1,31 +0,0 @@ | ||||
| From caec289d8220fc9a8d8b3d6e99271394f4ef83fe Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 27 Feb 2019 12:26:30 +0100 | ||||
| Subject: [PATCH] Automatically adjust size of growable devices for new format | ||||
| 
 | ||||
| Without this kickstart 'part /home --size=1 --grow --encrypted' | ||||
| will fail because min size for LUKS is 2 MiB. | ||||
| 
 | ||||
| Resolves: rhbz#1680013 | ||||
| ---
 | ||||
|  blivet/devices/storage.py | 7 ++++++- | ||||
|  1 file changed, 6 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
 | ||||
| index 904b60df..9d6001e8 100644
 | ||||
| --- a/blivet/devices/storage.py
 | ||||
| +++ b/blivet/devices/storage.py
 | ||||
| @@ -721,7 +721,12 @@ def _set_format(self, fmt):
 | ||||
|              if fmt.max_size and fmt.max_size < self.size: | ||||
|                  raise errors.DeviceError("device is too large for new format") | ||||
|              elif fmt.min_size and fmt.min_size > self.size: | ||||
| -                raise errors.DeviceError("device is too small for new format")
 | ||||
| +                if self.growable:
 | ||||
| +                    log.info("%s: using size %s instead of %s to accommodate "
 | ||||
| +                             "format minimum size", self.name, fmt.min_size, self.size)
 | ||||
| +                    self.size = fmt.min_size
 | ||||
| +                else:
 | ||||
| +                    raise errors.DeviceError("device is too small for new format")
 | ||||
|   | ||||
|          if self._format != fmt: | ||||
|              callbacks.format_removed(device=self, fmt=self._format) | ||||
| @ -1,54 +0,0 @@ | ||||
| From ac5646f8e9e59389bdc651c63b5e7dcd2d693bf4 Mon Sep 17 00:00:00 2001 | ||||
| From: Radek Vykydal <rvykydal@redhat.com> | ||||
| Date: Wed, 22 May 2019 13:35:01 +0200 | ||||
| Subject: [PATCH] Add flag for protecting cdrom devices during populate | ||||
| 
 | ||||
| Resolves: rhbz#1719648 | ||||
| ---
 | ||||
|  blivet/devices/optical.py | 14 ++++++++++++++ | ||||
|  blivet/flags.py           |  3 +++ | ||||
|  2 files changed, 17 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/devices/optical.py b/blivet/devices/optical.py
 | ||||
| index b9dba1f2..122825f2 100644
 | ||||
| --- a/blivet/devices/optical.py
 | ||||
| +++ b/blivet/devices/optical.py
 | ||||
| @@ -24,6 +24,7 @@
 | ||||
|  from .. import errors | ||||
|  from .. import util | ||||
|  from ..storage_log import log_method_call | ||||
| +from ..flags import flags
 | ||||
|   | ||||
|  import logging | ||||
|  log = logging.getLogger("blivet") | ||||
| @@ -81,3 +82,16 @@ def eject(self):
 | ||||
|              util.run_program(["eject", self.name]) | ||||
|          except OSError as e: | ||||
|              log.warning("error ejecting cdrom %s: %s", self.name, e) | ||||
| +
 | ||||
| +    @property
 | ||||
| +    def protected(self):
 | ||||
| +        protected = super(OpticalDevice, self).protected
 | ||||
| +
 | ||||
| +        if flags.protect_cdroms:
 | ||||
| +            return True
 | ||||
| +        else:
 | ||||
| +            return protected
 | ||||
| +
 | ||||
| +    @protected.setter
 | ||||
| +    def protected(self, value):
 | ||||
| +        self._protected = value
 | ||||
| diff --git a/blivet/flags.py b/blivet/flags.py
 | ||||
| index 6500be30..a6a78edc 100644
 | ||||
| --- a/blivet/flags.py
 | ||||
| +++ b/blivet/flags.py
 | ||||
| @@ -77,6 +77,9 @@ def __init__(self):
 | ||||
|          # (so far only for LUKS) | ||||
|          self.discard_new = False | ||||
|   | ||||
| +        # whether cdroms should be protected
 | ||||
| +        self.protect_cdroms = False
 | ||||
| +
 | ||||
|          self.boot_cmdline = {} | ||||
|   | ||||
|          self.update_from_boot_cmdline() | ||||
| @ -1,81 +0,0 @@ | ||||
| From 8124b804915d54e341e80bdd84e84eec3a54aaba Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Tue, 27 Nov 2018 13:37:49 -0500 | ||||
| Subject: [PATCH 1/2] Only update sysfs path in ctor for active devices. | ||||
| 
 | ||||
| Related: rhbz#1579375 | ||||
| ---
 | ||||
|  blivet/devices/storage.py | 2 +- | ||||
|  1 file changed, 1 insertion(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
 | ||||
| index 3cc29436..904b60df 100644
 | ||||
| --- a/blivet/devices/storage.py
 | ||||
| +++ b/blivet/devices/storage.py
 | ||||
| @@ -149,8 +149,8 @@ def __init__(self, name, fmt=None, uuid=None,
 | ||||
|          self.device_links = [] | ||||
|   | ||||
|          if self.exists: | ||||
| -            self.update_sysfs_path()
 | ||||
|              if self.status: | ||||
| +                self.update_sysfs_path()
 | ||||
|                  self.update_size() | ||||
|   | ||||
|      def __str__(self): | ||||
| 
 | ||||
| From 4cc31c735db820896278a7b91bb761df00becdb5 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Tue, 27 Nov 2018 14:03:40 -0500 | ||||
| Subject: [PATCH 2/2] Fix xfs sync of chrooted mountpoint. | ||||
| 
 | ||||
| Related: rhbz#1579375 | ||||
| ---
 | ||||
|  blivet/tasks/fssync.py | 22 ++++++++++++++++------ | ||||
|  1 file changed, 16 insertions(+), 6 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/tasks/fssync.py b/blivet/tasks/fssync.py
 | ||||
| index a15c8e1b..996fe782 100644
 | ||||
| --- a/blivet/tasks/fssync.py
 | ||||
| +++ b/blivet/tasks/fssync.py
 | ||||
| @@ -49,11 +49,21 @@ class XFSSync(FSSync):
 | ||||
|   | ||||
|      ext = availability.XFSFREEZE_APP | ||||
|   | ||||
| -    def _freeze_command(self):
 | ||||
| -        return [str(self.ext), "-f", self.fs.system_mountpoint]
 | ||||
| +    def _get_mountpoint(self, root=None):
 | ||||
| +        mountpoint = self.fs.system_mountpoint
 | ||||
| +        if root is not None and root.replace('/', ''):
 | ||||
| +            if mountpoint == root:
 | ||||
| +                mountpoint = '/'
 | ||||
| +            else:
 | ||||
| +                mountpoint = mountpoint[len(root):]
 | ||||
|   | ||||
| -    def _unfreeze_command(self):
 | ||||
| -        return [str(self.ext), "-u", self.fs.system_mountpoint]
 | ||||
| +        return mountpoint
 | ||||
| +
 | ||||
| +    def _freeze_command(self, root=None):
 | ||||
| +        return [str(self.ext), "-f", self._get_mountpoint(root=root)]
 | ||||
| +
 | ||||
| +    def _unfreeze_command(self, root=None):
 | ||||
| +        return [str(self.ext), "-u", self._get_mountpoint(root=root)]
 | ||||
|   | ||||
|      def do_task(self, root="/"): | ||||
|          # pylint: disable=arguments-differ | ||||
| @@ -63,13 +73,13 @@ def do_task(self, root="/"):
 | ||||
|   | ||||
|          error_msg = None | ||||
|          try: | ||||
| -            rc = util.run_program(self._freeze_command(), root=root)
 | ||||
| +            rc = util.run_program(self._freeze_command(root=root), root=root)
 | ||||
|          except OSError as e: | ||||
|              error_msg = "failed to sync filesytem: %s" % e | ||||
|          error_msg = error_msg or rc | ||||
|   | ||||
|          try: | ||||
| -            rc = util.run_program(self._unfreeze_command(), root=root)
 | ||||
| +            rc = util.run_program(self._unfreeze_command(root=root), root=root)
 | ||||
|          except OSError as e: | ||||
|              error_msg = error_msg or "failed to sync filesystem: %s" % e | ||||
|          error_msg = error_msg or rc | ||||
| @ -1,128 +0,0 @@ | ||||
| From 1d9dc59ab2c471d7dcc39cd6982bd14380d5f726 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Thu, 13 Jun 2019 11:22:16 -0400 | ||||
| Subject: [PATCH 1/3] Add a function to detect if running in a vm. | ||||
| 
 | ||||
| Related: rhbz#1676935 | ||||
| ---
 | ||||
|  blivet/util.py | 14 ++++++++++++++ | ||||
|  1 file changed, 14 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/util.py b/blivet/util.py
 | ||||
| index 542bc93f..fa5e9e35 100644
 | ||||
| --- a/blivet/util.py
 | ||||
| +++ b/blivet/util.py
 | ||||
| @@ -1,4 +1,5 @@
 | ||||
|  import copy | ||||
| +from distutils.spawn import find_executable
 | ||||
|  import functools | ||||
|  import glob | ||||
|  import itertools | ||||
| @@ -1100,3 +1101,16 @@ def decorated(*args, **kwargs):
 | ||||
|                      return None | ||||
|              return decorated | ||||
|          return decorator | ||||
| +
 | ||||
| +
 | ||||
| +def detect_virt():
 | ||||
| +    """ Return True if we are running in a virtual machine. """
 | ||||
| +    in_vm = False
 | ||||
| +    detect_virt_prog = find_executable('systemd-detect-virt')
 | ||||
| +    if detect_virt_prog:
 | ||||
| +        try:
 | ||||
| +            in_vm = run_program([detect_virt_prog, "--vm"]) == 0
 | ||||
| +        except OSError:
 | ||||
| +            pass
 | ||||
| +
 | ||||
| +    return in_vm
 | ||||
| 
 | ||||
| From 26d4b48ab5eca44695dced52c6170ec04610bc1d Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Thu, 13 Jun 2019 10:57:48 -0400 | ||||
| Subject: [PATCH 2/3] Use dasd disklabel for vm disks backed by dasds. | ||||
| 
 | ||||
| Resolves: rhbz#1676935 | ||||
| ---
 | ||||
|  blivet/formats/disklabel.py | 9 +++++++++ | ||||
|  1 file changed, 9 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
 | ||||
| index 8186d1a1..0c4fce35 100644
 | ||||
| --- a/blivet/formats/disklabel.py
 | ||||
| +++ b/blivet/formats/disklabel.py
 | ||||
| @@ -261,6 +261,15 @@ def _get_best_label_type(self):
 | ||||
|              elif self.parted_device.type == parted.DEVICE_DASD: | ||||
|                  # the device is DASD | ||||
|                  return "dasd" | ||||
| +            elif util.detect_virt():
 | ||||
| +                # check for dasds exported into qemu as normal virtio/scsi disks
 | ||||
| +                try:
 | ||||
| +                    _parted_disk = parted.Disk(device=self.parted_device)
 | ||||
| +                except (_ped.DiskLabelException, _ped.IOException, NotImplementedError):
 | ||||
| +                    pass
 | ||||
| +                else:
 | ||||
| +                    if _parted_disk.type == "dasd":
 | ||||
| +                        return "dasd"
 | ||||
|   | ||||
|          for lt in label_types: | ||||
|              if self._label_type_size_check(lt): | ||||
| 
 | ||||
| From c93d1207bb2942736a390bd58adafda3deb1c25c Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Thu, 13 Jun 2019 12:04:23 -0400 | ||||
| Subject: [PATCH 3/3] Use DBus call to see if we're in a vm. | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/util.py | 22 +++++++++++++--------- | ||||
|  1 file changed, 13 insertions(+), 9 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/util.py b/blivet/util.py
 | ||||
| index fa5e9e35..2932e8b5 100644
 | ||||
| --- a/blivet/util.py
 | ||||
| +++ b/blivet/util.py
 | ||||
| @@ -1,5 +1,4 @@
 | ||||
|  import copy | ||||
| -from distutils.spawn import find_executable
 | ||||
|  import functools | ||||
|  import glob | ||||
|  import itertools | ||||
| @@ -20,6 +19,7 @@
 | ||||
|  from enum import Enum | ||||
|   | ||||
|  from .errors import DependencyError | ||||
| +from . import safe_dbus
 | ||||
|   | ||||
|  import gi | ||||
|  gi.require_version("BlockDev", "2.0") | ||||
| @@ -39,6 +39,12 @@
 | ||||
|  program_log_lock = Lock() | ||||
|   | ||||
|   | ||||
| +SYSTEMD_SERVICE = "org.freedesktop.systemd1"
 | ||||
| +SYSTEMD_MANAGER_PATH = "/org/freedesktop/systemd1/Manager"
 | ||||
| +SYSTEMD_MANAGER_IFACE = "org.freedesktop.systemd1.Manager"
 | ||||
| +VIRT_PROP_NAME = "Virtualization"
 | ||||
| +
 | ||||
| +
 | ||||
|  class Path(str): | ||||
|   | ||||
|      """ Path(path, root=None) provides a filesystem path object, which | ||||
| @@ -1105,12 +1111,10 @@ def decorated(*args, **kwargs):
 | ||||
|   | ||||
|  def detect_virt(): | ||||
|      """ Return True if we are running in a virtual machine. """ | ||||
| -    in_vm = False
 | ||||
| -    detect_virt_prog = find_executable('systemd-detect-virt')
 | ||||
| -    if detect_virt_prog:
 | ||||
| -        try:
 | ||||
| -            in_vm = run_program([detect_virt_prog, "--vm"]) == 0
 | ||||
| -        except OSError:
 | ||||
| -            pass
 | ||||
| +    try:
 | ||||
| +        vm = safe_dbus.get_property_sync(SYSTEMD_SERVICE, SYSTEMD_MANAGER_PATH,
 | ||||
| +                                         SYSTEMD_MANAGER_IFACE, VIRT_PROP_NAME)
 | ||||
| +    except (safe_dbus.DBusCallError, safe_dbus.DBusPropertyError):
 | ||||
| +        vm = None
 | ||||
|   | ||||
| -    return in_vm
 | ||||
| +    return vm in ('qemu', 'kvm')
 | ||||
| @ -1,30 +0,0 @@ | ||||
| From 5097a0f3fba2960fc77cfd6ceb828287f60c930c Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Thu, 6 Dec 2018 10:32:58 +0100 | ||||
| Subject: [PATCH] Fix reading LV attributes in LVMVolumeGroupDevice.status | ||||
| 
 | ||||
| This was not adjusted to libblockdev API when cherry-picking fixes | ||||
| from rhel7-branch in 3c8f8dbf78b0a093e120f69241b44a48ff07be30 | ||||
| ---
 | ||||
|  blivet/devices/lvm.py | 7 +++---- | ||||
|  1 file changed, 3 insertions(+), 4 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
 | ||||
| index 7835b7e8..8c4ee2ba 100644
 | ||||
| --- a/blivet/devices/lvm.py
 | ||||
| +++ b/blivet/devices/lvm.py
 | ||||
| @@ -222,11 +222,10 @@ def status(self):
 | ||||
|              try: | ||||
|                  lvs_info = blockdev.lvm.lvs(vg_name=self.name) | ||||
|              except blockdev.LVMError: | ||||
| -                lvs_info = dict()
 | ||||
| +                lvs_info = []
 | ||||
|   | ||||
| -            for lv_info in lvs_info.values():
 | ||||
| -                lv_attr = udev.device_get_lv_attr(lv_info)
 | ||||
| -                if lv_attr and lv_attr[4] == 'a':
 | ||||
| +            for lv_info in lvs_info:
 | ||||
| +                if lv_info.attr and lv_info.attr[4] == 'a':
 | ||||
|                      return True | ||||
|   | ||||
|              return False | ||||
| @ -1,65 +0,0 @@ | ||||
| From 5f7dbb212b4d6da4f8f2609ae1415e8630d031cd Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Mon, 13 May 2019 12:49:52 +0200 | ||||
| Subject: [PATCH] Correctly handle non-unicode iSCSI initiator names | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/iscsi.py |  4 +++- | ||||
|  blivet/udev.py  | 20 +++++++++++--------- | ||||
|  2 files changed, 14 insertions(+), 10 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/iscsi.py b/blivet/iscsi.py
 | ||||
| index 74432505..f612cf15 100644
 | ||||
| --- a/blivet/iscsi.py
 | ||||
| +++ b/blivet/iscsi.py
 | ||||
| @@ -206,7 +206,9 @@ def initiator(self):
 | ||||
|          if self._initiator != "": | ||||
|              return self._initiator | ||||
|   | ||||
| -        return self._call_initiator_method("GetInitiatorName")[0]
 | ||||
| +        # udisks returns initiatorname as a NULL terminated bytearray
 | ||||
| +        raw_initiator = bytes(self._call_initiator_method("GetInitiatorNameRaw")[0][:-1])
 | ||||
| +        return raw_initiator.decode("utf-8", errors="replace")
 | ||||
|   | ||||
|      @initiator.setter | ||||
|      @storaged_iscsi_required(critical=True, eval_mode=util.EvalMode.onetime) | ||||
| diff --git a/blivet/udev.py b/blivet/udev.py
 | ||||
| index 51b69b76..a70e3e08 100644
 | ||||
| --- a/blivet/udev.py
 | ||||
| +++ b/blivet/udev.py
 | ||||
| @@ -836,24 +836,26 @@ def device_get_iscsi_nic(info):
 | ||||
|   | ||||
|   | ||||
|  def device_get_iscsi_initiator(info): | ||||
| -    initiator = None
 | ||||
| +    initiator_name = None
 | ||||
|      if device_is_partoff_iscsi(info): | ||||
|          host = re.match(r'.*/(host\d+)', device_get_sysfs_path(info)).groups()[0] | ||||
|          if host: | ||||
|              initiator_file = "/sys/class/iscsi_host/%s/initiatorname" % host | ||||
|              if os.access(initiator_file, os.R_OK): | ||||
| -                initiator = open(initiator_file).read().strip()
 | ||||
| +                initiator = open(initiator_file, "rb").read().strip()
 | ||||
| +                initiator_name = initiator.decode("utf-8", errors="replace")
 | ||||
|                  log.debug("found offload iscsi initiatorname %s in file %s", | ||||
| -                          initiator, initiator_file)
 | ||||
| -                if initiator.lstrip("(").rstrip(")").lower() == "null":
 | ||||
| -                    initiator = None
 | ||||
| -    if initiator is None:
 | ||||
| +                          initiator_name, initiator_file)
 | ||||
| +                if initiator_name.lstrip("(").rstrip(")").lower() == "null":
 | ||||
| +                    initiator_name = None
 | ||||
| +    if initiator_name is None:
 | ||||
|          session = device_get_iscsi_session(info) | ||||
|          if session: | ||||
|              initiator = open("/sys/class/iscsi_session/%s/initiatorname" % | ||||
| -                             session).read().strip()
 | ||||
| -            log.debug("found iscsi initiatorname %s", initiator)
 | ||||
| -    return initiator
 | ||||
| +                             session, "rb").read().strip()
 | ||||
| +            initiator_name = initiator.decode("utf-8", errors="replace")
 | ||||
| +            log.debug("found iscsi initiatorname %s", initiator_name)
 | ||||
| +    return initiator_name
 | ||||
|   | ||||
|   | ||||
|  # fcoe disks have ID_PATH in the form of: | ||||
| @ -1,27 +0,0 @@ | ||||
| From 408da7ad8eaedf9edb8dfa240af35a222fa8b481 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Mon, 11 Mar 2019 13:29:04 +0100 | ||||
| Subject: [PATCH] Do not crash if 'dm.get_member_raid_sets' fails (#1684851) | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/populator/helpers/dmraid.py | 7 ++++++- | ||||
|  1 file changed, 6 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/populator/helpers/dmraid.py b/blivet/populator/helpers/dmraid.py
 | ||||
| index c8cc3a8e..ed48bd66 100644
 | ||||
| --- a/blivet/populator/helpers/dmraid.py
 | ||||
| +++ b/blivet/populator/helpers/dmraid.py
 | ||||
| @@ -53,7 +53,12 @@ def run(self):
 | ||||
|          minor = udev.device_get_minor(self.data) | ||||
|   | ||||
|          # Have we already created the DMRaidArrayDevice? | ||||
| -        rs_names = blockdev.dm.get_member_raid_sets(name, uuid, major, minor)
 | ||||
| +        try:
 | ||||
| +            rs_names = blockdev.dm.get_member_raid_sets(name, uuid, major, minor)
 | ||||
| +        except blockdev.DMError as e:
 | ||||
| +            log.error("Failed to get RAID sets information for '%s': %s", name, str(e))
 | ||||
| +            return
 | ||||
| +
 | ||||
|          if len(rs_names) == 0: | ||||
|              log.warning("dmraid member %s does not appear to belong to any " | ||||
|                          "array", self.device.name) | ||||
| @ -1,166 +0,0 @@ | ||||
| From c667dbb3ebf05eafeb4fb55d3ffa22d27c25420c Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Wed, 24 Oct 2018 20:12:20 -0400 | ||||
| Subject: [PATCH 1/3] Don't try to update sysfs path for non-block devices. | ||||
|  (#1579375) | ||||
| 
 | ||||
| ---
 | ||||
|  blivet/devices/file.py  | 3 +++ | ||||
|  blivet/devices/nfs.py   | 3 +++ | ||||
|  blivet/devices/nodev.py | 3 +++ | ||||
|  3 files changed, 9 insertions(+) | ||||
| 
 | ||||
| diff --git a/blivet/devices/file.py b/blivet/devices/file.py
 | ||||
| index 55522c1d..fa3dfb8a 100644
 | ||||
| --- a/blivet/devices/file.py
 | ||||
| +++ b/blivet/devices/file.py
 | ||||
| @@ -132,6 +132,9 @@ def is_name_valid(self, name):
 | ||||
|          # Override StorageDevice.is_name_valid to allow / | ||||
|          return not('\x00' in name or name == '.' or name == '..') | ||||
|   | ||||
| +    def update_sysfs_path(self):
 | ||||
| +        pass
 | ||||
| +
 | ||||
|   | ||||
|  class SparseFileDevice(FileDevice): | ||||
|   | ||||
| diff --git a/blivet/devices/nfs.py b/blivet/devices/nfs.py
 | ||||
| index 97cbe01e..a0142f91 100644
 | ||||
| --- a/blivet/devices/nfs.py
 | ||||
| +++ b/blivet/devices/nfs.py
 | ||||
| @@ -77,3 +77,6 @@ def update_size(self, newsize=None):
 | ||||
|      def is_name_valid(self, name): | ||||
|          # Override StorageDevice.is_name_valid to allow / | ||||
|          return not('\x00' in name or name == '.' or name == '..') | ||||
| +
 | ||||
| +    def update_sysfs_path(self):
 | ||||
| +        pass
 | ||||
| diff --git a/blivet/devices/nodev.py b/blivet/devices/nodev.py
 | ||||
| index f6129258..f1b87392 100644
 | ||||
| --- a/blivet/devices/nodev.py
 | ||||
| +++ b/blivet/devices/nodev.py
 | ||||
| @@ -75,6 +75,9 @@ def destroy(self):
 | ||||
|      def update_size(self, newsize=None): | ||||
|          pass | ||||
|   | ||||
| +    def update_sysfs_path(self):
 | ||||
| +        pass
 | ||||
| +
 | ||||
|   | ||||
|  class TmpFSDevice(NoDevice): | ||||
|   | ||||
| 
 | ||||
| From acb0953ad89327b3ffd3571b6d45565762548203 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Wed, 24 Oct 2018 20:27:22 -0400 | ||||
| Subject: [PATCH 2/3] Only try to set selinux context for lost+found on ext | ||||
|  file systems. | ||||
| 
 | ||||
| Related: rhbz#1579375 | ||||
| ---
 | ||||
|  blivet/formats/fs.py               | 19 ++++++++++++++----- | ||||
|  tests/formats_test/selinux_test.py |  5 ++++- | ||||
|  2 files changed, 18 insertions(+), 6 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
 | ||||
| index 81e367f4..b915a2de 100644
 | ||||
| --- a/blivet/formats/fs.py
 | ||||
| +++ b/blivet/formats/fs.py
 | ||||
| @@ -569,11 +569,6 @@ def _post_setup(self, **kwargs):
 | ||||
|              ret = util.reset_file_context(mountpoint, chroot) | ||||
|              if not ret: | ||||
|                  log.warning("Failed to reset SElinux context for newly mounted filesystem root directory to default.") | ||||
| -            lost_and_found_context = util.match_path_context("/lost+found")
 | ||||
| -            lost_and_found_path = os.path.join(mountpoint, "lost+found")
 | ||||
| -            ret = util.set_file_context(lost_and_found_path, lost_and_found_context, chroot)
 | ||||
| -            if not ret:
 | ||||
| -                log.warning("Failed to set SELinux context for newly mounted filesystem lost+found directory at %s to %s", lost_and_found_path, lost_and_found_context)
 | ||||
|   | ||||
|      def _pre_teardown(self, **kwargs): | ||||
|          if not super(FS, self)._pre_teardown(**kwargs): | ||||
| @@ -840,6 +835,20 @@ class Ext2FS(FS):
 | ||||
|      parted_system = fileSystemType["ext2"] | ||||
|      _metadata_size_factor = 0.93  # ext2 metadata may take 7% of space | ||||
|   | ||||
| +    def _post_setup(self, **kwargs):
 | ||||
| +        super(Ext2FS, self)._post_setup(**kwargs)
 | ||||
| +
 | ||||
| +        options = kwargs.get("options", "")
 | ||||
| +        chroot = kwargs.get("chroot", "/")
 | ||||
| +        mountpoint = kwargs.get("mountpoint") or self.mountpoint
 | ||||
| +
 | ||||
| +        if flags.selinux and "ro" not in self._mount.mount_options(options).split(",") and flags.selinux_reset_fcon:
 | ||||
| +            lost_and_found_context = util.match_path_context("/lost+found")
 | ||||
| +            lost_and_found_path = os.path.join(mountpoint, "lost+found")
 | ||||
| +            ret = util.set_file_context(lost_and_found_path, lost_and_found_context, chroot)
 | ||||
| +            if not ret:
 | ||||
| +                log.warning("Failed to set SELinux context for newly mounted filesystem lost+found directory at %s to %s", lost_and_found_path, lost_and_found_context)
 | ||||
| +
 | ||||
|  register_device_format(Ext2FS) | ||||
|   | ||||
|   | ||||
| diff --git a/tests/formats_test/selinux_test.py b/tests/formats_test/selinux_test.py
 | ||||
| index 79c10327..028e084e 100644
 | ||||
| --- a/tests/formats_test/selinux_test.py
 | ||||
| +++ b/tests/formats_test/selinux_test.py
 | ||||
| @@ -43,7 +43,10 @@ def exec_mount_selinux_format(self, formt, *args):
 | ||||
|   | ||||
|              blivet.flags.flags.selinux_reset_fcon = True | ||||
|              fmt.setup(mountpoint="dummy")  # param needed to pass string check | ||||
| -            lsetfilecon.assert_called_with(ANY, lost_found_context)
 | ||||
| +            if isinstance(fmt, fs.Ext2FS):
 | ||||
| +                lsetfilecon.assert_called_with(ANY, lost_found_context)
 | ||||
| +            else:
 | ||||
| +                lsetfilecon.assert_not_called()
 | ||||
|   | ||||
|              lsetfilecon.reset_mock() | ||||
|   | ||||
| 
 | ||||
| From 1b4e658f098bda3161ff0d5ffee07ea9be5c1d15 Mon Sep 17 00:00:00 2001 | ||||
| From: David Lehman <dlehman@redhat.com> | ||||
| Date: Wed, 24 Oct 2018 20:33:36 -0400 | ||||
| Subject: [PATCH 3/3] Don't try to set selinux context for nodev or vfat file | ||||
|  systems. | ||||
| 
 | ||||
| Related: rhbz#1579375 | ||||
| ---
 | ||||
|  blivet/formats/fs.py | 5 ++++- | ||||
|  1 file changed, 4 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py
 | ||||
| index b915a2de..6f09eaff 100644
 | ||||
| --- a/blivet/formats/fs.py
 | ||||
| +++ b/blivet/formats/fs.py
 | ||||
| @@ -76,6 +76,7 @@ class FS(DeviceFormat):
 | ||||
|      _sync_class = fssync.UnimplementedFSSync | ||||
|      _writelabel_class = fswritelabel.UnimplementedFSWriteLabel | ||||
|      _writeuuid_class = fswriteuuid.UnimplementedFSWriteUUID | ||||
| +    _selinux_supported = True
 | ||||
|      # This constant is aquired by testing some filesystems | ||||
|      # and it's giving us percentage of space left after the format. | ||||
|      # This number is more guess than precise number because this | ||||
| @@ -565,7 +566,7 @@ def _post_setup(self, **kwargs):
 | ||||
|          chroot = kwargs.get("chroot", "/") | ||||
|          mountpoint = kwargs.get("mountpoint") or self.mountpoint | ||||
|   | ||||
| -        if flags.selinux and "ro" not in self._mount.mount_options(options).split(",") and flags.selinux_reset_fcon:
 | ||||
| +        if self._selinux_supported and flags.selinux and "ro" not in self._mount.mount_options(options).split(",") and flags.selinux_reset_fcon:
 | ||||
|              ret = util.reset_file_context(mountpoint, chroot) | ||||
|              if not ret: | ||||
|                  log.warning("Failed to reset SElinux context for newly mounted filesystem root directory to default.") | ||||
| @@ -902,6 +903,7 @@ class FATFS(FS):
 | ||||
|      _metadata_size_factor = 0.99  # fat metadata may take 1% of space | ||||
|      # FIXME this should be fat32 in some cases | ||||
|      parted_system = fileSystemType["fat16"] | ||||
| +    _selinux_supported = False
 | ||||
|   | ||||
|      def generate_new_uuid(self): | ||||
|          ret = "" | ||||
| @@ -1235,6 +1237,7 @@ class NoDevFS(FS):
 | ||||
|      """ nodev filesystem base class """ | ||||
|      _type = "nodev" | ||||
|      _mount_class = fsmount.NoDevFSMount | ||||
| +    _selinux_supported = False
 | ||||
|   | ||||
|      def __init__(self, **kwargs): | ||||
|          FS.__init__(self, **kwargs) | ||||
| @ -1,91 +0,0 @@ | ||||
| From 471d43cbfe99db1c8246fb863e3ce49b3403fc61 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Wed, 11 Sep 2019 10:48:19 +0200 | ||||
| Subject: [PATCH] Fix util.detect_virt function | ||||
| 
 | ||||
| Fixed the systemd Manager object path, also get_property_sync | ||||
| returns a tuple so we need to check its first element. | ||||
| 
 | ||||
| Resolves: rhbz#1676935 | ||||
| ---
 | ||||
|  blivet/util.py                       |  8 ++++---- | ||||
|  tests/formats_test/disklabel_test.py | 26 ++++++++++++++------------ | ||||
|  tests/util_test.py                   |  4 ++++ | ||||
|  3 files changed, 22 insertions(+), 16 deletions(-) | ||||
| 
 | ||||
| diff --git a/blivet/util.py b/blivet/util.py
 | ||||
| index 2932e8b5..27468992 100644
 | ||||
| --- a/blivet/util.py
 | ||||
| +++ b/blivet/util.py
 | ||||
| @@ -40,7 +40,7 @@ program_log_lock = Lock()
 | ||||
|   | ||||
|   | ||||
|  SYSTEMD_SERVICE = "org.freedesktop.systemd1" | ||||
| -SYSTEMD_MANAGER_PATH = "/org/freedesktop/systemd1/Manager"
 | ||||
| +SYSTEMD_MANAGER_PATH = "/org/freedesktop/systemd1"
 | ||||
|  SYSTEMD_MANAGER_IFACE = "org.freedesktop.systemd1.Manager" | ||||
|  VIRT_PROP_NAME = "Virtualization" | ||||
|   | ||||
| @@ -1115,6 +1115,6 @@ def detect_virt():
 | ||||
|          vm = safe_dbus.get_property_sync(SYSTEMD_SERVICE, SYSTEMD_MANAGER_PATH, | ||||
|                                           SYSTEMD_MANAGER_IFACE, VIRT_PROP_NAME) | ||||
|      except (safe_dbus.DBusCallError, safe_dbus.DBusPropertyError): | ||||
| -        vm = None
 | ||||
| -
 | ||||
| -    return vm in ('qemu', 'kvm')
 | ||||
| +        return False
 | ||||
| +    else:
 | ||||
| +        return vm[0] in ('qemu', 'kvm')
 | ||||
| diff --git a/tests/formats_test/disklabel_test.py b/tests/formats_test/disklabel_test.py
 | ||||
| index 4b105da6..94f3775f 100644
 | ||||
| --- a/tests/formats_test/disklabel_test.py
 | ||||
| +++ b/tests/formats_test/disklabel_test.py
 | ||||
| @@ -163,16 +163,18 @@ class DiskLabelTestCase(unittest.TestCase):
 | ||||
|          arch.is_efi.return_value = False | ||||
|   | ||||
|          arch.is_s390.return_value = True | ||||
| -        with mock.patch.object(dl, '_label_type_size_check') as size_check:
 | ||||
| -            size_check.return_value = True
 | ||||
| -            with mock.patch("blivet.formats.disklabel.blockdev.s390") as _s390:
 | ||||
| -                _s390.dasd_is_fba.return_value = False
 | ||||
| -                self.assertEqual(dl._get_best_label_type(), "msdos")
 | ||||
| -
 | ||||
| -                _s390.dasd_is_fba.return_value = True
 | ||||
| -                self.assertEqual(dl._get_best_label_type(), "msdos")
 | ||||
| -
 | ||||
| -                _s390.dasd_is_fba.return_value = False
 | ||||
| -                dl._parted_device.type = parted.DEVICE_DASD
 | ||||
| -                self.assertEqual(dl._get_best_label_type(), "dasd")
 | ||||
| +        with mock.patch('blivet.util.detect_virt') as virt:
 | ||||
| +            virt.return_value = False
 | ||||
| +            with mock.patch.object(dl, '_label_type_size_check') as size_check:
 | ||||
| +                size_check.return_value = True
 | ||||
| +                with mock.patch("blivet.formats.disklabel.blockdev.s390") as _s390:
 | ||||
| +                    _s390.dasd_is_fba.return_value = False
 | ||||
| +                    self.assertEqual(dl._get_best_label_type(), "msdos")
 | ||||
| +
 | ||||
| +                    _s390.dasd_is_fba.return_value = True
 | ||||
| +                    self.assertEqual(dl._get_best_label_type(), "msdos")
 | ||||
| +
 | ||||
| +                    _s390.dasd_is_fba.return_value = False
 | ||||
| +                    dl._parted_device.type = parted.DEVICE_DASD
 | ||||
| +                    self.assertEqual(dl._get_best_label_type(), "dasd")
 | ||||
|          arch.is_s390.return_value = False | ||||
| diff --git a/tests/util_test.py b/tests/util_test.py
 | ||||
| index 5fa3070e..9a2ff492 100644
 | ||||
| --- a/tests/util_test.py
 | ||||
| +++ b/tests/util_test.py
 | ||||
| @@ -37,6 +37,10 @@ class MiscTest(unittest.TestCase):
 | ||||
|          # real deduplication | ||||
|          self.assertEqual([1, 2, 3, 4, 5, 6], util.dedup_list([1, 2, 3, 4, 2, 2, 2, 1, 3, 5, 3, 6, 6, 2, 3, 1, 5])) | ||||
|   | ||||
| +    def test_detect_virt(self):
 | ||||
| +        in_virt = not util.run_program(["systemd-detect-virt", "--vm"])
 | ||||
| +        self.assertEqual(util.detect_virt(), in_virt)
 | ||||
| +
 | ||||
|   | ||||
|  class TestDefaultNamedtuple(unittest.TestCase): | ||||
|      def test_default_namedtuple(self): | ||||
| -- 
 | ||||
| 2.20.1 | ||||
| 
 | ||||
| @ -1,183 +0,0 @@ | ||||
| From 83a42f3e232c7c4a02deb3539972c82b6dca284b Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Fri, 4 Oct 2019 12:30:03 +0200 | ||||
| Subject: [PATCH 1/2] Add a new "sector_size" property to storage devices. | ||||
| 
 | ||||
| This represents the logical sector size of the device. | ||||
| 
 | ||||
| Related: rhbz#1754446 | ||||
| ---
 | ||||
|  blivet/devices/disk.py      |  6 +++++- | ||||
|  blivet/devices/md.py        | 11 +++++++++++ | ||||
|  blivet/devices/partition.py |  7 +++++++ | ||||
|  blivet/devices/storage.py   | 15 +++++++++++++++ | ||||
|  4 files changed, 38 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/disk.py b/blivet/devices/disk.py
 | ||||
| index bf2f7a4f..7dfeabf0 100644
 | ||||
| --- a/blivet/devices/disk.py
 | ||||
| +++ b/blivet/devices/disk.py
 | ||||
| @@ -687,7 +687,7 @@ def __init__(self, device, **kwargs):
 | ||||
|          """ | ||||
|          self.mode = kwargs.pop("mode") | ||||
|          self.devname = kwargs.pop("devname") | ||||
| -        self.sector_size = kwargs.pop("sector_size")
 | ||||
| +        self._sector_size = kwargs.pop("sector_size")
 | ||||
|   | ||||
|          DiskDevice.__init__(self, device, **kwargs) | ||||
|   | ||||
| @@ -710,3 +710,7 @@ def description(self):
 | ||||
|                 % {'devname': self.devname, | ||||
|                    'mode': self.mode, | ||||
|                    'path': self.path} | ||||
| +
 | ||||
| +    @property
 | ||||
| +    def sector_size(self):
 | ||||
| +        return self._sector_size
 | ||||
| diff --git a/blivet/devices/md.py b/blivet/devices/md.py
 | ||||
| index 6a837df0..0b6da980 100644
 | ||||
| --- a/blivet/devices/md.py
 | ||||
| +++ b/blivet/devices/md.py
 | ||||
| @@ -19,10 +19,13 @@
 | ||||
|  # Red Hat Author(s): David Lehman <dlehman@redhat.com> | ||||
|  # | ||||
|   | ||||
| +import math
 | ||||
|  import os | ||||
|  import six | ||||
|  import time | ||||
|   | ||||
| +from six.moves import reduce
 | ||||
| +
 | ||||
|  import gi | ||||
|  gi.require_version("BlockDev", "2.0") | ||||
|   | ||||
| @@ -195,6 +198,14 @@ def level(self, value):
 | ||||
|   | ||||
|          self._level = level | ||||
|   | ||||
| +    @property
 | ||||
| +    def sector_size(self):
 | ||||
| +        if not self.exists:
 | ||||
| +            # Least common multiple of parents' sector sizes
 | ||||
| +            return reduce(lambda a, b: a * b // math.gcd(a, b), (int(p.sector_size) for p in self.parents))
 | ||||
| +
 | ||||
| +        return super(MDRaidArrayDevice, self).sector_size
 | ||||
| +
 | ||||
|      @property | ||||
|      def chunk_size(self): | ||||
|          if self.exists and self._chunk_size == Size(0): | ||||
| diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
 | ||||
| index 623e1c9d..73daa76f 100644
 | ||||
| --- a/blivet/devices/partition.py
 | ||||
| +++ b/blivet/devices/partition.py
 | ||||
| @@ -729,6 +729,13 @@ def protected(self):
 | ||||
|      def protected(self, value): | ||||
|          self._protected = value | ||||
|   | ||||
| +    @property
 | ||||
| +    def sector_size(self):
 | ||||
| +        if self.disk:
 | ||||
| +            return self.disk.sector_size
 | ||||
| +
 | ||||
| +        return super(PartitionDevice, self).sector_size
 | ||||
| +
 | ||||
|      def _pre_resize(self): | ||||
|          if not self.exists: | ||||
|              raise errors.DeviceError("device has not been created", self.name) | ||||
| diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
 | ||||
| index e087fa64..91c5e60e 100644
 | ||||
| --- a/blivet/devices/storage.py
 | ||||
| +++ b/blivet/devices/storage.py
 | ||||
| @@ -190,6 +190,21 @@ def raw_device(self):
 | ||||
|          """ The device itself, or when encrypted, the backing device. """ | ||||
|          return self | ||||
|   | ||||
| +    @property
 | ||||
| +    def sector_size(self):
 | ||||
| +        """ Logical sector (block) size of this device """
 | ||||
| +        if not self.exists:
 | ||||
| +            if self.parents:
 | ||||
| +                return self.parents[0].sector_size
 | ||||
| +            else:
 | ||||
| +                return LINUX_SECTOR_SIZE
 | ||||
| +
 | ||||
| +        block_size = util.get_sysfs_attr(self.sysfs_path, "queue/logical_block_size")
 | ||||
| +        if block_size:
 | ||||
| +            return int(block_size)
 | ||||
| +        else:
 | ||||
| +            return LINUX_SECTOR_SIZE
 | ||||
| +
 | ||||
|      @property | ||||
|      def controllable(self): | ||||
|          return self._controllable and not flags.testing and not self.unavailable_type_dependencies() | ||||
| 
 | ||||
| From 9f81bd1ffb877862760223ba88f2086deebd2d06 Mon Sep 17 00:00:00 2001 | ||||
| From: Vojtech Trefny <vtrefny@redhat.com> | ||||
| Date: Fri, 4 Oct 2019 12:37:01 +0200 | ||||
| Subject: [PATCH 2/2] Do not allow creating VGs with PVs with different sector | ||||
|  size | ||||
| 
 | ||||
| New versions of LVM don't allow mixing PVs with different sector | ||||
| sizes in one VG. | ||||
| 
 | ||||
| Resolves: rhbz#1754446 | ||||
| ---
 | ||||
|  blivet/devices/lvm.py          | 12 ++++++++++++ | ||||
|  tests/devices_test/lvm_test.py | 13 ++++++++++++- | ||||
|  2 files changed, 24 insertions(+), 1 deletion(-) | ||||
| 
 | ||||
| diff --git a/blivet/devices/lvm.py b/blivet/devices/lvm.py
 | ||||
| index 4347f483..b9da286a 100644
 | ||||
| --- a/blivet/devices/lvm.py
 | ||||
| +++ b/blivet/devices/lvm.py
 | ||||
| @@ -356,6 +356,18 @@ def _remove_log_vol(self, lv):
 | ||||
|      def _add_parent(self, parent): | ||||
|          super(LVMVolumeGroupDevice, self)._add_parent(parent) | ||||
|   | ||||
| +        # we are creating new VG or adding a new PV to an existing (complete) one
 | ||||
| +        if not self.exists or (self.exists and self._complete):
 | ||||
| +            parent_sectors = set([p.sector_size for p in self.pvs] + [parent.sector_size])
 | ||||
| +            if len(parent_sectors) != 1:
 | ||||
| +                if not self.exists:
 | ||||
| +                    msg = "The volume group %s cannot be created. Selected disks have " \
 | ||||
| +                          "inconsistent sector sizes (%s)." % (self.name, parent_sectors)
 | ||||
| +                else:
 | ||||
| +                    msg = "Disk %s cannot be added to this volume group. LVM doesn't " \
 | ||||
| +                          "allow using physical volumes with inconsistent (logical) sector sizes." % parent.name
 | ||||
| +                raise ValueError(msg)
 | ||||
| +
 | ||||
|          if (self.exists and parent.format.exists and | ||||
|                  len(self.parents) + 1 == self.pv_count): | ||||
|              self._complete = True | ||||
| diff --git a/tests/devices_test/lvm_test.py b/tests/devices_test/lvm_test.py
 | ||||
| index 8ed577f4..a32c1d83 100644
 | ||||
| --- a/tests/devices_test/lvm_test.py
 | ||||
| +++ b/tests/devices_test/lvm_test.py
 | ||||
| @@ -2,7 +2,7 @@
 | ||||
|  import test_compat  # pylint: disable=unused-import | ||||
|   | ||||
|  import six | ||||
| -from six.moves.mock import patch  # pylint: disable=no-name-in-module,import-error
 | ||||
| +from six.moves.mock import patch, PropertyMock  # pylint: disable=no-name-in-module,import-error
 | ||||
|  import unittest | ||||
|   | ||||
|  import blivet | ||||
| @@ -352,6 +352,17 @@ def test_target_size(self):
 | ||||
|          self.assertEqual(lv.target_size, orig_size) | ||||
|          self.assertEqual(lv.size, orig_size) | ||||
|   | ||||
| +    def test_lvm_inconsistent_sector_size(self):
 | ||||
| +        pv = StorageDevice("pv1", fmt=blivet.formats.get_format("lvmpv"),
 | ||||
| +                           size=Size("1024 MiB"))
 | ||||
| +        pv2 = StorageDevice("pv2", fmt=blivet.formats.get_format("lvmpv"),
 | ||||
| +                            size=Size("1024 MiB"))
 | ||||
| +
 | ||||
| +        with patch("blivet.devices.StorageDevice.sector_size", new_callable=PropertyMock) as mock_property:
 | ||||
| +            mock_property.__get__ = lambda _mock, pv, _class: 512 if pv.name == "pv1" else 4096
 | ||||
| +            with six.assertRaisesRegex(self, ValueError, "The volume group testvg cannot be created."):
 | ||||
| +                LVMVolumeGroupDevice("testvg", parents=[pv, pv2])
 | ||||
| +
 | ||||
|   | ||||
|  class TypeSpecificCallsTest(unittest.TestCase): | ||||
|      def test_type_specific_calls(self): | ||||
| @ -19,11 +19,11 @@ | ||||
| Summary:  A python module for system storage configuration | ||||
| Name: python-blivet | ||||
| Url: https://storageapis.wordpress.com/projects/blivet | ||||
| Version: 3.1.0 | ||||
| Version: 3.2.2 | ||||
| 
 | ||||
| #%%global prerelease .b2 | ||||
| # prerelease, if defined, should be something like .a1, .b1, .b2.dev1, or .c2 | ||||
| Release: 18%{?prerelease}%{?dist} | ||||
| Release: 3%{?prerelease}%{?dist} | ||||
| Epoch: 1 | ||||
| License: LGPLv2+ | ||||
| Group: System Environment/Libraries | ||||
| @ -33,37 +33,16 @@ Source0: http://github.com/storaged-project/blivet/archive/%{realname}-%{realver | ||||
| Source1: http://github.com/storaged-project/blivet/archive/%{realname}-%{realversion}-tests.tar.gz | ||||
| Patch0: 0001-force-lvm-cli.plugin | ||||
| Patch1: 0002-remove-btrfs-plugin.patch | ||||
| Patch2: 0003-separate-dmraid-availability-check.patch | ||||
| Patch3: 0004-allow-removing-btrfs-volumes-without-btrfs-support.patch | ||||
| Patch4: 0005-arm7-cleanups.patch | ||||
| Patch5: 0006-Fix-options-for-ISCSI-functions.patch | ||||
| Patch6: 0007-Wipe-all-stale-metadata-after-creating-md-array.patch | ||||
| Patch7: 0008-Copy-the-iSCSI-initiator-name-file-to-the-installed-system.patch | ||||
| Patch8: 0008-po-updates.patch | ||||
| Patch9: 0009-Require-libfc-instead-of-fcoe-for-offloaded-FCoE.-15.patch | ||||
| Patch10: 0010-Use-udev-to-determine-if-disk-is-a-multipath-member.patch | ||||
| Patch11: 0011-Don-t-crash-if-blockdev-mpath-plugin-isn-t-available.patch | ||||
| Patch12: 0012-Ensure-correct-type-of-mpath-cache-member-list.patch | ||||
| Patch13: 0013-Various-test-fixes.patch | ||||
| Patch14: 0014-Tests-archive.patch | ||||
| Patch15: 0015-Deactivate-incomplete-VGs.patch | ||||
| Patch16: 0016-Automatically-adjust-size-of-growable-devices-for-new-format.patch | ||||
| Patch17: 0017-Add-flag-for-protecting-cdrom-devices-during-populate.patch | ||||
| Patch18: 0018-Clean-up-some-errors-evident-in-installer-logs.patch | ||||
| Patch19: 0019-Use-dasd-disklabel-for-vm-disks-backed-by-dasds.patch | ||||
| Patch20: 0020-Fix-reading-LV-attributes-in-LVMVolumeGroupDevice.patch | ||||
| Patch21: 0021-Correctly-handle-non-unicode-iSCSI-initiator-names.patch | ||||
| Patch22: 0022-Do-not-crash-if-dm_get_member_raid_sets-fails.patch | ||||
| Patch23: 0023-Minor-cleanups-to-reduce-log-noise.patch | ||||
| Patch24: 0024-Fix-util.detect_virt-function.patch | ||||
| Patch25: 0025-Check-for-PV-sector-size-when-creating-new-VG.patch | ||||
| Patch2: 0003-Skip-test_mounting-for-filesystems-that-are-not-moun.patch | ||||
| Patch3: 0004-Add-extra-sleep-after-pvremove-call.patch | ||||
| Patch4: 0005-Round-down-to-nearest-MiB-value-when-writing-ks-parittion-info.ks | ||||
| 
 | ||||
| # Versions of required components (done so we make sure the buildrequires | ||||
| # match the requires versions of things). | ||||
| %global partedver 1.8.1 | ||||
| %global pypartedver 3.10.4 | ||||
| %global utillinuxver 2.15.1 | ||||
| %global libblockdevver 2.17 | ||||
| %global libblockdevver 2.19 | ||||
| %global libbytesizever 0.3 | ||||
| %global pyudevver 0.18 | ||||
| 
 | ||||
| @ -187,7 +166,6 @@ configuration. | ||||
| %autosetup -n %{realname}-%{realversion} -N | ||||
| %autosetup -n %{realname}-%{realversion} -b1 -p1 | ||||
| 
 | ||||
| 
 | ||||
| %build | ||||
| %{?with_python2:make PYTHON=%{__python2}} | ||||
| %{?with_python3:make PYTHON=%{__python3}} | ||||
| @ -219,6 +197,36 @@ configuration. | ||||
| %endif | ||||
| 
 | ||||
| %changelog | ||||
| * Tue Jun 30 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.2.2-3 | ||||
| - Round down to nearest MiB value when writing ks parittion info | ||||
|   Resolves: rhbz#1850670 | ||||
| 
 | ||||
| * Wed Jun 24 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.2.2-2 | ||||
| - Add extra sleep after pvremove call | ||||
|   Resolves: rhbz#1640601 | ||||
| 
 | ||||
| * Fri May 22 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.2.2-1 | ||||
| - Rebase to the latest upstream release 3.2.2 | ||||
|   Resolves: rhbz#1714970 | ||||
| 
 | ||||
| * Mon Mar 02 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.1.0-20 | ||||
| - add `-y' to lvm.pvcreate | ||||
|   Resolves: rhbz#1768494 | ||||
| 
 | ||||
| * Wed Jan 29 2020 Vojtech Trefny <vtrefny@redhat.com> - 3.1.0-19 | ||||
| - Override LVM skip-activation to allow for thorough removal | ||||
|   Resolves: rhbz#1766498 | ||||
| - Make sure LVs are writable before wiping | ||||
|   Related: rhbz#1766498 | ||||
| - Fix udev test names so they actually get run. | ||||
|   Related: rhbz#1758102 | ||||
| - Add recognition of Dell FW RAID to udev.device_is_disk. | ||||
|   Resolves: rhbz#1758102 | ||||
| - Align base sizes up if smaller than min I/O size. | ||||
|   Resolves: rhbz#1781106 | ||||
| - Make minimal and optimal alignment getters public. | ||||
|   Related: rhbz#1781106 | ||||
| 
 | ||||
| * Tue Nov 19 2019 Vojtech Trefny <vtrefny@redhat.com> - 3.1.0-18 | ||||
| - Check for PV sector size when creating new VG | ||||
|   Resolves: rhbz#1754446 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user