summaryrefslogtreecommitdiff
path: root/libpod/in_memory_state.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-09-06 13:48:33 +0200
committerGitHub <noreply@github.com>2019-09-06 13:48:33 +0200
commit0d8a22496e3c7e3d44251bdbac194c55de141e2c (patch)
treec3591e9470b5b90842e6764b71b3e3988bc8fab5 /libpod/in_memory_state.go
parenta4572c4f681ef23495495f313ae513d5ba3fd495 (diff)
parentde9a394fcff19ae4422a3f65502c8790787351fd (diff)
downloadpodman-0d8a22496e3c7e3d44251bdbac194c55de141e2c.tar.gz
podman-0d8a22496e3c7e3d44251bdbac194c55de141e2c.tar.bz2
podman-0d8a22496e3c7e3d44251bdbac194c55de141e2c.zip
Merge pull request #3931 from mheon/volumes_with_options
Add support for mounting volumes with local driver and options
Diffstat (limited to 'libpod/in_memory_state.go')
-rw-r--r--libpod/in_memory_state.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/libpod/in_memory_state.go b/libpod/in_memory_state.go
index a9b735327..280ae5f5c 100644
--- a/libpod/in_memory_state.go
+++ b/libpod/in_memory_state.go
@@ -507,6 +507,36 @@ func (s *InMemoryState) RemoveVolume(volume *Volume) error {
return nil
}
+// UpdateVolume updates a volume from the database.
+// For the in-memory state, this is a no-op.
+func (s *InMemoryState) UpdateVolume(volume *Volume) error {
+ if !volume.valid {
+ return define.ErrVolumeRemoved
+ }
+
+ if _, ok := s.volumes[volume.Name()]; !ok {
+ volume.valid = false
+ return errors.Wrapf(define.ErrNoSuchVolume, "volume with name %q not found in state", volume.Name())
+ }
+
+ return nil
+}
+
+// SaveVolume saves a volume's state to the database.
+// For the in-memory state, this is a no-op.
+func (s *InMemoryState) SaveVolume(volume *Volume) error {
+ if !volume.valid {
+ return define.ErrVolumeRemoved
+ }
+
+ if _, ok := s.volumes[volume.Name()]; !ok {
+ volume.valid = false
+ return errors.Wrapf(define.ErrNoSuchVolume, "volume with name %q not found in state", volume.Name())
+ }
+
+ return nil
+}
+
// VolumeInUse checks if the given volume is being used by at least one container
func (s *InMemoryState) VolumeInUse(volume *Volume) ([]string, error) {
if !volume.valid {