mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #19876 from rhatdan/mqueue
Make mqueue container specific
This commit is contained in:
commit
e6573a5d18
3 changed files with 8 additions and 36 deletions
|
@ -559,18 +559,6 @@ func (container *Container) UnmountIpcMounts(unmount func(pth string) error) {
|
|||
}
|
||||
}
|
||||
|
||||
if !container.HasMountFor("/dev/mqueue") {
|
||||
mqueuePath, err := container.MqueueResourcePath()
|
||||
if err != nil {
|
||||
logrus.Error(err)
|
||||
warnings = append(warnings, err.Error())
|
||||
} else if mqueuePath != "" {
|
||||
if err := unmount(mqueuePath); err != nil {
|
||||
warnings = append(warnings, fmt.Sprintf("failed to umount %s: %v", mqueuePath, err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(warnings) > 0 {
|
||||
logrus.Warnf("failed to cleanup ipc mounts:\n%v", strings.Join(warnings, "\n"))
|
||||
}
|
||||
|
@ -589,9 +577,8 @@ func (container *Container) IpcMounts() []execdriver.Mount {
|
|||
Propagation: volume.DefaultPropagationMode,
|
||||
})
|
||||
}
|
||||
|
||||
if !container.HasMountFor("/dev/mqueue") {
|
||||
label.SetFileLabel(container.MqueuePath, container.MountLabel)
|
||||
if !container.HasMountFor("/dev/mqueue") &&
|
||||
container.MqueuePath != "" {
|
||||
mounts = append(mounts, execdriver.Mount{
|
||||
Source: container.MqueuePath,
|
||||
Destination: "/dev/mqueue",
|
||||
|
|
|
@ -93,11 +93,6 @@ func (daemon *Daemon) populateCommand(c *container.Container, env []string) erro
|
|||
return err
|
||||
}
|
||||
|
||||
c.MqueuePath, err = c.MqueueResourcePath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if c.HostConfig.IpcMode.IsContainer() {
|
||||
ic, err := daemon.getIpcContainer(c)
|
||||
if err != nil {
|
||||
|
@ -105,7 +100,6 @@ func (daemon *Daemon) populateCommand(c *container.Container, env []string) erro
|
|||
}
|
||||
ipc.ContainerID = ic.ID
|
||||
c.ShmPath = ic.ShmPath
|
||||
c.MqueuePath = ic.MqueuePath
|
||||
} else {
|
||||
ipc.HostIpc = c.HostConfig.IpcMode.IsHost()
|
||||
if ipc.HostIpc {
|
||||
|
@ -1062,21 +1056,6 @@ func (daemon *Daemon) setupIpcDirs(c *container.Container) error {
|
|||
}
|
||||
}
|
||||
|
||||
if !c.HasMountFor("/dev/mqueue") {
|
||||
mqueuePath, err := c.MqueueResourcePath()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := idtools.MkdirAllAs(mqueuePath, 0700, rootUID, rootGID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := syscall.Mount("mqueue", mqueuePath, "mqueue", uintptr(syscall.MS_NOEXEC|syscall.MS_NOSUID|syscall.MS_NODEV), ""); err != nil {
|
||||
return fmt.Errorf("mounting mqueue mqueue : %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,12 @@ func New() *configs.Config {
|
|||
Flags: syscall.MS_NOSUID | syscall.MS_NOEXEC,
|
||||
Data: "newinstance,ptmxmode=0666,mode=0620,gid=5",
|
||||
},
|
||||
{
|
||||
Source: "mqueue",
|
||||
Destination: "/dev/mqueue",
|
||||
Device: "mqueue",
|
||||
Flags: defaultMountFlags,
|
||||
},
|
||||
{
|
||||
Source: "sysfs",
|
||||
Destination: "/sys",
|
||||
|
|
Loading…
Reference in a new issue