Example #1
0
func mountState(cfg *config.Config) error {
	var err error

	if cfg.State.Dev != "" {
		dev := util.ResolveDevice(cfg.State.Dev)
		log.Infof("Mounting state device %s to %s", dev, STATE)

		fsType := cfg.State.FsType
		if fsType == "auto" {
			fsType, err = util.GetFsType(dev)
		}

		if err == nil {
			log.Debugf("FsType has been set to %s", fsType)
			err = util.Mount(dev, STATE, fsType, "")
		}
	}

	if err != nil && cfg.State.Required {
		return err
	}

	if err != nil || cfg.State.Dev == "" {
		log.Debugf("State will not be persisted")
		err = util.Mount("none", STATE, "tmpfs", "")
	}

	return err
}
Example #2
0
File: init.go Project: slashk/os
func mountState(cfg *config.Config) error {
	var err error

	if cfg.State.Dev != "" {
		dev := util.ResolveDevice(cfg.State.Dev)
		if dev == "" {
			msg := fmt.Sprintf("Could not resolve device %q", cfg.State.Dev)
			log.Infof(msg)
			return fmt.Errorf(msg)
		}
		log.Infof("Mounting state device %s to %s", dev, STATE)

		fsType := cfg.State.FsType
		if fsType == "auto" {
			fsType, err = util.GetFsType(dev)
		}

		if err == nil {
			log.Debugf("FsType has been set to %s", fsType)
			err = util.Mount(dev, STATE, fsType, "")
		}
	} else {
		return mountStateTmpfs(cfg)
	}

	return err
}
Example #3
0
File: init.go Project: clhudson2/os
func mountState(cfg *config.CloudConfig) error {
	var err error

	if cfg.Rancher.State.Dev == "" {
		return nil
	}

	dev := util.ResolveDevice(cfg.Rancher.State.Dev)
	if dev == "" {
		return fmt.Errorf("Could not resolve device %q", cfg.Rancher.State.Dev)
	}
	fsType := cfg.Rancher.State.FsType
	if fsType == "auto" {
		fsType, err = util.GetFsType(dev)
	}

	if err != nil {
		return err
	}

	log.Debugf("FsType has been set to %s", fsType)
	log.Infof("Mounting state device %s to %s", dev, STATE)
	return util.Mount(dev, STATE, fsType, "")
}