Fix recovery (#54)

* Fix recovery

 - change TargetLabel into TargetDevice to hav ethe full device instead
   of just the label
 - log error if we cant mount
 - Get state partition to mount depending on recovery or active/passive
 - Get state patition fs on the fly
 - Set proper label device to mount on sysroot based on our boot state

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

* Fix test

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>

---------

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
This commit is contained in:
Itxaka
2023-02-17 11:53:26 +01:00
committed by GitHub
parent 88df028e6d
commit c081f987f8
8 changed files with 59 additions and 79 deletions

View File

@@ -48,21 +48,21 @@ Sends a generic event payload with the configuration found in the scanned direct
g := herd.DAG(herd.EnableInit)
// Get targets and state
targetLabel, targetDevice := utils.GetTarget(c.Bool("dry-run"))
targetImage, targetDevice := utils.GetTarget(c.Bool("dry-run"))
s := &mount.State{
Logger: log.Logger,
Rootdir: utils.GetRootDir(),
TargetLabel: targetDevice,
TargetImage: targetLabel,
TargetDevice: targetDevice,
TargetImage: targetImage,
RootMountMode: utils.RootRW(),
}
if utils.DisableImmucore() {
log.Logger.Info().Msg("Stanza rd.cos.disable on the cmdline or booting from CDROM/Netboot/recovery. Disabling immucore.")
log.Logger.Info().Msg("Stanza rd.cos.disable on the cmdline or booting from CDROM/Netboot/Squash recovery. Disabling immucore.")
err = s.RegisterLiveMedia(g)
} else {
log.Logger.Info().Msg("Booting on active/passive.")
log.Logger.Info().Msg("Booting on active/passive/recovery.")
err = s.RegisterNormalBoot(g)
}