Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -153,8 +153,19 @@ func (d *Driver) Status() [][2]string {
|
| 153 | 153 |
} |
| 154 | 154 |
} |
| 155 | 155 |
|
| 156 |
+// panicIfUsedByLcow does exactly what it says. |
|
| 157 |
+// TODO @jhowardmsft - this is an temporary measure for the bring-up of |
|
| 158 |
+// Linux containers on Windows. It is a failsafe to ensure that the right |
|
| 159 |
+// graphdriver is used. |
|
| 160 |
+func panicIfUsedByLcow() {
|
|
| 161 |
+ if system.LCOWSupported() {
|
|
| 162 |
+ panic("inconsistency - windowsfilter graphdriver should not be used when in LCOW mode")
|
|
| 163 |
+ } |
|
| 164 |
+} |
|
| 165 |
+ |
|
| 156 | 166 |
// Exists returns true if the given id is registered with this driver. |
| 157 | 167 |
func (d *Driver) Exists(id string) bool {
|
| 168 |
+ panicIfUsedByLcow() |
|
| 158 | 169 |
rID, err := d.resolveID(id) |
| 159 | 170 |
if err != nil {
|
| 160 | 171 |
return false |
| ... | ... |
@@ -169,6 +180,7 @@ func (d *Driver) Exists(id string) bool {
|
| 169 | 169 |
// CreateReadWrite creates a layer that is writable for use as a container |
| 170 | 170 |
// file system. |
| 171 | 171 |
func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts) error {
|
| 172 |
+ panicIfUsedByLcow() |
|
| 172 | 173 |
if opts != nil {
|
| 173 | 174 |
return d.create(id, parent, opts.MountLabel, false, opts.StorageOpt) |
| 174 | 175 |
} |
| ... | ... |
@@ -177,6 +189,7 @@ func (d *Driver) CreateReadWrite(id, parent string, opts *graphdriver.CreateOpts |
| 177 | 177 |
|
| 178 | 178 |
// Create creates a new read-only layer with the given id. |
| 179 | 179 |
func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) error {
|
| 180 |
+ panicIfUsedByLcow() |
|
| 180 | 181 |
if opts != nil {
|
| 181 | 182 |
return d.create(id, parent, opts.MountLabel, true, opts.StorageOpt) |
| 182 | 183 |
} |
| ... | ... |
@@ -260,6 +273,7 @@ func (d *Driver) dir(id string) string {
|
| 260 | 260 |
|
| 261 | 261 |
// Remove unmounts and removes the dir information. |
| 262 | 262 |
func (d *Driver) Remove(id string) error {
|
| 263 |
+ panicIfUsedByLcow() |
|
| 263 | 264 |
rID, err := d.resolveID(id) |
| 264 | 265 |
if err != nil {
|
| 265 | 266 |
return err |
| ... | ... |
@@ -341,6 +355,7 @@ func (d *Driver) Remove(id string) error {
|
| 341 | 341 |
|
| 342 | 342 |
// Get returns the rootfs path for the id. This will mount the dir at its given path. |
| 343 | 343 |
func (d *Driver) Get(id, mountLabel string) (string, error) {
|
| 344 |
+ panicIfUsedByLcow() |
|
| 344 | 345 |
logrus.Debugf("WindowsGraphDriver Get() id %s mountLabel %s", id, mountLabel)
|
| 345 | 346 |
var dir string |
| 346 | 347 |
|
| ... | ... |
@@ -399,6 +414,7 @@ func (d *Driver) Get(id, mountLabel string) (string, error) {
|
| 399 | 399 |
|
| 400 | 400 |
// Put adds a new layer to the driver. |
| 401 | 401 |
func (d *Driver) Put(id string) error {
|
| 402 |
+ panicIfUsedByLcow() |
|
| 402 | 403 |
logrus.Debugf("WindowsGraphDriver Put() id %s", id)
|
| 403 | 404 |
|
| 404 | 405 |
rID, err := d.resolveID(id) |
| ... | ... |
@@ -428,7 +444,6 @@ func (d *Driver) Put(id string) error {
|
| 428 | 428 |
// We use this opportunity to cleanup any -removing folders which may be |
| 429 | 429 |
// still left if the daemon was killed while it was removing a layer. |
| 430 | 430 |
func (d *Driver) Cleanup() error {
|
| 431 |
- |
|
| 432 | 431 |
items, err := ioutil.ReadDir(d.info.HomeDir) |
| 433 | 432 |
if err != nil {
|
| 434 | 433 |
if os.IsNotExist(err) {
|
| ... | ... |
@@ -458,6 +473,7 @@ func (d *Driver) Cleanup() error {
|
| 458 | 458 |
// layer and its parent layer which may be "". |
| 459 | 459 |
// The layer should be mounted when calling this function |
| 460 | 460 |
func (d *Driver) Diff(id, parent string) (_ io.ReadCloser, err error) {
|
| 461 |
+ panicIfUsedByLcow() |
|
| 461 | 462 |
rID, err := d.resolveID(id) |
| 462 | 463 |
if err != nil {
|
| 463 | 464 |
return |
| ... | ... |
@@ -494,6 +510,7 @@ func (d *Driver) Diff(id, parent string) (_ io.ReadCloser, err error) {
|
| 494 | 494 |
// and its parent layer. If parent is "", then all changes will be ADD changes. |
| 495 | 495 |
// The layer should not be mounted when calling this function. |
| 496 | 496 |
func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
| 497 |
+ panicIfUsedByLcow() |
|
| 497 | 498 |
rID, err := d.resolveID(id) |
| 498 | 499 |
if err != nil {
|
| 499 | 500 |
return nil, err |
| ... | ... |
@@ -549,6 +566,7 @@ func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
| 549 | 549 |
// new layer in bytes. |
| 550 | 550 |
// The layer should not be mounted when calling this function |
| 551 | 551 |
func (d *Driver) ApplyDiff(id, parent string, diff io.Reader) (int64, error) {
|
| 552 |
+ panicIfUsedByLcow() |
|
| 552 | 553 |
var layerChain []string |
| 553 | 554 |
if parent != "" {
|
| 554 | 555 |
rPId, err := d.resolveID(parent) |
| ... | ... |
@@ -583,6 +601,7 @@ func (d *Driver) ApplyDiff(id, parent string, diff io.Reader) (int64, error) {
|
| 583 | 583 |
// and its parent and returns the size in bytes of the changes |
| 584 | 584 |
// relative to its base filesystem directory. |
| 585 | 585 |
func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
|
| 586 |
+ panicIfUsedByLcow() |
|
| 586 | 587 |
rPId, err := d.resolveID(parent) |
| 587 | 588 |
if err != nil {
|
| 588 | 589 |
return |
| ... | ... |
@@ -604,6 +623,7 @@ func (d *Driver) DiffSize(id, parent string) (size int64, err error) {
|
| 604 | 604 |
|
| 605 | 605 |
// GetMetadata returns custom driver information. |
| 606 | 606 |
func (d *Driver) GetMetadata(id string) (map[string]string, error) {
|
| 607 |
+ panicIfUsedByLcow() |
|
| 607 | 608 |
m := make(map[string]string) |
| 608 | 609 |
m["dir"] = d.dir(id) |
| 609 | 610 |
return m, nil |
| ... | ... |
@@ -906,6 +926,7 @@ func (fg *fileGetCloserWithBackupPrivileges) Close() error {
|
| 906 | 906 |
// DiffGetter returns a FileGetCloser that can read files from the directory that |
| 907 | 907 |
// contains files for the layer differences. Used for direct access for tar-split. |
| 908 | 908 |
func (d *Driver) DiffGetter(id string) (graphdriver.FileGetCloser, error) {
|
| 909 |
+ panicIfUsedByLcow() |
|
| 909 | 910 |
id, err := d.resolveID(id) |
| 910 | 911 |
if err != nil {
|
| 911 | 912 |
return nil, err |