1
0
mirror of https://github.com/rancher/os.git synced 2025-09-05 16:52:20 +00:00

resolve device name using libblkid

This commit is contained in:
sidharthamani
2015-02-11 22:48:32 -08:00
parent 925a847ccc
commit 34b3057909
4 changed files with 27 additions and 9 deletions

View File

@@ -41,6 +41,7 @@ type Config struct {
SystemDockerArgs []string `json:"systemDockerArgs,omitempty"` SystemDockerArgs []string `json:"systemDockerArgs,omitempty"`
UserContainers []ContainerConfig `json:"userContainser,omitempty"` UserContainers []ContainerConfig `json:"userContainser,omitempty"`
UserInit string `json:"userInit,omitempty"` UserInit string `json:"userInit,omitempty"`
DockerBin string `json:"dockerBin,omitempty"`
Modules []string `json:"modules,omitempty"` Modules []string `json:"modules,omitempty"`
Respawn []string `json:"respawn,omitempty"` Respawn []string `json:"respawn,omitempty"`
} }
@@ -70,16 +71,17 @@ func LoadConfig() (*Config, error) {
func NewConfig() *Config { func NewConfig() *Config {
return &Config{ return &Config{
ConsoleContainer: "console", ConsoleContainer: "console",
DockerBin: "/usr/bin/docker",
Debug: true, Debug: true,
DockerEndpoint: "unix:/var/run/docker.sock", DockerEndpoint: "unix:/var/run/docker.sock",
Dns: []string{ Dns: []string{
"8.8.8.8", "8.8.8.8",
"8.8.4.4", "8.8.4.4",
}, },
ImagesPath: "/", ImagesPath: "/",
ImagesPattern: "images*.tar", ImagesPattern: "images*.tar",
StateRequired: false, StateRequired: false,
StateDev: "/dev/sda", StateDev: "LABEL=RANCHER_STATE",
StateDevFSType: "ext4", StateDevFSType: "ext4",
SysInit: "/sbin/init-sys", SysInit: "/sbin/init-sys",
SystemDockerArgs: []string{"docker", "-d", "-s", "overlay", "-b", "none"}, SystemDockerArgs: []string{"docker", "-d", "-s", "overlay", "-b", "none"},

View File

@@ -217,13 +217,13 @@ func mountState(cfg *config.Config) error {
log.Debugf("State will not be persisted") log.Debugf("State will not be persisted")
err = util.Mount("none", STATE, "tmpfs", "") err = util.Mount("none", STATE, "tmpfs", "")
} else { } else {
log.Debugf("Mounting state device %s to %s", cfg.StateDev, STATE) log.Debugf("Mounting state device %s", cfg.StateDev)
err = util.Mount(cfg.StateDev, STATE, cfg.StateDevFSType, "") err = util.Mount(cfg.StateDev, STATE, cfg.StateDevFSType, "")
} }
//if err != nil { if err != nil {
return err return err
//} }
//for _, i := range []string{"docker", "images"} { //for _, i := range []string{"docker", "images"} {
// dir := path.Join(STATE, i) // dir := path.Join(STATE, i)

View File

@@ -5,7 +5,7 @@ set -x
cd $(dirname $0)/.. cd $(dirname $0)/..
apt-get update apt-get update
apt-get install -y curl rsync build-essential syslinux xorriso apt-get install -y curl rsync build-essential syslinux xorriso libblkid-dev
curl -sL https://github.com/ibuildthecloud/docker/releases/download/v1.5.0-rancher-2/docker-1.5.0 > /usr/bin/docker curl -sL https://github.com/ibuildthecloud/docker/releases/download/v1.5.0-rancher-2/docker-1.5.0 > /usr/bin/docker

16
util/cutil.go Normal file
View File

@@ -0,0 +1,16 @@
package util
/*
#cgo LDFLAGS: -lblkid -luuid
#include<blkid/blkid.h>
#include<stdlib.h>
*/
import "C"
import "unsafe"
func ResolveDevice(spec string) string {
cString := C.blkid_evaluate_spec(C.CString(spec), nil)
defer C.free(unsafe.Pointer(cString))
return C.GoString(cString)
}