|
|
34c36b |
From d2d9a4e0c086a0551dac644d45954f23e0116ef1 Mon Sep 17 00:00:00 2001
|
|
|
34c36b |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
|
34c36b |
Date: Wed, 12 Sep 2018 10:45:41 +0200
|
|
|
34c36b |
Subject: [PATCH 1/2] Allow removing btrfs volumes without btrfs support
|
|
|
34c36b |
|
|
|
34c36b |
Btrfs volumes are removed using wipefs so we don't need to check
|
|
|
34c36b |
for device dependencies availability when removing the volume
|
|
|
34c36b |
(btrfs support depends on libblockdev btrfs plugin).
|
|
|
34c36b |
|
|
|
34c36b |
Resolves: rhbz#1605213
|
|
|
34c36b |
---
|
|
|
34c36b |
blivet/deviceaction.py | 23 ++++++++++++++++++-----
|
|
|
34c36b |
1 file changed, 18 insertions(+), 5 deletions(-)
|
|
|
34c36b |
|
|
|
34c36b |
diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
|
|
|
34c36b |
index 3e337e18..b3e9e5f1 100644
|
|
|
34c36b |
--- a/blivet/deviceaction.py
|
|
|
34c36b |
+++ b/blivet/deviceaction.py
|
|
|
34c36b |
@@ -160,15 +160,19 @@ class DeviceAction(util.ObjectID):
|
|
|
34c36b |
if not isinstance(device, StorageDevice):
|
|
|
34c36b |
raise ValueError("arg 1 must be a StorageDevice instance")
|
|
|
34c36b |
|
|
|
34c36b |
- unavailable_dependencies = device.unavailable_dependencies
|
|
|
34c36b |
- if unavailable_dependencies:
|
|
|
34c36b |
- dependencies_str = ", ".join(str(d) for d in unavailable_dependencies)
|
|
|
34c36b |
- raise DependencyError("device type %s requires unavailable_dependencies: %s" % (device.type, dependencies_str))
|
|
|
34c36b |
-
|
|
|
34c36b |
self.device = device
|
|
|
34c36b |
+
|
|
|
34c36b |
+ self._check_device_dependencies()
|
|
|
34c36b |
+
|
|
|
34c36b |
self.container = getattr(self.device, "container", None)
|
|
|
34c36b |
self._applied = False
|
|
|
34c36b |
|
|
|
34c36b |
+ def _check_device_dependencies(self):
|
|
|
34c36b |
+ unavailable_dependencies = self.device.unavailable_dependencies
|
|
|
34c36b |
+ if unavailable_dependencies:
|
|
|
34c36b |
+ dependencies_str = ", ".join(str(d) for d in unavailable_dependencies)
|
|
|
34c36b |
+ raise DependencyError("device type %s requires unavailable_dependencies: %s" % (self.device.type, dependencies_str))
|
|
|
34c36b |
+
|
|
|
34c36b |
def apply(self):
|
|
|
34c36b |
""" apply changes related to the action to the device(s) """
|
|
|
34c36b |
self._applied = True
|
|
|
34c36b |
@@ -379,6 +383,15 @@ class ActionDestroyDevice(DeviceAction):
|
|
|
34c36b |
# XXX should we insist that device.fs be None?
|
|
|
34c36b |
DeviceAction.__init__(self, device)
|
|
|
34c36b |
|
|
|
34c36b |
+ def _check_device_dependencies(self):
|
|
|
34c36b |
+ if self.device.type == "btrfs volume":
|
|
|
34c36b |
+ # XXX destroying a btrfs volume is a special case -- we don't destroy
|
|
|
34c36b |
+ # the device, but use wipefs to destroy format on its parents so we
|
|
|
34c36b |
+ # don't need btrfs plugin or btrfs-progs for this
|
|
|
34c36b |
+ return
|
|
|
34c36b |
+
|
|
|
34c36b |
+ super(ActionDestroyDevice, self)._check_device_dependencies()
|
|
|
34c36b |
+
|
|
|
34c36b |
def execute(self, callbacks=None):
|
|
|
34c36b |
super(ActionDestroyDevice, self).execute(callbacks=callbacks)
|
|
|
34c36b |
self.device.destroy()
|
|
|
34c36b |
--
|
|
|
34c36b |
2.17.1
|
|
|
34c36b |
|
|
|
34c36b |
|
|
|
34c36b |
From a9bcf26e085160a84b78c396c33cd0a77a35a746 Mon Sep 17 00:00:00 2001
|
|
|
34c36b |
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
|
34c36b |
Date: Mon, 17 Sep 2018 10:25:24 +0200
|
|
|
34c36b |
Subject: [PATCH 2/2] Check device dependencies only for device actions
|
|
|
34c36b |
|
|
|
34c36b |
We don't want to check device dependencies for format actions.
|
|
|
34c36b |
It should be possible to for example format an opened LUKS device
|
|
|
34c36b |
without libblockdev crypto plugin.
|
|
|
34c36b |
|
|
|
34c36b |
Related: rhbz#1605213
|
|
|
34c36b |
---
|
|
|
34c36b |
blivet/deviceaction.py | 3 ++-
|
|
|
34c36b |
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
34c36b |
|
|
|
34c36b |
diff --git a/blivet/deviceaction.py b/blivet/deviceaction.py
|
|
|
34c36b |
index b3e9e5f1..14a06ff0 100644
|
|
|
34c36b |
--- a/blivet/deviceaction.py
|
|
|
34c36b |
+++ b/blivet/deviceaction.py
|
|
|
34c36b |
@@ -162,7 +162,8 @@ class DeviceAction(util.ObjectID):
|
|
|
34c36b |
|
|
|
34c36b |
self.device = device
|
|
|
34c36b |
|
|
|
34c36b |
- self._check_device_dependencies()
|
|
|
34c36b |
+ if self.is_device:
|
|
|
34c36b |
+ self._check_device_dependencies()
|
|
|
34c36b |
|
|
|
34c36b |
self.container = getattr(self.device, "container", None)
|
|
|
34c36b |
self._applied = False
|
|
|
34c36b |
--
|
|
|
34c36b |
2.17.1
|
|
|
34c36b |
|