Merge pull request #16243 from alexlarsson/volume-create-ignore

Add podman volume create --ignore
This commit is contained in:
OpenShift Merge Robot
2022-10-26 15:00:51 -04:00
committed by GitHub
11 changed files with 80 additions and 18 deletions

View File

@ -19,6 +19,8 @@ type VolumeCreateOptions struct {
Labels map[string]string `schema:"labels"`
// Mapping of driver options and values.
Options map[string]string `schema:"opts"`
// Ignore existing volumes
IgnoreIfExists bool `schema:"ignoreIfExist"`
}
type VolumeConfigResponse struct {

View File

@ -33,6 +33,11 @@ func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.Volum
}
volumeOptions = append(volumeOptions, parsedOptions...)
}
if opts.IgnoreIfExists {
volumeOptions = append(volumeOptions, libpod.WithVolumeIgnoreIfExist())
}
vol, err := ic.Libpod.NewVolume(ctx, volumeOptions...)
if err != nil {
return nil, err