1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
This commit is contained in:
Solomon Hykes 2013-11-07 23:58:03 +00:00
parent 165d1bdbc0
commit f1127b9308
7 changed files with 28 additions and 31 deletions

View file

@ -1,9 +1,9 @@
package archive
import (
"path/filepath"
"log"
"os"
"path/filepath"
"strings"
)
@ -56,4 +56,3 @@ func ApplyLayer(dest string, layer Archive) error {
}
return nil
}

View file

@ -7,9 +7,9 @@ import (
"flag"
"fmt"
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
"github.com/dotcloud/docker/term"
"github.com/dotcloud/docker/utils"
"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
"github.com/kr/pty"
"io"
"io/ioutil"
@ -26,8 +26,8 @@ import (
)
type Container struct {
root string // Path to the "home" of the container, including metadata.
rootfs string // Path to the root filesystem of the container.
root string // Path to the "home" of the container, including metadata.
rootfs string // Path to the root filesystem of the container.
ID string

View file

@ -23,11 +23,11 @@ var (
)
type DevInfo struct {
Hash string `json:"-"`
DeviceId int `json:"device_id"`
Size uint64 `json:"size"`
TransactionId uint64 `json:"transaction_id"`
Initialized bool `json:"initialized"`
Hash string `json:"-"`
DeviceId int `json:"device_id"`
Size uint64 `json:"size"`
TransactionId uint64 `json:"transaction_id"`
Initialized bool `json:"initialized"`
devices *DeviceSet `json:"-"`
}
@ -48,16 +48,16 @@ type DeviceSet struct {
}
type DiskUsage struct {
Used uint64
Used uint64
Total uint64
}
type Status struct {
PoolName string
DataLoopback string
PoolName string
DataLoopback string
MetadataLoopback string
Data DiskUsage
Metadata DiskUsage
Data DiskUsage
Metadata DiskUsage
}
func getDevName(name string) string {
@ -349,11 +349,11 @@ func (devices *DeviceSet) log(level int, file string, line int, dmError int, mes
utils.Debugf("libdevmapper(%d): %s:%d (%d) %s", level, file, line, dmError, message)
}
func major (device uint64) uint64 {
return (device >> 8) & 0xfff
func major(device uint64) uint64 {
return (device >> 8) & 0xfff
}
func minor (device uint64) uint64 {
func minor(device uint64) uint64 {
return (device & 0xff) | ((device >> 12) & 0xfff00)
}
@ -798,22 +798,22 @@ func (devices *DeviceSet) Status() *Status {
devices.Lock()
defer devices.Unlock()
status := &Status {}
status := &Status{}
if err := devices.ensureInit(); err != nil {
return status
}
status.PoolName = devices.getPoolName()
status.DataLoopback = path.Join( devices.loopbackDir(), "data")
status.MetadataLoopback = path.Join( devices.loopbackDir(), "metadata")
status.DataLoopback = path.Join(devices.loopbackDir(), "data")
status.MetadataLoopback = path.Join(devices.loopbackDir(), "metadata")
_, totalSizeInSectors, _, params, err := getStatus(devices.getPoolName())
if err == nil {
var transactionId, dataUsed, dataTotal, metadataUsed, metadataTotal uint64
if _, err := fmt.Sscanf(params, "%d %d/%d %d/%d", &transactionId, &metadataUsed, &metadataTotal, &dataUsed, &dataTotal); err == nil {
// Convert from blocks to bytes
blockSizeInSectors := totalSizeInSectors / dataTotal;
blockSizeInSectors := totalSizeInSectors / dataTotal
status.Data.Used = dataUsed * blockSizeInSectors * 512
status.Data.Total = dataTotal * blockSizeInSectors * 512

View file

@ -3,8 +3,8 @@ package docker
import (
"fmt"
"github.com/dotcloud/docker/archive"
"github.com/dotcloud/docker/utils"
"github.com/dotcloud/docker/graphdriver"
"github.com/dotcloud/docker/utils"
"io"
"io/ioutil"
"os"
@ -33,7 +33,6 @@ func NewGraph(root string, driver graphdriver.Driver) (*Graph, error) {
return nil, err
}
graph := &Graph{
Root: abspath,
idIndex: utils.NewTruncIndex(),

View file

@ -5,10 +5,10 @@ import (
"container/list"
"database/sql"
"fmt"
"github.com/dotcloud/docker/gograph"
"github.com/dotcloud/docker/utils"
"github.com/dotcloud/docker/graphdriver"
_ "github.com/dotcloud/docker/devmapper"
"github.com/dotcloud/docker/gograph"
"github.com/dotcloud/docker/graphdriver"
"github.com/dotcloud/docker/utils"
"io"
"io/ioutil"
"log"
@ -682,7 +682,6 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
return nil, err
}
runtime := &Runtime{
repository: runtimeRepo,
containers: list.New(),
@ -694,7 +693,7 @@ func NewRuntimeFromDirectory(config *DaemonConfig) (*Runtime, error) {
volumes: volumes,
config: config,
containerGraph: graph,
driver: driver,
driver: driver,
}
if err := runtime.restore(); err != nil {

View file

@ -9,9 +9,9 @@ import (
"github.com/dotcloud/docker/auth"
"github.com/dotcloud/docker/engine"
"github.com/dotcloud/docker/gograph"
"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
"github.com/dotcloud/docker/registry"
"github.com/dotcloud/docker/utils"
"github.com/dotcloud/docker/graphdriver" // FIXME: graphdriver.Change is a placeholder for archive.Change
"io"
"io/ioutil"
"log"

View file

@ -25,10 +25,10 @@ import (
"fmt"
"github.com/dotcloud/docker/namesgenerator"
"github.com/dotcloud/docker/utils"
"strconv"
"io"
"io/ioutil"
"os"
"strconv"
"strings"
"syscall"
)