From 140fec5dbe1c4f8786fc3ec974ed3a84ad336d0c Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Wed, 14 Dec 2022 17:48:33 +0100 Subject: [PATCH] later-squash! RAID: when a MD superblock is found on a disk, offer user to assemble RAID This commit is kept as separate until decided this is the way to go, but would be better squashed. Introduce installer feature flags, and hide the RAID-assembling feature behind the `raid-assemble` flag. --- constants.py | 4 ++++ doc/features.txt | 18 ++++++++++++++++++ tui/installer/screens.py | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 doc/features.txt diff --git a/constants.py b/constants.py index 7b414802..1dc3d4eb 100644 --- a/constants.py +++ b/constants.py @@ -181,3 +181,7 @@ def error_string(error, logname, with_hd): 'var/lib/misc/ran-network-init', 'var/lib/misc/ran-storage-init', ] + +# optional features +FEATURES_DIR = "/etc/xensource/features" +HAS_RAID_ASSEMBLE = os.path.exists(os.path.join(FEATURES_DIR, "raid-assemble")) diff --git a/doc/features.txt b/doc/features.txt new file mode 100644 index 00000000..20fabd43 --- /dev/null +++ b/doc/features.txt @@ -0,0 +1,18 @@ +Features flags +============== + +Some host-installer features are not enabled by default, and +downstream installers can activate them by creating a file in +/etc/xensource/features/ in their installer filesystem. + +Currently available feature flags are: + + raid-assemble + + Detect Linux software-RAID (a.k.a "md") superblocks in disks, adds + a choice for the user to activate software RAID volumes, and do + not offer the user the ability to upgrade or restore a system on a + software-RAID device. + + This only impacts the UI, the answerfile + construct does not need this feature flag. diff --git a/tui/installer/screens.py b/tui/installer/screens.py index e361b914..d923cf8a 100644 --- a/tui/installer/screens.py +++ b/tui/installer/screens.py @@ -229,7 +229,7 @@ def get_installation_type(answers): # RAID members, for filtering out from upgradable-products and # backups, and to decide whether to propose to activate existing RAID. raid_members = [] - if "assemble-raid" not in answers: + if constants.HAS_RAID_ASSEMBLE and "assemble-raid" not in answers: for disk in diskutil.getQualifiedDiskList(): rv, out = util.runCmd2([ 'mdadm', '--examine', disk ], with_stdout=True) if rv == 0 and re.search("Array UUID :", out):