diff options
author | openshift-ci[bot] <75433959+openshift-ci[bot]@users.noreply.github.com> | 2022-06-27 17:55:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-27 17:55:19 +0000 |
commit | 9c4b8a29b06c179725983e7fa8fadf7ee68d9863 (patch) | |
tree | cd2aa0d35a9479aa8f4afc0f17b941b5fb9c5882 /test/testvol/util.go | |
parent | 278afae1de55a2951b2a4810b100d14e5647977b (diff) | |
parent | 2fab7d169b0714574b6620f454c1408bf8097d4f (diff) | |
download | podman-9c4b8a29b06c179725983e7fa8fadf7ee68d9863.tar.gz podman-9c4b8a29b06c179725983e7fa8fadf7ee68d9863.tar.bz2 podman-9c4b8a29b06c179725983e7fa8fadf7ee68d9863.zip |
Merge pull request #14713 from Luap99/volume-plugin
add podman volume reload to sync volume plugins
Diffstat (limited to 'test/testvol/util.go')
-rw-r--r-- | test/testvol/util.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/testvol/util.go b/test/testvol/util.go new file mode 100644 index 000000000..7a0aeba86 --- /dev/null +++ b/test/testvol/util.go @@ -0,0 +1,29 @@ +package main + +import ( + "path/filepath" + "strings" + + "github.com/containers/podman/v4/libpod/plugin" +) + +const pluginSockDir = "/run/docker/plugins" + +func getSocketPath(pathOrName string) string { + if filepath.IsAbs(pathOrName) { + return pathOrName + } + + // only a name join it with the default path + return filepath.Join(pluginSockDir, pathOrName+".sock") +} + +func getPluginName(pathOrName string) string { + return strings.TrimSuffix(filepath.Base(pathOrName), ".sock") +} + +func getPlugin(sockNameOrPath string) (*plugin.VolumePlugin, error) { + path := getSocketPath(sockNameOrPath) + name := getPluginName(sockNameOrPath) + return plugin.GetVolumePlugin(name, path) +} |