Skip to content

Commit

Permalink
answerfile: add support for assembling pre-existing RAID
Browse files Browse the repository at this point in the history
Signed-off-by: Yann Dirson <[email protected]>
  • Loading branch information
ydirson committed Jan 26, 2023
1 parent cab52a9 commit 406503f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions answerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def parseFreshInstall(self):
results['preserve-settings'] = False
results['backup-existing-installation'] = False

results.update(self.parseAssembleRaid())
results.update(self.parseDisks())
results.update(self.parseInterface())
results.update(self.parseRootPassword())
Expand Down Expand Up @@ -170,6 +171,7 @@ def parseRestore(self):

results['install-type'] = INSTALL_TYPE_RESTORE

results.update(self.parseAssembleRaid())
backups = product.findXenSourceBackups()
if len(backups) == 0:
raise AnswerfileException("Could not locate exsisting backup.")
Expand Down Expand Up @@ -227,6 +229,7 @@ def parseCommon(self):
def parseExistingInstallation(self):
results = {}

results.update(self.parseAssembleRaid())
inst = getElementsByTagName(self.top_node, ['existing-installation'],
mandatory=True)
disk = normalize_disk(getText(inst[0]))
Expand Down Expand Up @@ -293,6 +296,15 @@ def parseDriverSource(self):
results['extra-repos'].append((rtype, address))
return results

def parseAssembleRaid(self):
results = {}
nodes = getElementsByTagName(self.top_node, ['assemble-raid'])
if nodes:
results['assemble-raid'] = True # possibly useless
logger.log("Assembling any RAID volumes")
rv = util.runCmd2([ 'mdadm', '--assemble', "--scan" ])
return results

def parseDisks(self):
results = {}

Expand Down
9 changes: 9 additions & 0 deletions doc/answerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,15 @@ Common Elements
Discovery on.


<assemble-raid/>?

Run `mdadm --assemble --scan` before looking for the device
specified in <primary-disk>, <existing-installation>, or
<backup-disk>.

Used to be the default behavior.


(Re)Install Elements
--------------------

Expand Down

0 comments on commit 406503f

Please sign in to comment.