Skip to content

Commit

Permalink
later-squash! RAID: when a MD superblock is found on a disk, offer us…
Browse files Browse the repository at this point in the history
…er 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.
  • Loading branch information
ydirson committed Jan 26, 2023
1 parent 7e06b77 commit 140fec5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
4 changes: 4 additions & 0 deletions constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
18 changes: 18 additions & 0 deletions doc/features.txt
Original file line number Diff line number Diff line change
@@ -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 <assemble-raid/> answerfile
construct does not need this feature flag.
2 changes: 1 addition & 1 deletion tui/installer/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 140fec5

Please sign in to comment.