summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-09-15 09:10:12 -0400
committerGitHub <noreply@github.com>2021-09-15 09:10:12 -0400
commit4b6ffda31c258aadcbc6171a7dd745d0fb17393c (patch)
treeb05003f91e2f1fd73dd1cd945241d3d7188d2b5f /cmd
parent4dd7bfdfaa3adf95af39fd45f74d49cea0c80064 (diff)
parent84005330aa3d25cf6134fffc1bf20354d4a3dd85 (diff)
downloadpodman-4b6ffda31c258aadcbc6171a7dd745d0fb17393c.tar.gz
podman-4b6ffda31c258aadcbc6171a7dd745d0fb17393c.tar.bz2
podman-4b6ffda31c258aadcbc6171a7dd745d0fb17393c.zip
Merge pull request #11409 from cdoern/podVolumes
Pod Volumes Support
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/common/create.go24
-rw-r--r--cmd/podman/pods/create.go21
2 files changed, 27 insertions, 18 deletions
diff --git a/cmd/podman/common/create.go b/cmd/podman/common/create.go
index 325c1dc69..6200592b4 100644
--- a/cmd/podman/common/create.go
+++ b/cmd/podman/common/create.go
@@ -660,18 +660,6 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
)
_ = cmd.RegisterFlagCompletionFunc(mountFlagName, AutocompleteMountFlag)
- volumeDesciption := "Bind mount a volume into the container"
- if registry.IsRemote() {
- volumeDesciption = "Bind mount a volume into the container. Volume src will be on the server machine, not the client"
- }
- volumeFlagName := "volume"
- createFlags.StringArrayVarP(
- &cf.Volume,
- volumeFlagName, "v", volumes(),
- volumeDesciption,
- )
- _ = cmd.RegisterFlagCompletionFunc(volumeFlagName, AutocompleteVolumeFlag)
-
volumesFromFlagName := "volumes-from"
createFlags.StringArrayVar(
&cf.VolumesFrom,
@@ -865,4 +853,16 @@ func DefineCreateFlags(cmd *cobra.Command, cf *entities.ContainerCreateOptions,
"PID namespace to use",
)
_ = cmd.RegisterFlagCompletionFunc(pidFlagName, AutocompleteNamespace)
+
+ volumeDesciption := "Bind mount a volume into the container"
+ if registry.IsRemote() {
+ volumeDesciption = "Bind mount a volume into the container. Volume source will be on the server machine, not the client"
+ }
+ volumeFlagName := "volume"
+ createFlags.StringArrayVarP(
+ &cf.Volume,
+ volumeFlagName, "v", volumes(),
+ volumeDesciption,
+ )
+ _ = cmd.RegisterFlagCompletionFunc(volumeFlagName, AutocompleteVolumeFlag)
}
diff --git a/cmd/podman/pods/create.go b/cmd/podman/pods/create.go
index b3f84dcd8..7000c92c8 100644
--- a/cmd/podman/pods/create.go
+++ b/cmd/podman/pods/create.go
@@ -132,12 +132,7 @@ func create(cmd *cobra.Command, args []string) error {
createOptions.Share = nil
} else {
// reassign certain optios for lbpod api, these need to be populated in spec
- createOptions.InfraConmonPidFile = infraOptions.ConmonPIDFile
- createOptions.InfraName = infraOptions.Name
- createOptions.Hostname = infraOptions.Hostname
- createOptions.Cpus = infraOptions.CPUS
- createOptions.CpusetCpus = infraOptions.CPUSetCPUs
- createOptions.Pid = infraOptions.PID
+ MapOptions()
flags := cmd.Flags()
infraOptions.Net, err = common.NetFlagsToNetOptions(nil, *flags, false)
if err != nil {
@@ -265,6 +260,10 @@ func create(cmd *cobra.Command, args []string) error {
if err != nil {
return err
}
+ podSpec.Volumes = podSpec.InfraContainerSpec.Volumes
+ podSpec.ImageVolumes = podSpec.InfraContainerSpec.ImageVolumes
+ podSpec.OverlayVolumes = podSpec.InfraContainerSpec.OverlayVolumes
+ podSpec.Mounts = podSpec.InfraContainerSpec.Mounts
}
PodSpec := entities.PodSpec{PodSpecGen: *podSpec}
response, err := registry.ContainerEngine().PodCreate(context.Background(), PodSpec)
@@ -291,3 +290,13 @@ func replacePod(name string) error {
}
return removePods([]string{name}, rmOptions, false)
}
+
+func MapOptions() {
+ createOptions.Cpus = infraOptions.CPUS
+ createOptions.CpusetCpus = infraOptions.CPUSetCPUs
+ createOptions.Hostname = infraOptions.Hostname
+ createOptions.InfraConmonPidFile = infraOptions.ConmonPIDFile
+ createOptions.InfraName = infraOptions.Name
+ createOptions.Pid = infraOptions.PID
+ createOptions.Volume = infraOptions.Volume
+}