|
@@ -26,7 +26,6 @@ import (
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/Sirupsen/logrus"
|
|
"github.com/docker/docker/daemon/graphdriver"
|
|
"github.com/docker/docker/daemon/graphdriver"
|
|
"github.com/docker/docker/pkg/archive"
|
|
"github.com/docker/docker/pkg/archive"
|
|
- "github.com/docker/docker/pkg/chrootarchive"
|
|
|
|
"github.com/docker/docker/pkg/idtools"
|
|
"github.com/docker/docker/pkg/idtools"
|
|
"github.com/docker/docker/pkg/ioutils"
|
|
"github.com/docker/docker/pkg/ioutils"
|
|
"github.com/docker/docker/pkg/longpath"
|
|
"github.com/docker/docker/pkg/longpath"
|
|
@@ -35,28 +34,21 @@ import (
|
|
"github.com/vbatts/tar-split/tar/storage"
|
|
"github.com/vbatts/tar-split/tar/storage"
|
|
)
|
|
)
|
|
|
|
|
|
|
|
+// filterDriver is an HCSShim driver type for the Windows Filter driver.
|
|
|
|
+const filterDriver = 1
|
|
|
|
+
|
|
// init registers the windows graph drivers to the register.
|
|
// init registers the windows graph drivers to the register.
|
|
func init() {
|
|
func init() {
|
|
graphdriver.Register("windowsfilter", InitFilter)
|
|
graphdriver.Register("windowsfilter", InitFilter)
|
|
- graphdriver.Register("windowsdiff", InitDiff)
|
|
|
|
reexec.Register("docker-windows-write-layer", writeLayer)
|
|
reexec.Register("docker-windows-write-layer", writeLayer)
|
|
}
|
|
}
|
|
|
|
|
|
-const (
|
|
|
|
- // diffDriver is an hcsshim driver type
|
|
|
|
- diffDriver = iota
|
|
|
|
- // filterDriver is an hcsshim driver type
|
|
|
|
- filterDriver
|
|
|
|
-)
|
|
|
|
-
|
|
|
|
// Driver represents a windows graph driver.
|
|
// Driver represents a windows graph driver.
|
|
type Driver struct {
|
|
type Driver struct {
|
|
// info stores the shim driver information
|
|
// info stores the shim driver information
|
|
info hcsshim.DriverInfo
|
|
info hcsshim.DriverInfo
|
|
}
|
|
}
|
|
|
|
|
|
-var _ graphdriver.DiffGetterDriver = &Driver{}
|
|
|
|
-
|
|
|
|
func isTP5OrOlder() bool {
|
|
func isTP5OrOlder() bool {
|
|
return system.GetOSVersion().Build <= 14300
|
|
return system.GetOSVersion().Build <= 14300
|
|
}
|
|
}
|
|
@@ -73,28 +65,9 @@ func InitFilter(home string, options []string, uidMaps, gidMaps []idtools.IDMap)
|
|
return d, nil
|
|
return d, nil
|
|
}
|
|
}
|
|
|
|
|
|
-// InitDiff returns a new Windows differencing disk driver.
|
|
|
|
-func InitDiff(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (graphdriver.Driver, error) {
|
|
|
|
- logrus.Debugf("WindowsGraphDriver InitDiff at %s", home)
|
|
|
|
- d := &Driver{
|
|
|
|
- info: hcsshim.DriverInfo{
|
|
|
|
- HomeDir: home,
|
|
|
|
- Flavour: diffDriver,
|
|
|
|
- },
|
|
|
|
- }
|
|
|
|
- return d, nil
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// String returns the string representation of a driver.
|
|
// String returns the string representation of a driver.
|
|
func (d *Driver) String() string {
|
|
func (d *Driver) String() string {
|
|
- switch d.info.Flavour {
|
|
|
|
- case diffDriver:
|
|
|
|
- return "windowsdiff"
|
|
|
|
- case filterDriver:
|
|
|
|
- return "windowsfilter"
|
|
|
|
- default:
|
|
|
|
- return "Unknown driver flavour"
|
|
|
|
- }
|
|
|
|
|
|
+ return "Windows filter storage driver"
|
|
}
|
|
}
|
|
|
|
|
|
// Status returns the status of the driver.
|
|
// Status returns the status of the driver.
|
|
@@ -390,20 +363,6 @@ func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
|
// new layer in bytes.
|
|
// new layer in bytes.
|
|
// The layer should not be mounted when calling this function
|
|
// The layer should not be mounted when calling this function
|
|
func (d *Driver) ApplyDiff(id, parent string, diff archive.Reader) (int64, error) {
|
|
func (d *Driver) ApplyDiff(id, parent string, diff archive.Reader) (int64, error) {
|
|
- if d.info.Flavour == diffDriver {
|
|
|
|
- start := time.Now().UTC()
|
|
|
|
- logrus.Debugf("WindowsGraphDriver ApplyDiff: Start untar layer")
|
|
|
|
- destination := d.dir(id)
|
|
|
|
- destination = filepath.Dir(destination)
|
|
|
|
- size, err := chrootarchive.ApplyUncompressedLayer(destination, diff, nil)
|
|
|
|
- if err != nil {
|
|
|
|
- return 0, err
|
|
|
|
- }
|
|
|
|
- logrus.Debugf("WindowsGraphDriver ApplyDiff: Untar time: %vs", time.Now().UTC().Sub(start).Seconds())
|
|
|
|
-
|
|
|
|
- return size, nil
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
var layerChain []string
|
|
var layerChain []string
|
|
if parent != "" {
|
|
if parent != "" {
|
|
rPId, err := d.resolveID(parent)
|
|
rPId, err := d.resolveID(parent)
|