8
"github.com/containers/podman/v5/libpod/define"
9
pluginapi "github.com/docker/go-plugins-helpers/volume"
10
"github.com/sirupsen/logrus"
13
// Inspect provides detailed information about the configuration of the given
15
func (v *Volume) Inspect() (*define.InspectVolumeData, error) {
17
return nil, define.ErrVolumeRemoved
23
if err := v.update(); err != nil {
27
data := new(define.InspectVolumeData)
29
data.Mountpoint = v.config.MountPoint
30
if v.UsesVolumeDriver() {
31
logrus.Debugf("Querying volume plugin %s for status", v.config.Driver)
32
data.Mountpoint = v.state.MountPoint
35
return nil, fmt.Errorf("volume %s uses volume plugin %s but it is not available, cannot inspect: %w", v.Name(), v.config.Driver, define.ErrMissingPlugin)
38
// Retrieve status for the volume.
39
// Need to query the volume driver.
40
req := new(pluginapi.GetRequest)
42
resp, err := v.plugin.GetVolume(req)
44
return nil, fmt.Errorf("retrieving volume %s information from plugin %s: %w", v.Name(), v.Driver(), err)
47
data.Status = resp.Status
51
data.Name = v.config.Name
52
data.Driver = v.config.Driver
53
data.CreatedAt = v.config.CreatedTime
54
data.Labels = make(map[string]string)
55
for k, v := range v.config.Labels {
58
data.Scope = v.Scope()
59
data.Options = make(map[string]string)
60
for k, v := range v.config.Options {
65
data.Anonymous = v.config.IsAnon
66
data.MountCount = v.state.MountCount
67
data.NeedsCopyUp = v.state.NeedsCopyUp
68
data.NeedsChown = v.state.NeedsChown
69
data.StorageID = v.config.StorageID
70
data.LockNumber = v.lock.ID()
72
if v.config.Timeout != nil {
73
data.Timeout = *v.config.Timeout
74
} else if v.UsesVolumeDriver() {
75
data.Timeout = v.runtime.config.Engine.VolumePluginTimeout