-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
0003-Allow-to-provide-default_partitionning-based-on-sche.patch
78 lines (68 loc) · 3.48 KB
/
0003-Allow-to-provide-default_partitionning-based-on-sche.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
From 0c94b9c14d686f9859989fa026da7439bfb5a741 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?=
<frederic.pierret@qubes-os.org>
Date: Wed, 4 Jan 2023 10:43:16 +0100
Subject: [PATCH] Allow to provide default_partitionning based on scheme
---
pyanaconda/core/configuration/storage.py | 16 ++++++++++++++++
.../automatic/automatic_partitioning.py | 2 +-
.../storage/partitioning/automatic/utils.py | 5 ++---
3 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/core/configuration/storage.py b/pyanaconda/core/configuration/storage.py
index b30fde9112..fa95a8140b 100644
--- a/pyanaconda/core/configuration/storage.py
+++ b/pyanaconda/core/configuration/storage.py
@@ -182,6 +182,22 @@ class StorageSection(Section):
"""
return self._get_option("default_partitioning", self._convert_partitioning)
+ def get_default_partitioning(self, scheme=None):
+ option = None
+ if scheme == AUTOPART_TYPE_PLAIN:
+ option = "default_partitioning_plain"
+ elif scheme == AUTOPART_TYPE_BTRFS:
+ option = "default_partitioning_btrfs"
+ elif scheme == AUTOPART_TYPE_LVM:
+ option = "default_partitioning_lvm"
+ elif scheme == AUTOPART_TYPE_LVM_THINP:
+ option = "default_partitioning_lvm_thinp"
+ if option and self._has_option(option):
+ partitioning = self._get_option(option, self._convert_partitioning)
+ else:
+ partitioning = self.default_partitioning
+ return partitioning
+
def _convert_partitioning(self, value):
"""Convert a partitioning string into a list of dictionaries."""
return list(map(self._convert_partitioning_line, value.strip().split("\n")))
diff --git a/pyanaconda/modules/storage/partitioning/automatic/automatic_partitioning.py b/pyanaconda/modules/storage/partitioning/automatic/automatic_partitioning.py
index 5d8c4da389..61e3849ed6 100644
--- a/pyanaconda/modules/storage/partitioning/automatic/automatic_partitioning.py
+++ b/pyanaconda/modules/storage/partitioning/automatic/automatic_partitioning.py
@@ -134,7 +134,7 @@ class AutomaticPartitioningTask(NonInteractivePartitioningTask):
swap = None
# Create partitioning specs based on the default configuration.
- for spec in get_default_partitioning():
+ for spec in get_default_partitioning(scheme):
# Skip mount points excluded from the chosen scheme.
if spec.schemes and scheme not in spec.schemes:
continue
diff --git a/pyanaconda/modules/storage/partitioning/automatic/utils.py b/pyanaconda/modules/storage/partitioning/automatic/utils.py
index 474d9cbd45..b496950fcc 100644
--- a/pyanaconda/modules/storage/partitioning/automatic/utils.py
+++ b/pyanaconda/modules/storage/partitioning/automatic/utils.py
@@ -255,8 +255,7 @@ def schedule_implicit_partitions(storage, disks, scheme, encrypted=False, luks_f
return devs
-
-def get_default_partitioning():
+def get_default_partitioning(scheme=None):
"""Get the default partitioning requests.
:return: a list of partitioning specs
@@ -265,7 +264,7 @@ def get_default_partitioning():
partitioning = list(platform.partitions)
# Get the product-specific partitioning.
- for attrs in conf.storage.default_partitioning:
+ for attrs in conf.storage.get_default_partitioning(scheme=scheme):
partitioning.append(get_part_spec(attrs))
return partitioning
--
2.45.2