Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -1,6 +1,8 @@ |
| 1 | 1 |
package daemon |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "errors" |
|
| 5 |
+ "runtime" |
|
| 4 | 6 |
"time" |
| 5 | 7 |
|
| 6 | 8 |
"github.com/docker/docker/pkg/archive" |
| ... | ... |
@@ -14,6 +16,10 @@ func (daemon *Daemon) ContainerChanges(name string) ([]archive.Change, error) {
|
| 14 | 14 |
return nil, err |
| 15 | 15 |
} |
| 16 | 16 |
|
| 17 |
+ if runtime.GOOS == "windows" && container.IsRunning() {
|
|
| 18 |
+ return nil, errors.New("Windows does not support diff of a running container")
|
|
| 19 |
+ } |
|
| 20 |
+ |
|
| 17 | 21 |
container.Lock() |
| 18 | 22 |
defer container.Unlock() |
| 19 | 23 |
c, err := container.RWLayer.Changes() |
| ... | ... |
@@ -366,7 +366,7 @@ func (d *Driver) Diff(id, parent string) (_ io.ReadCloser, err error) {
|
| 366 | 366 |
|
| 367 | 367 |
// Changes produces a list of changes between the specified layer |
| 368 | 368 |
// and its parent layer. If parent is "", then all changes will be ADD changes. |
| 369 |
-// The layer should be mounted when calling this function |
|
| 369 |
+// The layer should not be mounted when calling this function. |
|
| 370 | 370 |
func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
| 371 | 371 |
rID, err := d.resolveID(id) |
| 372 | 372 |
if err != nil {
|
| ... | ... |
@@ -377,13 +377,12 @@ func (d *Driver) Changes(id, parent string) ([]archive.Change, error) {
|
| 377 | 377 |
return nil, err |
| 378 | 378 |
} |
| 379 | 379 |
|
| 380 |
- // this is assuming that the layer is unmounted |
|
| 381 |
- if err := hcsshim.UnprepareLayer(d.info, rID); err != nil {
|
|
| 380 |
+ if err := hcsshim.ActivateLayer(d.info, rID); err != nil {
|
|
| 382 | 381 |
return nil, err |
| 383 | 382 |
} |
| 384 | 383 |
defer func() {
|
| 385 |
- if err := hcsshim.PrepareLayer(d.info, rID, parentChain); err != nil {
|
|
| 386 |
- logrus.Warnf("Failed to Deactivate %s: %s", rID, err)
|
|
| 384 |
+ if err2 := hcsshim.DeactivateLayer(d.info, rID); err2 != nil {
|
|
| 385 |
+ logrus.Errorf("changes() failed to DeactivateLayer %s %s: %s", id, rID, err2)
|
|
| 387 | 386 |
} |
| 388 | 387 |
}() |
| 389 | 388 |
|