Browse code

Remove container.EnsureMounted

This was deprecated already and all it did was call Mount().
The use of this was a bit confusing since we need to pair Mount/Unmount
calls which wasn't obvious with "EnsureMounted".

Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)

Alexander Larsson authored on 2013/12/06 20:15:14
Showing 4 changed files
... ...
@@ -488,7 +488,7 @@ func (b *buildFile) CmdAdd(args string) error {
488 488
 	}
489 489
 	b.tmpContainers[container.ID] = struct{}{}
490 490
 
491
-	if err := container.EnsureMounted(); err != nil {
491
+	if err := container.Mount(); err != nil {
492 492
 		return err
493 493
 	}
494 494
 	defer container.Unmount()
... ...
@@ -610,7 +610,7 @@ func (b *buildFile) commit(id string, autoCmd []string, comment string) error {
610 610
 		b.tmpContainers[container.ID] = struct{}{}
611 611
 		fmt.Fprintf(b.outStream, " ---> Running in %s\n", utils.TruncateID(container.ID))
612 612
 		id = container.ID
613
-		if err := container.EnsureMounted(); err != nil {
613
+		if err := container.Mount(); err != nil {
614 614
 			return err
615 615
 		}
616 616
 		defer container.Unmount()
... ...
@@ -200,7 +200,7 @@ func (settings *NetworkSettings) PortMappingAPI() []APIPort {
200 200
 
201 201
 // Inject the io.Reader at the given path. Note: do not close the reader
202 202
 func (container *Container) Inject(file io.Reader, pth string) error {
203
-	if err := container.EnsureMounted(); err != nil {
203
+	if err := container.Mount(); err != nil {
204 204
 		return fmt.Errorf("inject: error mounting container %s: %s", container.ID, err)
205 205
 	}
206 206
 	defer container.Unmount()
... ...
@@ -505,7 +505,7 @@ func (container *Container) Start() (err error) {
505 505
 			container.cleanup()
506 506
 		}
507 507
 	}()
508
-	if err := container.EnsureMounted(); err != nil {
508
+	if err := container.Mount(); err != nil {
509 509
 		return err
510 510
 	}
511 511
 	if container.runtime.networkManager.disabled {
... ...
@@ -1271,7 +1271,7 @@ func (container *Container) Resize(h, w int) error {
1271 1271
 }
1272 1272
 
1273 1273
 func (container *Container) ExportRw() (archive.Archive, error) {
1274
-	if err := container.EnsureMounted(); err != nil {
1274
+	if err := container.Mount(); err != nil {
1275 1275
 		return nil, err
1276 1276
 	}
1277 1277
 	if container.runtime == nil {
... ...
@@ -1283,7 +1283,7 @@ func (container *Container) ExportRw() (archive.Archive, error) {
1283 1283
 }
1284 1284
 
1285 1285
 func (container *Container) Export() (archive.Archive, error) {
1286
-	if err := container.EnsureMounted(); err != nil {
1286
+	if err := container.Mount(); err != nil {
1287 1287
 		return nil, err
1288 1288
 	}
1289 1289
 
... ...
@@ -1309,12 +1309,6 @@ func (container *Container) WaitTimeout(timeout time.Duration) error {
1309 1309
 	}
1310 1310
 }
1311 1311
 
1312
-func (container *Container) EnsureMounted() error {
1313
-	// FIXME: EnsureMounted is deprecated because drivers are now responsible
1314
-	// for re-entrant mounting in their Get() method.
1315
-	return container.Mount()
1316
-}
1317
-
1318 1312
 func (container *Container) Mount() error {
1319 1313
 	return container.runtime.Mount(container)
1320 1314
 }
... ...
@@ -1412,7 +1406,7 @@ func (container *Container) GetSize() (int64, int64) {
1412 1412
 		driver             = container.runtime.driver
1413 1413
 	)
1414 1414
 
1415
-	if err := container.EnsureMounted(); err != nil {
1415
+	if err := container.Mount(); err != nil {
1416 1416
 		utils.Errorf("Warning: failed to compute size of container rootfs %s: %s", container.ID, err)
1417 1417
 		return sizeRw, sizeRootfs
1418 1418
 	}
... ...
@@ -1444,7 +1438,7 @@ func (container *Container) GetSize() (int64, int64) {
1444 1444
 }
1445 1445
 
1446 1446
 func (container *Container) Copy(resource string) (archive.Archive, error) {
1447
-	if err := container.EnsureMounted(); err != nil {
1447
+	if err := container.Mount(); err != nil {
1448 1448
 		return nil, err
1449 1449
 	}
1450 1450
 	var filter []string
... ...
@@ -71,7 +71,7 @@ func containerRun(eng *engine.Engine, id string, t utils.Fataler) {
71 71
 
72 72
 func containerFileExists(eng *engine.Engine, id, dir string, t utils.Fataler) bool {
73 73
 	c := getContainer(eng, id, t)
74
-	if err := c.EnsureMounted(); err != nil {
74
+	if err := c.Mount(); err != nil {
75 75
 		t.Fatal(err)
76 76
 	}
77 77
 	defer c.Unmount()
... ...
@@ -520,7 +520,7 @@ func (runtime *Runtime) Create(config *Config, name string) (*Container, []strin
520 520
 func (runtime *Runtime) Commit(container *Container, repository, tag, comment, author string, config *Config) (*Image, error) {
521 521
 	// FIXME: freeze the container before copying it to avoid data corruption?
522 522
 	// FIXME: this shouldn't be in commands.
523
-	if err := container.EnsureMounted(); err != nil {
523
+	if err := container.Mount(); err != nil {
524 524
 		return nil, err
525 525
 	}
526 526
 	defer container.Unmount()