When we try to Store.Put() a new layer, also check read-only layer
stores as part of verifying that the new layer's parent is known.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Teach image and container store types to also track the digests of "big
data" items that we have them store.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
When we read itms from disk, if maps in the structures are empty, they
won't be allocated as part of the decoding process. When we
subsequently go to read or write something from such a map, make sure
it's been initialized.
Add some validation of names that we convert to file names, and of
digest values, so that we can be more precise about the error code we
return when there's a problem with the values.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Allow users to specify the maximum size of a containers in the
/etc/containers/storage.conf file. This will enable quota checking
in the drivers that support it.
Allowe users to OverrideKernelCheck to tell drivers to ignore kernel
version checks that indicate whether the driver is supported on that
kernel. These checks do not make sense on older RHEL kernels, since
the driver support was back ported.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
We need to be able to create images which consist of just a list of
manifests, and those don't contain layers, so relax CreateImage()'s
requirement that a layer be specified.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Take a guess at the final size of some slices that we build up item by
item, and try to allocate enough capacity for them before starting to
build them. It's probably not a big speedup, though.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
We already deduplicated names in Store.SetNames(), but we weren't also
doing that when creating layers, images, and containers, or in the
individual store SetNames() methods.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Update searches of read-only layer and image stores to match naming
conventions in the updated Names() method.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
The SetNames() method actually deduplicates the name list that it's
given, so make a note of that in the godoc.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
The Store's Lookup() method didn't check for layers and images in
read-only locations, which it should have. Correct that.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
umohnani noticed that Store.Names() was hitting a deadlock - when
attempting to iterate through the concatenated list of read-write and
read-only image stores, the method was actually walking the list of
read-write and read-only layer stores a second time, so when it
attempted to obtain a lock on the first layer store, it would deadlock.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Had to vendor in a new version of golang.org/x/net to build
Also had to make some changes to drivers to handle
archive.Reader -> io.Reader
archive.Archive -> io.ReadCloser
Also update .gitingore to ignore emacs files, containers-storage.*
and generated man pages.
Also no longer test travis against golang 1.7, cri-o, moby have also
done this.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Use the standard library's "errors" package to create errors so that
backtraces in wrapped errors terminate at the point where the error was
first wrapped, and not at the line where we created the error, which
isn't as useful for troubleshooting.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Remove methods that fetch the underlying layer, image, and container
store objects from the public Store interface. They're still accessible
via type assertions, but ideally that's never going to be necessary.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
We are leaking files into other mount namespaces, making the
runroot private might also improve performance.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
We should default to "" and then allow the library to pick the
best driver for the particular distribution. Picking overlay is
currently breaking cri-o on Centos and RHEL, since they don't
support overlay driver until 7.4 release.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Add notes about the Store methods that return read-only and read-write
layer, image, and container stores, and how using the values they return
bypasses locking and synchronization.
Add notes to the methods which require that the reexec package was
initialized that the reexec package needs to be initialized from main().
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Since ImageOptions are optional when calling a store's CreateImage()
method, we can't assume that there's a value there.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Cache the digests and sizes of a diff, both compressed and uncompressed,
along with the type of compression detected for it, that's supplied to
ApplyDiff() or Put() in the layer structure, and add methods to find a
list of layers that match one or the other digest.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Add a field to ImageOptions that allows a caller to specify a date of
creation when calling CreateImage(), if there's a value in the image
metadata that would be more useful than the default (which is "now" at
the time CreateImage() is called).
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Add an optional *DiffOptions parameter to Diff() methods (which can be
nil), to allow overriding of default behaviors.
At this time, that's just what type of compression is applied, if we
want something other than what was recorded when the diff was applied,
but we can add more later if needed.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Use the read-only interfaces for accessing read-only layer and image
stores. Mount, Unmount, and ApplyDiff modify the contents of the store,
so revert changes that made them inadvertently attempt to modify
read-only stores.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Implement read-only versions of layer and image store interfaces which
allocate read-only locks and which return errors whenever a write
function is called (which should only be possible after a type
assertion, since they're not part of the read-only interfaces).
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Split the LayerStore and ImageStore interfaces into read-only and
write-only subset interfaces, and make the proper stores into unions of
the read-only and write-only method sets.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Changes from ErrImageUnknown to ErrIsNotImage is breaking protocol and has changed the
behaviour of buildah, Breaking previous behaviour.
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
We are now allowing users to specify additional container storage directories in the
configuration. We need to create a roLayer and roImage object for each additional
storage driver. These stores are treated as reaonly.
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
In order to get ROLayers to merge, we need to break
some functions into smaller subsets to not hold the locks long.
Signed-off-by: Dan Walsh <dwalsh@redhat.com>
Use the lockfile to mark that a store's contents need to be reloaded by
other consumers whenever we call SetNames() to update a by-name index.
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
Container Storage is going to be shared by multiple tools. Therefore
we don't want each one of these tools setting up its own container
storage. This storage config can be shared between multiple users.
Signed-off-by: Dan Walsh <dwalsh@redhat.com>