Skip to content

Commit

Permalink
Merge pull request moby#14709 from rhvgoyal/base-size-100G
Browse files Browse the repository at this point in the history
devicemapper: Change default basesize to 100G

Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: rhatdan)
  • Loading branch information
cpuguy83 authored and rhatdan committed Jul 17, 2015
2 parents fb34537 + 424d5e5 commit 09901ba
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 1 deletion.
2 changes: 2 additions & 0 deletions daemon/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ func (container *Container) cleanup() {
}

container.UnmountVolumes(false)
container.terminateMachine()
}

func (container *Container) KillSig(sig int) error {
Expand Down Expand Up @@ -782,6 +783,7 @@ func (container *Container) waitForStart() error {
return err
}

container.registerMachine()
return nil
}

Expand Down
15 changes: 15 additions & 0 deletions daemon/container_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/docker/docker/pkg/archive"
"github.com/docker/docker/pkg/directory"
"github.com/docker/docker/pkg/ioutils"
"github.com/docker/docker/pkg/machine"
"github.com/docker/docker/pkg/nat"
"github.com/docker/docker/pkg/stringid"
"github.com/docker/docker/pkg/system"
Expand Down Expand Up @@ -1120,3 +1121,17 @@ func (container *Container) PrepareStorage() error {
func (container *Container) CleanupStorage() error {
return nil
}

/*
Register Machine with process manager. There is a potential race condition here
where the container could have exited before the call gets made. This
call requires the container.Pid. Therefore we just log the situation
rather then fail the container
*/
func (container *Container) registerMachine() {
return machine.Register(container.Name[1:], container.ID, container.Pid, "/")
}

func (container *Container) terminateMachine() {
machine.Terminate(container.Name[1:])
}
4 changes: 4 additions & 0 deletions daemon/container_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,7 @@ func (container *Container) CleanupStorage() error {
}
return nil
}

func (container *Container) registerMachine() {
return nil
}
2 changes: 1 addition & 1 deletion daemon/graphdriver/devmapper/deviceset.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
var (
DefaultDataLoopbackSize int64 = 100 * 1024 * 1024 * 1024
DefaultMetaDataLoopbackSize int64 = 2 * 1024 * 1024 * 1024
DefaultBaseFsSize uint64 = 10 * 1024 * 1024 * 1024
DefaultBaseFsSize uint64 = 100 * 1024 * 1024 * 1024
DefaultThinpBlockSize uint32 = 128 // 64K = 128 512b sectors
DefaultUdevSyncOverride bool = false
MaxDeviceId int = 0xffffff // 24 bit, pool limit
Expand Down
10 changes: 10 additions & 0 deletions pkg/machine/machine.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// +build windows

package machine

func Register(name string, id string, pid int, root_directory string) error {
return nil
}

func Terminate(name string) {
}
31 changes: 31 additions & 0 deletions pkg/machine/sytemd.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// +build !windows

package machine

import (
"strings"

"github.com/Sirupsen/logrus"
"github.com/docker/docker/pkg/systemd"
)

/*
Register Machine with systemd. There is a potential race condition here
where the container could have exited before the call gets made. This
call requires the container.Pid.
*/
func Register(name string, id string, pid int, root_directory string) error {
err := systemd.RegisterMachine(name, id, pid, root_directory)
if err != nil {
if strings.Contains(err.Error(), "Failed to determine unit of process") {
return nil
}
logrus.Errorf("Unable to RegisterMachine %s for %s: %s", name, id, err)
return err
}
return nil
}

func Terminate(name string) {
systemd.TerminateMachine(name)
}
56 changes: 56 additions & 0 deletions pkg/systemd/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// +build linux

package systemd

import (
"encoding/hex"
"github.com/godbus/dbus"
)

var conn *dbus.Conn

// RegisterMachine with systemd on the host system
func RegisterMachine(name string, id string, pid int, root_directory string) error {
var (
av []byte
err error
)
if !SdBooted() {
return nil
}

if conn == nil {
conn, err = dbus.SystemBus()
if err != nil {
return (err)
}
}

av, err = hex.DecodeString(id[0:32])
if err != nil {
return err
}

obj := conn.Object("org.freedesktop.machine1", "/org/freedesktop/machine1")
return obj.Call("org.freedesktop.machine1.Manager.RegisterMachine", 0, name, av, "docker", "container", uint32(pid), root_directory).Err
}

// TerminateMachine registered with systemd on the host system
func TerminateMachine(name string) error {
var (
err error
)
if !SdBooted() {
return nil
}

if conn == nil {
conn, err = dbus.SystemBus()
if err != nil {
return (err)
}
}

obj := conn.Object("org.freedesktop.machine1", "/org/freedesktop/machine1")
return obj.Call("org.freedesktop.machine1.Manager.TerminateMachine", 0, name).Err
}

0 comments on commit 09901ba

Please sign in to comment.