1
0
mirror of https://github.com/rancher/os.git synced 2025-07-10 13:23:03 +00:00

Merge pull request #1441 from joshwget/load-modules-after-running-preparefs

Load modules after running PrepareFs
This commit is contained in:
Sven Dowideit 2016-12-02 12:44:18 +10:00 committed by GitHub
commit b431254cc4
3 changed files with 23 additions and 2 deletions

View File

@ -59,7 +59,10 @@ func loadModules(cfg *config.CloudConfig) (*config.CloudConfig, error) {
}
log.Debugf("Loading module %s", module)
if err := exec.Command("modprobe", module).Run(); err != nil {
cmd := exec.Command("modprobe", module)
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
log.Errorf("Could not load module %s, err %v", module, err)
}
}
@ -356,10 +359,10 @@ func RunInit() error {
return config.LoadConfig(), nil
},
loadModules,
func(c *config.CloudConfig) (*config.CloudConfig, error) {
return c, dfs.PrepareFs(&mountConfig)
},
loadModules,
func(c *config.CloudConfig) (*config.CloudConfig, error) {
network.SetProxyEnvironmentVariables(c)
return c, nil

View File

@ -0,0 +1,5 @@
#cloud-config
rancher:
modules: [btrfs]
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC85w9stZyiLQp/DkVO6fqwiShYcj1ClKdtCqgHtf+PLpJkFReSFu8y21y+ev09gsSMRRrjF7yt0pUHV6zncQhVeqsZtgc5WbELY2DOYUGmRn/CCvPbXovoBrQjSorqlBmpuPwsStYLr92Xn+VVsMNSUIegHY22DphGbDKG85vrKB8HxUxGIDxFBds/uE8FhSy+xsoyT/jUZDK6pgq2HnGl6D81ViIlKecpOpWlW3B+fea99ADNyZNVvDzbHE5pcI3VRw8u59WmpWOUgT6qacNVACl8GqpBvQk8sw7O/X9DSZHCKafeD9G5k+GYbAUz92fKWrx/lOXfUXPS3+c8dRIF

13
tests/modules_test.go Normal file
View File

@ -0,0 +1,13 @@
package integration
import . "gopkg.in/check.v1"
func (s *QemuSuite) TestKernelParameterModule(c *C) {
s.RunQemu(c, "--append", "rancher.modules=[btrfs]")
s.CheckCall(c, "lsmod | grep btrfs")
}
func (s *QemuSuite) TestCloudConfigModule(c *C) {
s.RunQemu(c, "--cloud-config", "./tests/assets/test_27/cloud-config.yml")
s.CheckCall(c, "lsmod | grep btrfs")
}