mirror of
https://github.com/containers/podman.git
synced 2025-11-02 06:37:09 +08:00
Merge pull request #14501 from cdoern/podUTS
podman pod create --uts support
This commit is contained in:
@ -133,6 +133,12 @@ func MakeContainer(ctx context.Context, rt *libpod.Runtime, s *specgen.SpecGener
|
||||
|
||||
options = append(options, libpod.WithRootFSFromImage(newImage.ID(), resolvedImageName, s.RawImageName))
|
||||
}
|
||||
|
||||
_, err = rt.LookupPod(s.Hostname)
|
||||
if len(s.Hostname) > 0 && !s.UtsNS.IsPrivate() && err == nil {
|
||||
// ok, we are incorrectly setting the pod as the hostname, lets undo that before validation
|
||||
s.Hostname = ""
|
||||
}
|
||||
if err := s.Validate(); err != nil {
|
||||
return nil, nil, nil, errors.Wrap(err, "invalid config provided")
|
||||
}
|
||||
|
||||
@ -176,7 +176,14 @@ func namespaceOptions(s *specgen.SpecGenerator, rt *libpod.Runtime, pod *libpod.
|
||||
if pod == nil || infraCtr == nil {
|
||||
return nil, errNoInfra
|
||||
}
|
||||
toReturn = append(toReturn, libpod.WithUTSNSFrom(infraCtr))
|
||||
if pod.NamespaceMode(spec.UTSNamespace) == host {
|
||||
// adding infra as a nsCtr is not what we want to do when uts == host
|
||||
// this leads the new ctr to try to add an ns path which is should not in this mode
|
||||
logrus.Debug("pod has host uts, not adding infra as a nsCtr")
|
||||
s.UtsNS = specgen.Namespace{NSMode: specgen.Host}
|
||||
} else {
|
||||
toReturn = append(toReturn, libpod.WithUTSNSFrom(infraCtr))
|
||||
}
|
||||
case specgen.FromContainer:
|
||||
utsCtr, err := rt.LookupContainer(s.UtsNS.Value)
|
||||
if err != nil {
|
||||
|
||||
@ -60,6 +60,7 @@ func MakePod(p *entities.PodSpec, rt *libpod.Runtime) (*libpod.Pod, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
spec.Pod = pod.ID()
|
||||
opts = append(opts, rt.WithPod(pod))
|
||||
spec.CgroupParent = pod.CgroupParent()
|
||||
|
||||
Reference in New Issue
Block a user