Skip to content

Commit 6ba6324

Browse files
committed
Update all Pinned field references to use VolumeState
1 parent f0d441d commit 6ba6324

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

libpod/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1761,7 +1761,7 @@ func WithVolumePinned() VolumeCreateOption {
17611761
return define.ErrVolumeFinalized
17621762
}
17631763

1764-
volume.config.Pinned = true
1764+
volume.state.Pinned = true
17651765

17661766
return nil
17671767
}

libpod/volume.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,14 @@ func (v *Volume) UsesVolumeDriver() bool {
289289
// Pinned returns whether this volume is marked as pinned.
290290
// Pinned volumes are excluded from system prune operations by default.
291291
func (v *Volume) Pinned() bool {
292-
return v.config.Pinned
292+
v.lock.Lock()
293+
defer v.lock.Unlock()
294+
295+
if err := v.update(); err != nil {
296+
return false
297+
}
298+
299+
return v.state.Pinned
293300
}
294301

295302
// SetPinned sets the pinned status of the volume.
@@ -306,7 +313,7 @@ func (v *Volume) SetPinned(pinned bool) error {
306313
return err
307314
}
308315

309-
v.config.Pinned = pinned
316+
v.state.Pinned = pinned
310317

311318
return v.save()
312319
}

libpod/volume_inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ func (v *Volume) Inspect() (*define.InspectVolumeData, error) {
7575
data.Timeout = v.runtime.config.Engine.VolumePluginTimeout
7676
}
7777

78-
data.Pinned = v.config.Pinned
78+
data.Pinned = v.state.Pinned
7979

8080
return data, nil
8181
}

0 commit comments

Comments
 (0)