Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to mount oem under livemedia #110

Merged
merged 2 commits into from
Apr 12, 2023
Merged

Try to mount oem under livemedia #110

merged 2 commits into from
Apr 12, 2023

Conversation

Itxaka
Copy link
Member

@Itxaka Itxaka commented Apr 12, 2023

This allows recovery squashfs to have oem mounted on boot so the stages runs correctly with user provided configs.

@Itxaka Itxaka requested a review from a team April 12, 2023 10:48
@Itxaka
Copy link
Member Author

Itxaka commented Apr 12, 2023

Tested cloud images + recovery: works

Missing testing netboot+iso boot, which should not trigger the oem mount but should pick the live_media DAG

@@ -20,7 +20,7 @@ func (s *State) RegisterUKI(g *herd.Graph) error {
s.LogIfError(s.UKIUdevDaemon(g), "udev")

// Run rootfs stage
s.LogIfError(s.RootfsStageDagStep(g, cnst.OpSentinel, cnst.OpUkiUdev), "uki rootfs")
s.LogIfError(s.RootfsStageDagStep(g, herd.WithDeps(cnst.OpSentinel, cnst.OpUkiUdev), herd.WithWeakDeps()), "uki rootfs")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty weakdeps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, signature of the call has changed to be able to pass an optional number of deps and weakdeps

@@ -102,8 +102,8 @@ func (s *State) MountRootDagStep(g *herd.Graph) error {
}

// RootfsStageDagStep will add the rootfs stage.
func (s *State) RootfsStageDagStep(g *herd.Graph, deps ...string) error {
return g.Add(cnst.OpRootfsHook, herd.WithDeps(deps...), herd.WithCallback(s.RunStageOp("rootfs")))
func (s *State) RootfsStageDagStep(g *herd.Graph, deps herd.OpOption, weakDeps herd.OpOption) error {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
func (s *State) RootfsStageDagStep(g *herd.Graph, deps herd.OpOption, weakDeps herd.OpOption) error {
func (s *State) RootfsStageDagStep(g *herd.Graph, opts ...herd.OpOption) error {

func (s *State) RootfsStageDagStep(g *herd.Graph, deps ...string) error {
return g.Add(cnst.OpRootfsHook, herd.WithDeps(deps...), herd.WithCallback(s.RunStageOp("rootfs")))
func (s *State) RootfsStageDagStep(g *herd.Graph, deps herd.OpOption, weakDeps herd.OpOption) error {
return g.Add(cnst.OpRootfsHook, deps, weakDeps, herd.WithCallback(s.RunStageOp("rootfs")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return g.Add(cnst.OpRootfsHook, deps, weakDeps, herd.WithCallback(s.RunStageOp("rootfs")))
return g.Add(cnst.OpRootfsHook, herd.WithCallback(s.RunStageOp("rootfs")), opts... )

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait...can you pass the callback anywhere???

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nope, you cant:

Invalid use of '...', the corresponding parameter is non-variadic

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes, you can but have to append the withCallback to the slice!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argh yep I've messed it up while adding the suggestion

@@ -20,7 +20,7 @@ func (s *State) RegisterUKI(g *herd.Graph) error {
s.LogIfError(s.UKIUdevDaemon(g), "udev")

// Run rootfs stage
s.LogIfError(s.RootfsStageDagStep(g, cnst.OpSentinel, cnst.OpUkiUdev), "uki rootfs")
s.LogIfError(s.RootfsStageDagStep(g, herd.WithDeps(cnst.OpSentinel, cnst.OpUkiUdev), herd.WithWeakDeps()), "uki rootfs")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
s.LogIfError(s.RootfsStageDagStep(g, herd.WithDeps(cnst.OpSentinel, cnst.OpUkiUdev), herd.WithWeakDeps()), "uki rootfs")
s.LogIfError(s.RootfsStageDagStep(g, herd.WithDeps(cnst.OpSentinel, cnst.OpUkiUdev)), "uki rootfs")

Copy link
Member

@mudler mudler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beside small code nitpicks looks good here! good catch!

@Itxaka Itxaka force-pushed the oem_recovery_squash branch 3 times, most recently from fd111ea to a4e1fd5 Compare April 12, 2023 13:53
func (s *State) RootfsStageDagStep(g *herd.Graph, deps ...string) error {
return g.Add(cnst.OpRootfsHook, herd.WithDeps(deps...), herd.WithCallback(s.RunStageOp("rootfs")))
func (s *State) RootfsStageDagStep(g *herd.Graph, opts ...herd.OpOption) error {
opts = append(opts, herd.WithCallback(s.RunStageOp("rootfs")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you know this can be a oneline.. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¬_¬

Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
Signed-off-by: Itxaka <itxaka.garcia@spectrocloud.com>
@Itxaka
Copy link
Member Author

Itxaka commented Apr 12, 2023

Manually tested:

  • Iso boot
  • Iso install
  • After iso install, active boot
  • After iso install, passive boot
  • After iso install, recovery(non-squash) boot
  • Raw boot recovery(squash)
  • After Raw boot, reset is auto run
  • After Raw reset, active boot
  • After Raw reset, passive boot
  • After Raw reset, recovery(non-squash) boot

@Itxaka Itxaka merged commit 6bf656c into master Apr 12, 2023
@Itxaka Itxaka deleted the oem_recovery_squash branch April 12, 2023 14:19
func (s *State) RootfsStageDagStep(g *herd.Graph, deps ...string) error {
return g.Add(cnst.OpRootfsHook, herd.WithDeps(deps...), herd.WithCallback(s.RunStageOp("rootfs")))
func (s *State) RootfsStageDagStep(g *herd.Graph, opts ...herd.OpOption) error {
return g.Add(cnst.OpRootfsHook, append(opts, herd.WithCallback(s.RunStageOp("rootfs")))...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 🦔 Cloud images mounting oem on recovery
2 participants