You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// We want to fail gracefully here, to ensure that we
306
-
// can still remove volumes even if their plugin is
307
-
// missing. Otherwise, we end up with volumes that
308
-
// cannot even be retrieved from the database and will
309
-
// cause things like `volume ls` to fail.
310
-
logrus.Errorf("Volume %s uses volume plugin %s, but it cannot be accessed - some functionality may not be available: %v", volume.Name(), volume.config.Driver, err)
@@ -437,27 +438,22 @@ func (r *Runtime) removeVolume(ctx context.Context, v *Volume, force bool, timeo
437
438
ifv.UsesVolumeDriver() &&!ignoreVolumePlugin {
438
439
canRemove:=true
439
440
440
-
// Do we have a volume driver?
441
-
ifv.plugin==nil {
441
+
plugin, err:=v.volumePlugin()
442
+
iferr!=nil {
442
443
canRemove=false
443
-
removalErr=fmt.Errorf("cannot remove volume %s from plugin %s, but it has been removed from Podman: %w", v.Name(), v.Driver(), define.ErrMissingPlugin)
444
+
removalErr=fmt.Errorf("cannot remove volume %s from plugin %s, but it has been removed from Podman: %w", v.Name(), v.Driver(), err)
444
445
} else {
445
-
// Ping the plugin first to verify the volume still
446
-
// exists.
447
-
// We're trying to be very tolerant of missing volumes
448
-
// in the backend, to avoid the problems we see with
449
-
// sync between c/storage and the Libpod DB.
450
446
getReq:=new(pluginapi.GetRequest)
451
447
getReq.Name=v.Name()
452
-
if_, err:=v.plugin.GetVolume(getReq); err!=nil {
448
+
if_, err:=plugin.GetVolume(getReq); err!=nil {
453
449
canRemove=false
454
450
removalErr=fmt.Errorf("volume %s could not be retrieved from plugin %s, but it has been removed from Podman: %w", v.Name(), v.Driver(), err)
455
451
}
456
452
}
457
453
ifcanRemove {
458
454
req:=new(pluginapi.RemoveRequest)
459
455
req.Name=v.Name()
460
-
iferr:=v.plugin.RemoveVolume(req); err!=nil {
456
+
iferr:=plugin.RemoveVolume(req); err!=nil {
461
457
returnfmt.Errorf("volume %s could not be removed from plugin %s: %w", v.Name(), v.Driver(), err)
// We want to fail gracefully here, to ensure that we
358
-
// can still remove volumes even if their plugin is
359
-
// missing. Otherwise, we end up with volumes that
360
-
// cannot even be retrieved from the database and will
361
-
// cause things like `volume ls` to fail.
362
-
logrus.Errorf("Volume %s uses volume plugin %s, but it cannot be accessed - some functionality may not be available: %v", vol.Name(), vol.config.Driver, err)
logrus.Debugf("Querying volume plugin %s for status", v.config.Driver)
33
33
data.Mountpoint=v.state.MountPoint
34
34
35
-
ifv.plugin==nil {
36
-
returnnil, fmt.Errorf("volume %s uses volume plugin %s but it is not available, cannot inspect: %w", v.Name(), v.config.Driver, define.ErrMissingPlugin)
35
+
plugin, err:=v.volumePlugin()
36
+
iferr!=nil {
37
+
returnnil, fmt.Errorf("volume %s uses volume plugin %s but it is not available, cannot inspect: %w", v.Name(), v.config.Driver, err)
37
38
}
38
39
39
40
// Retrieve status for the volume.
40
41
// Need to query the volume driver.
41
42
req:=new(pluginapi.GetRequest)
42
43
req.Name=v.Name()
43
-
resp, err:=v.plugin.GetVolume(req)
44
+
resp, err:=plugin.GetVolume(req)
44
45
iferr!=nil {
45
46
returnnil, fmt.Errorf("retrieving volume %s information from plugin %s: %w", v.Name(), v.Driver(), err)
0 commit comments