1
0
mirror of https://github.com/rancher/os.git synced 2025-08-31 22:32:14 +00:00

find fs type of device automatically

This commit is contained in:
sidharthamani
2015-02-12 14:34:16 -08:00
parent 34b3057909
commit 70b376ce6a
3 changed files with 53 additions and 9 deletions

View File

@@ -213,12 +213,31 @@ func MainInit() {
func mountState(cfg *config.Config) error {
var err error
if len(cfg.StateDev) == 0 {
log.Debugf("State will not be persisted")
err = util.Mount("none", STATE, "tmpfs", "")
} else {
log.Debugf("Mounting state device %s", cfg.StateDev)
err = util.Mount(cfg.StateDev, STATE, cfg.StateDevFSType, "")
dev := util.ResolveDevice(cfg.StateDev)
log.Debugf("Mounting state device %s", dev)
fsType := cfg.StateDevFSType
log.Debugf("FsType has been set to %s", fsType)
if fsType == "auto" {
actualFsType, fsErr := util.GetFsType(dev)
if fsErr != nil {
return fsErr
}
fsType = actualFsType
}
err = util.Mount(dev, STATE, fsType, "")
if err != nil {
if cfg.StateRequired {
return err
} else {
log.Debugf("State will not be persisted")
err = util.Mount("none", STATE, "tmpfs", "")
if err != nil {
return err
}
}
}
if err != nil {