aboutsummaryrefslogtreecommitdiff
path: root/libpod/plugin
diff options
context:
space:
mode:
authoropenshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com>2022-07-01 08:46:11 +0000
committerGitHub <noreply@github.com>2022-07-01 08:46:11 +0000
commit96e72d90b8a6b1d9fb71dadfddff1ed4ccf05857 (patch)
treecf1617923f618ae0bf1819486f4f425310245db8 /libpod/plugin
parent01beba3667851c1dd68d3df1e0aa6bc8cb1ec0eb (diff)
parent7b3e43c1f6cf27a1cde96c0f650a793a56cebc4c (diff)
downloadpodman-96e72d90b8a6b1d9fb71dadfddff1ed4ccf05857.tar.gz
podman-96e72d90b8a6b1d9fb71dadfddff1ed4ccf05857.tar.bz2
podman-96e72d90b8a6b1d9fb71dadfddff1ed4ccf05857.zip
Merge pull request #14449 from cdoern/podVolumes
podman volume create --opt=o=timeout...
Diffstat (limited to 'libpod/plugin')
-rw-r--r--libpod/plugin/volume_api.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/libpod/plugin/volume_api.go b/libpod/plugin/volume_api.go
index 2de7db32c..332ab912b 100644
--- a/libpod/plugin/volume_api.go
+++ b/libpod/plugin/volume_api.go
@@ -127,7 +127,7 @@ func validatePlugin(newPlugin *VolumePlugin) error {
// GetVolumePlugin gets a single volume plugin, with the given name, at the
// given path.
-func GetVolumePlugin(name string, path string) (*VolumePlugin, error) {
+func GetVolumePlugin(name string, path string, timeout int) (*VolumePlugin, error) {
pluginsLock.Lock()
defer pluginsLock.Unlock()
@@ -151,6 +151,13 @@ func GetVolumePlugin(name string, path string) (*VolumePlugin, error) {
// And since we can reuse it, might as well cache it.
client := new(http.Client)
client.Timeout = defaultTimeout
+ // if the user specified a non-zero timeout, use their value. Else, keep the default.
+ if timeout != 0 {
+ if time.Duration(timeout)*time.Second < defaultTimeout {
+ logrus.Warnf("the default timeout for volume creation is %d seconds, setting a time less than that may break this feature.", defaultTimeout)
+ }
+ client.Timeout = time.Duration(timeout) * time.Second
+ }
// This bit borrowed from pkg/bindings/connection.go
client.Transport = &http.Transport{
DialContext: func(ctx context.Context, _, _ string) (net.Conn, error) {