|
@@ -3,6 +3,8 @@ package docker
|
|
|
import (
|
|
|
"fmt"
|
|
|
"github.com/dotcloud/docker/archive"
|
|
|
+ _ "github.com/dotcloud/docker/aufs"
|
|
|
+ _ "github.com/dotcloud/docker/devmapper"
|
|
|
"github.com/dotcloud/docker/graphdriver"
|
|
|
"github.com/dotcloud/docker/utils"
|
|
|
"io"
|
|
@@ -18,12 +20,12 @@ import (
|
|
|
type Graph struct {
|
|
|
Root string
|
|
|
idIndex *utils.TruncIndex
|
|
|
- driver graphdriver.Driver
|
|
|
+ driver graphdriver.Driver
|
|
|
}
|
|
|
|
|
|
// NewGraph instantiates a new graph at the given root path in the filesystem.
|
|
|
// `root` will be created if it doesn't exist.
|
|
|
-func NewGraph(root string, driver graphdriver.Driver) (*Graph, error) {
|
|
|
+func NewGraph(root string) (*Graph, error) {
|
|
|
abspath, err := filepath.Abs(root)
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
@@ -32,10 +34,16 @@ func NewGraph(root string, driver graphdriver.Driver) (*Graph, error) {
|
|
|
if err := os.MkdirAll(root, 0700); err != nil && !os.IsExist(err) {
|
|
|
return nil, err
|
|
|
}
|
|
|
+
|
|
|
+ driver, err := graphdriver.New(root)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+
|
|
|
graph := &Graph{
|
|
|
Root: abspath,
|
|
|
idIndex: utils.NewTruncIndex(),
|
|
|
- driver: driver,
|
|
|
+ driver: driver,
|
|
|
}
|
|
|
if err := graph.restore(); err != nil {
|
|
|
return nil, err
|
|
@@ -242,7 +250,7 @@ func (graph *Graph) getDockerInitLayer() (string, error) {
|
|
|
|
|
|
func (graph *Graph) tmp() (*Graph, error) {
|
|
|
// Changed to _tmp from :tmp:, because it messed with ":" separators in aufs branch syntax...
|
|
|
- return NewGraph(path.Join(graph.Root, "_tmp"), graph.driver)
|
|
|
+ return NewGraph(path.Join(graph.Root, "_tmp"))
|
|
|
}
|
|
|
|
|
|
// Check if given error is "not empty".
|