Skip to content

Commit

Permalink
RAID: when a MD superblock is found on a disk, offer user to use it
Browse files Browse the repository at this point in the history
This adds an option to enable *all* RAID devices found.  This is less
flexible than a more selective mechanism would be, but really simple and
covering all known use-cases.

Signed-off-by: Yann Dirson <[email protected]>
  • Loading branch information
ydirson committed Dec 12, 2022
1 parent 8d718b0 commit af0eee9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tui/installer/screens.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ def hardware_warnings(answers, ram_warning, vt_warning):

def scan_existing(answers):
tui.progress.showMessageDialog("Please wait", "Checking for existing products...")

if 'assemble-raid' in answers:
logger.log("Assembling any RAID volumes")
rv = util.runCmd2([ 'mdadm', '--assemble', "--scan" ])

answers['installed-products'] = product.find_installed_products()
answers['upgradeable-products'] = upgrade.filter_for_upgradeable_products(answers['installed-products'])
answers['backups'] = product.findXenSourceBackups()
Expand Down Expand Up @@ -249,6 +254,16 @@ def get_installation_type(answers):
entries.append(("Restore %s from backup on %s" % (b, diskutil.getHumanDiskName(b.root_disk)),
(b, None)))

# if we were not already told to enable RAID, and any of the disks
# found holds a MD signature, propose to activate
if "assemble-raid" not in answers:
for disk in diskutil.getQualifiedDiskList():
rv = util.runCmd2([ 'mdadm', '--examine', disk ])
if rv == 0:
logger.log("Found a MD RAID on %s" % disk)
entries.append(("Assemble software RAID volumes", ("RAID", None)))
break

entries.append( ("Perform clean installation", None) )

# default value?
Expand Down Expand Up @@ -333,6 +348,10 @@ def more_info(context):
elif isinstance(entry[0], product.XenServerBackup):
answers['install-type'] = constants.INSTALL_TYPE_RESTORE
answers['backup-to-restore'], _ = entry
elif entry[0] == "RAID":
# go rescan for products after assembling RAID volumes
answers['assemble-raid'] = True
return LEFT_BACKWARDS

return RIGHT_FORWARDS

Expand Down

0 comments on commit af0eee9

Please sign in to comment.