From 7b3e43c1f6cf27a1cde96c0f650a793a56cebc4c Mon Sep 17 00:00:00 2001
From: cdoern <cdoern@redhat.com>
Date: Wed, 1 Jun 2022 16:02:39 -0400
Subject: podman volume create --opt=o=timeout...

add an option to configure the driver timeout when creating a volume.
The default is 5 seconds but this value is too small for some custom drivers.

Signed-off-by: cdoern <cdoern@redhat.com>
---
 pkg/domain/infra/abi/parse/parse.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

(limited to 'pkg')

diff --git a/pkg/domain/infra/abi/parse/parse.go b/pkg/domain/infra/abi/parse/parse.go
index 66794e592..4e8c2e508 100644
--- a/pkg/domain/infra/abi/parse/parse.go
+++ b/pkg/domain/infra/abi/parse/parse.go
@@ -78,6 +78,16 @@ func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error)
 					libpodOptions = append(libpodOptions, libpod.WithVolumeDisableQuota())
 					// set option "NOQUOTA": "true"
 					volumeOptions["NOQUOTA"] = "true"
+				case "timeout":
+					if len(splitO) != 2 {
+						return nil, errors.Wrapf(define.ErrInvalidArg, "timeout option must provide a valid timeout in seconds")
+					}
+					intTimeout, err := strconv.Atoi(splitO[1])
+					if err != nil {
+						return nil, errors.Wrapf(err, "cannot convert Timeout %s to an integer", splitO[1])
+					}
+					logrus.Debugf("Removing timeout from options and adding WithTimeout for Timeout %d", intTimeout)
+					libpodOptions = append(libpodOptions, libpod.WithVolumeDriverTimeout(intTimeout))
 				default:
 					finalVal = append(finalVal, o)
 				}
-- 
cgit v1.2.3-54-g00ecf