mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
LCOW: Coherency - ensure windowsfilter driver is not used
Signed-off-by: John Howard <jhoward@microsoft.com>
This commit is contained in:
parent
f8aa70055e
commit
bdabc76a53
1 changed files with 22 additions and 1 deletions
|
@ -153,8 +153,19 @@ func (d *Driver) Status() [][2]string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// panicIfUsedByLcow does exactly what it says.
|
||||||
|
// TODO @jhowardmsft - this is an temporary measure for the bring-up of
|
||||||
|
// Linux containers on Windows. It is a failsafe to ensure that the right
|
||||||
|
// graphdriver is used.
|
||||||
|
func panicIfUsedByLcow() {
|
||||||
|
if system.LCOWSupported() {
|
||||||
|
panic("inconsistency - windowsfilter graphdriver should not be used when in LCOW mode")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Exists returns true if the given id is registered with this driver.
|
// Exists returns true if the given id is registered with this driver.
|
||||||
func (d *Driver) Exists(id string) bool {
|
func (d *Driver) Exists(id string) bool {
|
||||||
|
panicIfUsedByLcow()
|
||||||
rID, err := d.resolveID(id)
|
rID, err := d.resolveID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
|
@ -169,6 +180,7 @@ func (d *Driver) Exists(id string) bool {
|
||||||
// CreateReadWrite creates a layer that is writable for use as a container
|
// CreateReadWrite creates a layer that is writable for use as a container
|
||||||
// file system.
|
// file system.
|
||||||
func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error {
|
func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error {
|
||||||
|
panicIfUsedByLcow()
|
||||||
if opts != nil {
|
if opts != nil {
|
||||||
return d.create(id, parent, opts.MountLabel, false, opts.StorageOpt)
|
return d.create(id, parent, opts.MountLabel, false, opts.StorageOpt)
|
||||||
}
|
}
|
||||||
|
@ -177,6 +189,7 @@ func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts
|
||||||
|
|
||||||
// Create creates a new read-only layer with the given id.
|
// Create creates a new read-only layer with the given id.
|
||||||
func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
|
func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
|
||||||
|
panicIfUsedByLcow()
|
||||||
if opts != nil {
|
if opts != nil {
|
||||||
return d.create(id, parent, opts.MountLabel, true, opts.StorageOpt)
|
return d.create(id, parent, opts.MountLabel, true, opts.StorageOpt)
|
||||||
}
|
}
|
||||||
|
@ -260,6 +273,7 @@ func (d *Driver) dir(id string) string {
|
||||||
|
|
||||||
// Remove unmounts and removes the dir information.
|
// Remove unmounts and removes the dir information.
|
||||||
func (d *Driver) Remove(id string) error {
|
func (d *Driver) Remove(id string) error {
|
||||||
|
panicIfUsedByLcow()
|
||||||
rID, err := d.resolveID(id)
|
rID, err := d.resolveID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -341,6 +355,7 @@ func (d *Driver) Remove(id string) error {
|
||||||
|
|
||||||
// Get returns the rootfs path for the id. This will mount the dir at its given path.
|
// Get returns the rootfs path for the id. This will mount the dir at its given path.
|
||||||
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
|
panicIfUsedByLcow()
|
||||||
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, mountLabel)
|
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, mountLabel)
|
||||||
var dir string
|
var dir string
|
||||||
|
|
||||||
|
@ -399,6 +414,7 @@ func (d *Driver) Get(id, mountLabel string) (string, error) {
|
||||||
|
|
||||||
// Put adds a new layer to the driver.
|
// Put adds a new layer to the driver.
|
||||||
func (d *Driver) Put(id string) error {
|
func (d *Driver) Put(id string) error {
|
||||||
|
panicIfUsedByLcow()
|
||||||
logrus.Debugf("WindowsGraphDriver Put() id %s", id)
|
logrus.Debugf("WindowsGraphDriver Put() id %s", id)
|
||||||
|
|
||||||
rID, err := d.resolveID(id)
|
rID, err := d.resolveID(id)
|
||||||
|
@ -428,7 +444,6 @@ func (d *Driver) Put(id string) error {
|
||||||
// We use this opportunity to cleanup any -removing folders which may be
|
// We use this opportunity to cleanup any -removing folders which may be
|
||||||
// still left if the daemon was killed while it was removing a layer.
|
// still left if the daemon was killed while it was removing a layer.
|
||||||
func (d *Driver) Cleanup() error {
|
func (d *Driver) Cleanup() error {
|
||||||
|
|
||||||
items, err := ioutil.ReadDir(d.info.HomeDir)
|
items, err := ioutil.ReadDir(d.info.HomeDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
|
@ -458,6 +473,7 @@ func (d *Driver) Cleanup() error {
|
||||||
// layer and its parent layer which may be "".
|
// layer and its parent layer which may be "".
|
||||||
// The layer should be mounted when calling this function
|
// The layer should be mounted when calling this function
|
||||||
func (d *Driver) Diff(id, parent string) (_ io.ReadCloser, err error) {
|
func (d *Driver) Diff(id, parent string) (_ io.ReadCloser, err error) {
|
||||||
|
panicIfUsedByLcow()
|
||||||
rID, err := d.resolveID(id)
|
rID, err := d.resolveID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -494,6 +510,7 @@ func (d *Driver) Diff(id, parent string) (_ io.ReadCloser, err error) {
|
||||||
// and its parent layer. If parent is "", then all changes will be ADD changes.
|
// and its parent layer. If parent is "", then all changes will be ADD changes.
|
||||||
// The layer should not be mounted when calling this function.
|
// The layer should not be mounted when calling this function.
|
||||||
func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
||||||
|
panicIfUsedByLcow()
|
||||||
rID, err := d.resolveID(id)
|
rID, err := d.resolveID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -549,6 +566,7 @@ 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 io.Reader) (int64, error) {
|
func (d *Driver) ApplyDiff(id, parent string, diff io.Reader) (int64, error) {
|
||||||
|
panicIfUsedByLcow()
|
||||||
var layerChain []string
|
var layerChain []string
|
||||||
if parent != "" {
|
if parent != "" {
|
||||||
rPId, err := d.resolveID(parent)
|
rPId, err := d.resolveID(parent)
|
||||||
|
@ -583,6 +601,7 @@ func (d *Driver) ApplyDiff(id, parent string, diff io.Reader) (int64, error) {
|
||||||
// and its parent and returns the size in bytes of the changes
|
// and its parent and returns the size in bytes of the changes
|
||||||
// relative to its base filesystem directory.
|
// relative to its base filesystem directory.
|
||||||
func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
|
func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
|
||||||
|
panicIfUsedByLcow()
|
||||||
rPId, err := d.resolveID(parent)
|
rPId, err := d.resolveID(parent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -604,6 +623,7 @@ func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
|
||||||
|
|
||||||
// GetMetadata returns custom driver information.
|
// GetMetadata returns custom driver information.
|
||||||
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
|
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
|
||||||
|
panicIfUsedByLcow()
|
||||||
m := make(map[string]string)
|
m := make(map[string]string)
|
||||||
m["dir"] = d.dir(id)
|
m["dir"] = d.dir(id)
|
||||||
return m, nil
|
return m, nil
|
||||||
|
@ -906,6 +926,7 @@ func (fg *fileGetCloserWithBackupPrivileges) Close() error {
|
||||||
// DiffGetter returns a FileGetCloser that can read files from the directory that
|
// DiffGetter returns a FileGetCloser that can read files from the directory that
|
||||||
// contains files for the layer differences. Used for direct access for tar-split.
|
// contains files for the layer differences. Used for direct access for tar-split.
|
||||||
func (d *Driver) DiffGetter(id string) (graphdriver.FileGetCloser, error) {
|
func (d *Driver) DiffGetter(id string) (graphdriver.FileGetCloser, error) {
|
||||||
|
panicIfUsedByLcow()
|
||||||
id, err := d.resolveID(id)
|
id, err := d.resolveID(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Add table
Reference in a new issue