import python-blivet-3.1.0-13.el8

This commit is contained in:
CentOS Sources 2019-08-06 15:15:20 -04:00 committed by Stepan Oksanichenko
commit e6970a6137
24 changed files with 39405 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
SOURCES/blivet-3.1.0-tests.tar.gz
SOURCES/blivet-3.1.0.tar.gz

2
.python-blivet.metadata Normal file
View File

@ -0,0 +1,2 @@
4bd8abd1cb7bffa644cffb017f6583a2fd7c19f9 SOURCES/blivet-3.1.0-tests.tar.gz
f388d30e55dfaa9c22415c2e9e3f9670f9d08f27 SOURCES/blivet-3.1.0.tar.gz

View File

@ -0,0 +1,35 @@
From 2f90040ff66eacc9715e370cd49ffb72d8d1f36f Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Wed, 11 Jul 2018 15:36:24 +0200
Subject: [PATCH] Force command line based libblockdev LVM plugin
---
blivet/__init__.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index c5a75bb..cb75917 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -63,11 +63,16 @@ gi.require_version("BlockDev", "2.0")
from gi.repository import GLib
from gi.repository import BlockDev as blockdev
if arch.is_s390():
- _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
+ _REQUESTED_PLUGIN_NAMES = set(("btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
else:
- _REQUESTED_PLUGIN_NAMES = set(("lvm", "btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
+ _REQUESTED_PLUGIN_NAMES = set(("btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
_requested_plugins = blockdev.plugin_specs_from_names(_REQUESTED_PLUGIN_NAMES)
+# XXX force non-dbus LVM plugin
+lvm_plugin = blockdev.PluginSpec()
+lvm_plugin.name = blockdev.Plugin.LVM
+lvm_plugin.so_name = "libbd_lvm.so.2"
+_requested_plugins.append(lvm_plugin)
try:
# do not check for dependencies during libblockdev initializtion, do runtime
# checks instead
--
1.8.3.1

View File

@ -0,0 +1,28 @@
From 6bf3378d3d2a1b6a4338df0c4dd36a783a641633 Mon Sep 17 00:00:00 2001
From: Vojtech Trefny <vtrefny@redhat.com>
Date: Mon, 16 Jul 2018 14:26:11 +0200
Subject: [PATCH] Remove btrfs from requested libblockdev plugins
---
blivet/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index cb75917..09f8b1c 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -63,9 +63,9 @@ gi.require_version("BlockDev", "2.0")
from gi.repository import GLib
from gi.repository import BlockDev as blockdev
if arch.is_s390():
- _REQUESTED_PLUGIN_NAMES = set(("btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
+ _REQUESTED_PLUGIN_NAMES = set(("swap", "crypto", "loop", "mdraid", "mpath", "dm", "s390", "nvdimm"))
else:
- _REQUESTED_PLUGIN_NAMES = set(("btrfs", "swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
+ _REQUESTED_PLUGIN_NAMES = set(("swap", "crypto", "loop", "mdraid", "mpath", "dm", "nvdimm"))
_requested_plugins = blockdev.plugin_specs_from_names(_REQUESTED_PLUGIN_NAMES)
# XXX force non-dbus LVM plugin
--
1.8.3.1

View File

@ -0,0 +1,56 @@
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

View File

@ -0,0 +1,104 @@
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

View File

@ -0,0 +1,272 @@
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
#

View File

@ -0,0 +1,44 @@
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

View File

@ -0,0 +1,45 @@
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)

View File

@ -0,0 +1,29 @@
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 \

34896
SOURCES/0008-po-updates.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
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

View File

@ -0,0 +1,64 @@
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)

View File

@ -0,0 +1,45 @@
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

View File

@ -0,0 +1,31 @@
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

View File

@ -0,0 +1,122 @@
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

View File

@ -0,0 +1,110 @@
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/@.*)/)/'

View File

@ -0,0 +1,47 @@
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

View File

@ -0,0 +1,31 @@
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)

View File

@ -0,0 +1,54 @@
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()

View File

@ -0,0 +1,81 @@
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

View File

@ -0,0 +1,128 @@
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')

View File

@ -0,0 +1,30 @@
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

3116
SPECS/python-blivet.spec Normal file

File diff suppressed because it is too large Load Diff