Skip to content

Commit

Permalink
boot,overlord: address some review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alfonsosanchezbeato committed Oct 3, 2022
1 parent 66a345b commit 88b796b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions boot/makebootable.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func MakeBootableImage(model *asserts.Model, rootdir string, bootWith *BootableS
// using information from bootWith and bootFlags. Contrarily to
// MakeBootableImage this happens in a live system.
func MakeBootablePartition(partDir string, opts *bootloader.Options, bootWith *BootableSet, bootMode string, bootFlags []string) error {
return configureBootloader(partDir, bootWith, bootMode, opts, bootFlags)
return configureBootloader(partDir, opts, bootWith, bootMode, bootFlags)
}

// makeBootable16 setups the image filesystem for boot with UC16
Expand Down Expand Up @@ -162,7 +162,7 @@ func makeBootable16(model *asserts.Model, rootdir string, bootWith *BootableSet)
return nil
}

func configureBootloader(rootdir string, bootWith *BootableSet, bootMode string, opts *bootloader.Options, bootFlags []string) error {
func configureBootloader(rootdir string, opts *bootloader.Options, bootWith *BootableSet, bootMode string, bootFlags []string) error {
blVars := make(map[string]string, 3)
if len(bootFlags) != 0 {
if err := setImageBootFlags(bootFlags, blVars); err != nil {
Expand Down Expand Up @@ -218,7 +218,7 @@ func makeBootable20(rootdir string, bootWith *BootableSet, bootFlags []string) e
// setup the recovery bootloader
Role: bootloader.RoleRecovery,
}
if err := configureBootloader(rootdir, bootWith, ModeInstall, opts, bootFlags); err != nil {
if err := configureBootloader(rootdir, opts, bootWith, ModeInstall, bootFlags); err != nil {
return fmt.Errorf("cannot install bootloader: %v", err)
}

Expand Down
6 changes: 4 additions & 2 deletions boot/makebootable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,8 @@ version: 5.0

// ensure that there are no good recovery systems as RecoverySystemDir was empty
mockSeedGrubenv := filepath.Join(mockSeedGrubDir, "grubenv")
c.Assert(mockSeedGrubenv, testutil.FilePresent)
c.Check(mockSeedGrubenv, testutil.FileContains, "snapd_good_recovery_systems=")
c.Check(mockSeedGrubenv, testutil.FilePresent)
systemGenv := grubenv.NewEnv(mockSeedGrubenv)
c.Assert(systemGenv.Load(), IsNil)
c.Check(systemGenv.Get("snapd_good_recovery_systems"), Equals, "")
}
1 change: 1 addition & 0 deletions overlord/devicestate/devicestate_install_mode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3897,6 +3897,7 @@ func (s *installStepSuite) TestDeviceManagerInstallFinishRunthrough(c *C) {
st.Lock()

c.Check(chg.IsReady(), Equals, true)
// TODO: update once the change actually does something
c.Check(chg.Err().Error(), Equals, `cannot perform the following tasks:
- Finish setup of run system for "1234" (cannot load assertions for label "1234": no seed assertions)`)
}
Expand Down
2 changes: 1 addition & 1 deletion overlord/devicestate/handlers_install.go
Original file line number Diff line number Diff line change
Expand Up @@ -1297,7 +1297,7 @@ func (m *DeviceManager) doInstallFinish(t *state.Task, _ *tomb.Tomb) error {
}

logger.Debugf("writing content to partitions")
timings.Run(perfTimings, "install-finish", "Writing content to partitions", func(tm timings.Measurer) {
timings.Run(perfTimings, "install-content", "Writing content to partitions", func(tm timings.Measurer) {
st.Unlock()
defer st.Lock()
_, err = installWriteContent(onVolumes, installObserver, mntPtForType[snap.TypeGadget], mntPtForType[snap.TypeKernel], sys.Model, perfTimings)
Expand Down

0 comments on commit 88b796b

Please sign in to comment.