2015-02-01 11:56:27 +08:00
|
|
|
package configs
|
2014-08-27 16:51:52 +08:00
|
|
|
|
2016-05-27 03:35:12 +08:00
|
|
|
const (
|
|
|
|
// EXT_COPYUP is a directive to copy up the contents of a directory when
|
|
|
|
// a tmpfs is mounted over it.
|
|
|
|
EXT_COPYUP = 1 << iota
|
|
|
|
)
|
|
|
|
|
2014-08-27 16:51:52 +08:00
|
|
|
type Mount struct {
|
2015-02-13 08:23:05 +08:00
|
|
|
// Source path for the mount.
|
|
|
|
Source string `json:"source"`
|
|
|
|
|
|
|
|
// Destination path for the mount inside the container.
|
|
|
|
Destination string `json:"destination"`
|
|
|
|
|
|
|
|
// Device the mount is for.
|
|
|
|
Device string `json:"device"`
|
|
|
|
|
|
|
|
// Mount flags.
|
|
|
|
Flags int `json:"flags"`
|
|
|
|
|
libcontainer: Allow passing mount propagation flags
Right now if one passes a mount propagation flag in spec file, it
does not take effect. For example, try following in spec json file.
{
"type": "bind",
"source": "/root/mnt-source",
"destination": "/root/mnt-dest",
"options": "rbind,shared"
}
One would expect that /root/mnt-dest will be shared inside the container
but that's not the case.
#findmnt -o TARGET,PROPAGATION
`-/root/mnt-dest private
Reason being that propagation flags can't be passed in along with other
regular flags. They need to be passed in a separate call to mount syscall.
That too, one propagation flag at a time. (from mount man page).
Hence, store propagation flags separately in a slice and apply these
in that order after the mount call wherever appropriate. This allows
user to control the propagation property of mount point inside
the container.
Storing them separately also solves another problem where recursive flag
(syscall.MS_REC) can get mixed up. For example, options "rbind,private"
and "bind,rprivate" will be same and there will be no way to differentiate
between these if all the flags are stored in a single integer.
This patch would allow one to pass propagation flags "[r]shared,[r]slave,
[r]private,[r]unbindable" in spec file as per mount property.
Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2015-09-17 03:53:23 +08:00
|
|
|
// Propagation Flags
|
|
|
|
PropagationFlags []int `json:"propagation_flags"`
|
|
|
|
|
2015-02-13 08:23:05 +08:00
|
|
|
// Mount data applied to the mount.
|
|
|
|
Data string `json:"data"`
|
|
|
|
|
|
|
|
// Relabel source if set, "z" indicates shared, "Z" indicates unshared.
|
|
|
|
Relabel string `json:"relabel"`
|
2015-04-02 20:31:47 +08:00
|
|
|
|
2016-05-27 03:35:12 +08:00
|
|
|
// Extensions are additional flags that are specific to runc.
|
|
|
|
Extensions int `json:"extensions"`
|
|
|
|
|
2015-04-02 20:31:47 +08:00
|
|
|
// Optional Command to be run before Source is mounted.
|
|
|
|
PremountCmds []Command `json:"premount_cmds"`
|
|
|
|
|
|
|
|
// Optional Command to be run after Source is mounted.
|
|
|
|
PostmountCmds []Command `json:"postmount_cmds"`
|
|
|
|
}
|