Skip to content

Commit

Permalink
storage: find and set boot partition
Browse files Browse the repository at this point in the history
Refactor the boot partition login to central code.
Search all target install media for the boot partition.

Signed-off-by: Mark D Horn <[email protected]>
  • Loading branch information
mdhorn committed Apr 29, 2020
1 parent 56d0842 commit a639650
Show file tree
Hide file tree
Showing 7 changed files with 296 additions and 143 deletions.
24 changes: 14 additions & 10 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,14 @@ func Install(rootDir string, model *model.SystemInstall, options args.Args) erro
tm.ExpandName(aliasMap)
newName := tm.Name
// Remap the InstallSelected
model.InstallSelected[newName] = model.InstallSelected[oldName]
if model.InstallSelected[newName].Name == oldName ||
model.InstallSelected[newName].Name == "" {
oldCopy := model.InstallSelected[oldName]
oldCopy.Name = newName
model.InstallSelected[newName] = oldCopy
} else {
model.InstallSelected[newName] = model.InstallSelected[oldName]
}
delete(model.InstallSelected, oldName)
}

Expand All @@ -235,16 +242,13 @@ func Install(rootDir string, model *model.SystemInstall, options args.Args) erro
}

// prepare all the target block devices
for _, curr := range model.TargetMedias {
var wholeDisk bool
if val, ok := model.InstallSelected[curr.Name]; ok {
wholeDisk = val.WholeDisk
}
// based on the description given, write the partition table
if err = curr.WritePartitionTable(model.MediaOpts.LegacyBios, wholeDisk, nil); err != nil {
return err
}
if err := storage.PrepareInstallationMedia(model.InstallSelected,
model.TargetMedias, model.MediaOpts, nil); err != nil {
log.Warning("PrepareInstallationMedia: %+v", err)
return err
}

for _, curr := range model.TargetMedias {
// Are we using software RAID
softRaidUsed = softRaidUsed || curr.UsesRaid()

Expand Down
4 changes: 4 additions & 0 deletions locale/en_US/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -840,3 +840,7 @@ msgstr "Could not interrupt %s"
#, c-format
msgid "Creating %s"
msgstr "Creating %s"

#, c-format
msgid "Setting boot partition: %s"
msgstr "Setting boot partition: %s"
4 changes: 4 additions & 0 deletions locale/es_MX/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -840,3 +840,7 @@ msgstr "No se ha podido interrumpir %s"
#, c-format
msgid "Creating %s"
msgstr "Crear %s"

#, c-format
msgid "Setting boot partition: %s"
msgstr "Estableciendo partición de arranque: %s"
4 changes: 4 additions & 0 deletions locale/zh_CN/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -840,3 +840,7 @@ msgstr "无法中断 %s"
#, c-format
msgid "Creating %s"
msgstr "创建 %s"

#, c-format
msgid "Setting boot partition: %s"
msgstr "设置启动分区:%s"
2 changes: 1 addition & 1 deletion massinstall/massinstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ func (mi *MassInstall) Run(md *model.SystemInstall, rootDir string, options args
// Need to ensure the partitioner knows we are running from
// the command line and will be using the whole disk
for _, curr := range md.TargetMedias {
md.InstallSelected[curr.Name] = storage.InstallTarget{WholeDisk: true}
md.InstallSelected[curr.Name] = storage.InstallTarget{Name: curr.Name, WholeDisk: true}
log.Debug("Mass installer using defined media in YAML")
}

Expand Down
Loading

0 comments on commit a639650

Please sign in to comment.