mirror of https://github.com/containers/podman.git
Split mount options in inspect further
Docker only uses Mode for :z/:Z, so move other options out into a new field. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
parent
4e7e5f5cbd
commit
bcd95f9ddc
|
@ -1,7 +1,6 @@
|
||||||
package libpod
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/libpod/libpod/driver"
|
"github.com/containers/libpod/libpod/driver"
|
||||||
|
@ -68,8 +67,12 @@ type InspectMount struct {
|
||||||
Dst string `json:"Destination"`
|
Dst string `json:"Destination"`
|
||||||
// The driver used for the named volume. Empty for bind mounts.
|
// The driver used for the named volume. Empty for bind mounts.
|
||||||
Driver string `json:"Driver"`
|
Driver string `json:"Driver"`
|
||||||
// Mount options for the driver, excluding RO/RW and mount propagation.
|
// Contains SELinux :z/:Z mount options. Unclear what, if anything, else
|
||||||
|
// goes in here.
|
||||||
Mode string `json:"Mode"`
|
Mode string `json:"Mode"`
|
||||||
|
// All remaining mount options. Additional data, not present in the
|
||||||
|
// original output.
|
||||||
|
Options []string `json:"Options"`
|
||||||
// Whether the volume is read-write
|
// Whether the volume is read-write
|
||||||
RW bool `json:"RW"`
|
RW bool `json:"RW"`
|
||||||
// Mount propagation for the mount. Can be empty if not specified, but
|
// Mount propagation for the mount. Can be empty if not specified, but
|
||||||
|
@ -369,6 +372,7 @@ func (c *Container) getInspectMounts() ([]*InspectMount, error) {
|
||||||
func parseMountOptionsForInspect(options []string, mount *InspectMount) {
|
func parseMountOptionsForInspect(options []string, mount *InspectMount) {
|
||||||
isRW := true
|
isRW := true
|
||||||
mountProp := ""
|
mountProp := ""
|
||||||
|
zZ := ""
|
||||||
otherOpts := []string{}
|
otherOpts := []string{}
|
||||||
|
|
||||||
// Some of these may be overwritten if the user passes us garbage opts
|
// Some of these may be overwritten if the user passes us garbage opts
|
||||||
|
@ -385,6 +389,8 @@ func parseMountOptionsForInspect(options []string, mount *InspectMount) {
|
||||||
// Do nothing, silently discard
|
// Do nothing, silently discard
|
||||||
case "shared", "slave", "private", "rshared", "rslave", "rprivate":
|
case "shared", "slave", "private", "rshared", "rslave", "rprivate":
|
||||||
mountProp = opt
|
mountProp = opt
|
||||||
|
case "z", "Z":
|
||||||
|
zZ = opt
|
||||||
default:
|
default:
|
||||||
otherOpts = append(otherOpts, opt)
|
otherOpts = append(otherOpts, opt)
|
||||||
}
|
}
|
||||||
|
@ -392,5 +398,6 @@ func parseMountOptionsForInspect(options []string, mount *InspectMount) {
|
||||||
|
|
||||||
mount.RW = isRW
|
mount.RW = isRW
|
||||||
mount.Propagation = mountProp
|
mount.Propagation = mountProp
|
||||||
mount.Mode = strings.Join(otherOpts, ",")
|
mount.Mode = zZ
|
||||||
|
mount.Options = otherOpts
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue