Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard authored on 2016/03/19 12:09:54... | ... |
@@ -310,25 +310,24 @@ func setupDaemonRoot(config *Config, rootDir string, rootUID, rootGID int) error |
310 | 310 |
return nil |
311 | 311 |
} |
312 | 312 |
|
313 |
-// conditionalMountOnStart is a platform specific helper function during the |
|
314 |
-// container start to call mount. |
|
315 |
-func (daemon *Daemon) conditionalMountOnStart(container *container.Container) error { |
|
316 |
- |
|
317 |
- // Are we going to run as a Hyper-V container? |
|
318 |
- hv := false |
|
313 |
+// runasHyperVContainer returns true if we are going to run as a Hyper-V container |
|
314 |
+func (daemon *Daemon) runAsHyperVContainer(container *container.Container) bool { |
|
319 | 315 |
if container.HostConfig.Isolation.IsDefault() { |
320 | 316 |
// Container is set to use the default, so take the default from the daemon configuration |
321 |
- hv = daemon.defaultIsolation.IsHyperV() |
|
322 |
- } else { |
|
323 |
- // Container is requesting an isolation mode. Honour it. |
|
324 |
- hv = container.HostConfig.Isolation.IsHyperV() |
|
317 |
+ return daemon.defaultIsolation.IsHyperV() |
|
325 | 318 |
} |
326 | 319 |
|
320 |
+ // Container is requesting an isolation mode. Honour it. |
|
321 |
+ return container.HostConfig.Isolation.IsHyperV() |
|
322 |
+ |
|
323 |
+} |
|
324 |
+ |
|
325 |
+// conditionalMountOnStart is a platform specific helper function during the |
|
326 |
+// container start to call mount. |
|
327 |
+func (daemon *Daemon) conditionalMountOnStart(container *container.Container) error { |
|
327 | 328 |
// We do not mount if a Hyper-V container |
328 |
- if !hv { |
|
329 |
- if err := daemon.Mount(container); err != nil { |
|
330 |
- return err |
|
331 |
- } |
|
329 |
+ if !daemon.runAsHyperVContainer(container) { |
|
330 |
+ return daemon.Mount(container) |
|
332 | 331 |
} |
333 | 332 |
return nil |
334 | 333 |
} |
... | ... |
@@ -337,7 +336,7 @@ func (daemon *Daemon) conditionalMountOnStart(container *container.Container) er |
337 | 337 |
// during the cleanup of a container to unmount. |
338 | 338 |
func (daemon *Daemon) conditionalUnmountOnCleanup(container *container.Container) error { |
339 | 339 |
// We do not unmount if a Hyper-V container |
340 |
- if !container.HostConfig.Isolation.IsHyperV() { |
|
340 |
+ if !daemon.runAsHyperVContainer(container) { |
|
341 | 341 |
return daemon.Unmount(container) |
342 | 342 |
} |
343 | 343 |
return nil |