Merge pull request #14852 from rhatdan/relabel

Rename internal field Relabel to Mode
This commit is contained in:
Jessie Frazelle 2015-07-27 10:31:08 -07:00
commit 2f5dc43ca2
3 changed files with 8 additions and 8 deletions

View File

@ -274,6 +274,6 @@ type MountPoint struct {
Source string Source string
Destination string Destination string
Driver string `json:",omitempty"` Driver string `json:",omitempty"`
Mode string // this is internally named `Relabel` Mode string
RW bool RW bool
} }

View File

@ -28,7 +28,7 @@ func (daemon *Daemon) ContainerInspect(name string) (*types.ContainerJSON, error
Source: m.Path(), Source: m.Path(),
Destination: m.Destination, Destination: m.Destination,
Driver: m.Driver, Driver: m.Driver,
Mode: m.Relabel, Mode: m.Mode,
RW: m.RW, RW: m.RW,
}) })
} }

View File

@ -29,7 +29,7 @@ type mountPoint struct {
RW bool RW bool
Volume volume.Volume `json:"-"` Volume volume.Volume `json:"-"`
Source string Source string
Relabel string Mode string `json:"Relabel"` // Originally field was `Relabel`"
} }
func (m *mountPoint) Setup() (string, error) { func (m *mountPoint) Setup() (string, error) {
@ -94,8 +94,8 @@ func parseBindMount(spec string, mountLabel string, config *runconfig.Config) (*
return nil, fmt.Errorf("invalid mode for volumes-from: %s", mode) return nil, fmt.Errorf("invalid mode for volumes-from: %s", mode)
} }
bind.RW = isRw bind.RW = isRw
// Relabel will apply a SELinux label, if necessary // Mode field is used by SELinux to decide whether to apply label
bind.Relabel = mode bind.Mode = mode
default: default:
return nil, fmt.Errorf("Invalid volume specification: %s", spec) return nil, fmt.Errorf("Invalid volume specification: %s", spec)
} }
@ -226,12 +226,12 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc
bind.Volume = v bind.Volume = v
bind.Source = v.Path() bind.Source = v.Path()
// Since this is just a named volume and not a typical bind, set to shared mode `z` // Since this is just a named volume and not a typical bind, set to shared mode `z`
if bind.Relabel == "" { if bind.Mode == "" {
bind.Relabel = "z" bind.Mode = "z"
} }
} }
if err := label.Relabel(bind.Source, container.MountLabel, bind.Relabel); err != nil { if err := label.Relabel(bind.Source, container.MountLabel, bind.Mode); err != nil {
return err return err
} }
binds[bind.Destination] = true binds[bind.Destination] = true