Skip to content
This repository has been archived by the owner on Oct 11, 2023. It is now read-only.

loading kernel modules with parameters #2295

Closed
prologic opened this issue Mar 18, 2018 · 6 comments
Closed

loading kernel modules with parameters #2295

prologic opened this issue Mar 18, 2018 · 6 comments

Comments

@prologic
Copy link

The code that is responsible for loading kernel modules from the rancher.modules list does not support loading parameters:

os/init/init.go

Lines 43 to 72 in 82aaa41

func loadModules(cfg *config.CloudConfig) (*config.CloudConfig, error) {
mounted := map[string]bool{}
f, err := os.Open("/proc/modules")
if err != nil {
return cfg, err
}
defer f.Close()
reader := bufio.NewScanner(f)
for reader.Scan() {
mounted[strings.SplitN(reader.Text(), " ", 2)[0]] = true
}
for _, module := range cfg.Rancher.Modules {
if mounted[module] {
continue
}
log.Debugf("Loading module %s", module)
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)
}
}
return cfg, nil
}

Can we make it support this?

Use-case:

$ modprobe nbd nbds_max=1024
@JacieChao
Copy link
Contributor

We could add rancher.modules with parameters now.

Here's an example:
For CLI, you could use the following command:

sudo ros config set rancher.modules "['nbd nbds_max=1024']"

For YAML:

#cloud-config
rancher:
  modules: [nbd nbds_max=1024]

@prologic
Copy link
Author

This works in v1.2.0? It wasn't clear from the docs at all :/

@niusmallnan
Copy link
Contributor

@prologic No, we put it into the milestone v1.4.0.

@prologic
Copy link
Author

@imikushin Ahh sorry, @JacieChao's comment made it sound like this was already supported.

@kingsd041
Copy link
Contributor

Tested with rancheros v1.4.0-rc1.
@imikushin We could add rancher.modules with parameters now.

# ros config set rancher.modules "['nbd nbds_max=1024']"

# reboot

# cat /sys/module/nbd/parameters/nbds_max
1024

@prologic
Copy link
Author

Nice :D This lets us use StorageOS nicely on RancherOS

Thanks for fixing this!

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

No branches or pull requests

4 participants