mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-07 14:37:43 +00:00
pkg/specgen/generate: Fix adding host devices on FreeBSD
This was not working when emulating Linux container images on FreeBSD. The code to handle host devices on FreeBSD relies on the container having a devfs mount. Unfortunately, the Linux emulation code which adds this was happening after the host device handling. This changes the logic so that host device management happens after Linux emulation. Signed-off-by: Doug Rabson <dfr@rabson.org>
This commit is contained in:
parent
af91cae1c5
commit
91183a40b4
1 changed files with 22 additions and 22 deletions
|
|
@ -50,28 +50,6 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
|
|||
g.AddAnnotation(key, val)
|
||||
}
|
||||
|
||||
// Devices
|
||||
var userDevices []spec.LinuxDevice
|
||||
if !s.IsPrivileged() {
|
||||
// add default devices from containers.conf
|
||||
for _, device := range rtc.Containers.Devices.Get() {
|
||||
if err = DevicesFromPath(&g, device, rtc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if len(compatibleOptions.HostDeviceList) > 0 && len(s.Devices) == 0 {
|
||||
userDevices = compatibleOptions.HostDeviceList
|
||||
} else {
|
||||
userDevices = s.Devices
|
||||
}
|
||||
// add default devices specified by caller
|
||||
for _, device := range userDevices {
|
||||
if err = DevicesFromPath(&g, device.Path, rtc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
g.ClearProcessEnv()
|
||||
for name, val := range s.Env {
|
||||
g.AddProcessEnv(name, val)
|
||||
|
|
@ -134,6 +112,28 @@ func SpecGenToOCI(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Runt
|
|||
configSpec.Mounts = mounts
|
||||
}
|
||||
|
||||
// Devices
|
||||
var userDevices []spec.LinuxDevice
|
||||
if !s.IsPrivileged() {
|
||||
// add default devices from containers.conf
|
||||
for _, device := range rtc.Containers.Devices.Get() {
|
||||
if err = DevicesFromPath(&g, device, rtc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if len(compatibleOptions.HostDeviceList) > 0 && len(s.Devices) == 0 {
|
||||
userDevices = compatibleOptions.HostDeviceList
|
||||
} else {
|
||||
userDevices = s.Devices
|
||||
}
|
||||
// add default devices specified by caller
|
||||
for _, device := range userDevices {
|
||||
if err = DevicesFromPath(&g, device.Path, rtc); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// BIND MOUNTS
|
||||
configSpec.Mounts = SupersedeUserMounts(mounts, configSpec.Mounts)
|
||||
// Process mounts to ensure correct options
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue