Commit Graph

80 Commits

Author SHA1 Message Date
Nalin Dahyabhai 06025caa49 CLI helper: print backtraces with errors
Print backtrace information when displaying an error returned by our
API, to make troubleshooting tests a bit easier.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:15 -05:00
Nalin Dahyabhai ccf8bef6fa Teach images to hold multiple manifests
Change how we compute digests for BigData items with names that start
with "manifest" so that we use the image library's manifest.Digest()
function, which knows how to preprocess schema1 manifests to get the
right value, instead of just trying to finesse it.

Track the digests of multiple manifest-named items for images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-07 10:27:36 -05:00
Daniel J Walsh 9d3838cd43
Merge pull request #226 from rhatdan/getmountopts
Allow the passing in and retrieval of mount options
2018-11-27 14:48:09 -05:00
Šimon Lukašík ed97cd56f0 Refactor ParseIDMap, allow parsing multiple maps at once
I found that other projects, tend to parse multiple maps at once. So, we may
want to allow the base library to do so in order to decrease complexity in the
upper layers.

This is follow-up on previous refactoring in 7b209d36fd, I didn't got
it right on first try, sry.

Signed-off-by: Šimon Lukašík <isimluk@fedoraproject.org>
2018-11-26 20:11:49 +01:00
Daniel J Walsh ab6be50561
Allow the passing in and retrieval of mount options
We want to allow tools like podman/buildah to override default storage
container mount options on a container by container basis.

For example if the default mount options for containers/storage include
nodev or nosuid, we want to allow podman to turn these off if the user
specifies --privileged.

We also might want to turn off certain user namespace flags that will cause
buildah and podman build to work slower when creating container images.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-11-19 19:14:21 -05:00
Šimon Lukašík 7b209d36fd Refactor: Extract ParseIDMap func to idtools package
where it belongs.

I have noticed that this parsing gets spread across projects. Basically, the
very same method is present in libpod, buildah, and cri-o projects. We better
start re-using this code from single place or soon everyone has its own version.

Signed-off-by: Šimon Lukašík <slukasik@redhat.com>
2018-11-10 17:53:54 +01:00
Daniel J Walsh 1538971882
Change Mounted to return the number of times mounted
podman unmount wants to know if the image is only mounted 1 time
and refuse to unmount if the container state expects it to be mounted.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-07-17 16:27:27 -04:00
Daniel J Walsh 1075a73cac
Modify storage to allow callers to determine if a mount point is mounted
Add force to umount to force the umount of a container image
Add an interface to indicate whether or not the layer is mounted
Add a boolean return from unmount to indicate when the layer is really unmounted

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-07-17 14:00:15 -04:00
Nalin Dahyabhai c16e8ec318 Add Store.ContainerSize()
Add a ContainerSize() method, which knows how to compute the sizes of
container, so that our callers don't need to all be updated when we make
changes to how we store them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-05-30 17:16:53 -04:00
Nalin Dahyabhai ad6eeb6517 Add Store.ImageSize()
Add an ImageSize() method, which knows how to compute the sizes of
images, so that our callers don't need to all be updated when we make
changes to how we store them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-05-30 17:16:53 -04:00
Nalin Dahyabhai 6cb6f31c03 Add mapped top layers to images
Allow images to have multiple top layers which should only differ by
which UID/GID mappings are used in them, to make creating multiple
containres which use the same mappings faster.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-05-30 13:46:08 -04:00
Nalin Dahyabhai b22d9f20d3 Exercise Copy[File]WithTar, optionally with Chown flags
Add integration tests to exercise CopyFileWithTar and CopyWithTar, both
with and without Chown flags.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-05-01 10:27:34 -04:00
Nalin Dahyabhai 13ae73afef CLI: fix JSON output for layer/container-parent-owners
Provide the information that was actually requested when we produce JSON
output for the layer-parent-owners and container-parent-owners commands.
Carried over from #156.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-10 14:39:47 -04:00
Nalin Dahyabhai aefafeeb85 Add LayerParentOwners()/ContainerParentOwners()
Add store methods for finding the list of UIDs and GIDs which probably
need to be mapped if a given layer or container's layer, which has to
have been mounted at least once in order for us to know where it goes,
is going to be used for a container that is run with the configured ID
mappings in a separate user namespace.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Nalin Dahyabhai b71d4c4197 Support for per-container uid/gid mapping: upper
Add support to the Store objects for per-container UID/GID mapping.
* UID and GID maps can be specified when creating layers and containers.
* If mapping options are specified when creating a container, those
  options are used for creating the layer which we create for the
  container and recorded with the container for convenience.
* A layer defaults to using the ID mapping configured for its parent, or
  to the default which was used to initialize the Store object if it has
  no parent.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Nalin Dahyabhai 1824cf917a Add explicitly-settable digest values for images
Add explicitly-settable digest values for images that are treated mostly
like the implicit digests that we track for manifests, for the sake of
v1 images which have manifests that need to be preprocessed before being
digested to produce an image's digest value.  We'll still have the
digest of the unprocessed manifest, but that shouldn't hurt.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-12-11 16:16:46 -05:00
Nalin Dahyabhai 2a564455fd Add a notion of image "digests" based on their "manifest" data
Add a "digest" of an image that is equal to the digest of its big data
item named "manifest", if it has one, that we can index and use for
locating images.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-11-16 11:52:25 -05:00
Nalin Dahyabhai d8c5c0a1f8 Make the CLI use either all defaults, or none
Make the CLI use all of the default settings if none of them are
overridden on the command line, or none of them, if any are overridden.
Any other behavior is hard to use in integration tests, and confusing.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-03 09:42:48 -04:00
Nalin Dahyabhai 240fe6016c Wrap new data retrieval APIs in the CLI tool
Add CLI wrappers for the store's
  ImageBigDataDigest
  ImageBigDataSize
  ContainerBigDataDigest
  ContainerBigDataSize
methods.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-02 17:50:01 -04:00
Nalin Dahyabhai 84922714d2 Merge pull request #108 from nalind/layerless-images
Stop rejecting creation of images with no layers
2017-09-29 16:16:54 -04:00
Daniel J Walsh 46acf2c518 Merge pull request #110 from nalind/dedupe-names
Be more thorough about deduplicating names
2017-09-29 16:00:40 -04:00
Nalin Dahyabhai d659609729 Clean up CLI display of settings
Change the labels we use when displaying our settings as part of a debug
log, and prepend that information to the "status" output.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-09-29 15:07:12 -04:00
Nalin Dahyabhai 2e93f81ed8 Fix weird formatting of CLI "create-*" output
Fix the weird formatting of the output from the various create commands
and the import-layer command.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-09-29 15:07:05 -04:00
Nalin Dahyabhai b1b3a15bd6 Add a CLI "layer" command
Add a "layer" command, for examining layer records.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-09-29 15:06:59 -04:00
Nalin Dahyabhai 7ccd1bdeb2 Stop rejecting creation of images with no layers
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>
2017-09-29 15:01:26 -04:00
Nalin Dahyabhai 29a5d64633 Wrap the Store.Names() method in the CLI
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-09-29 15:00:19 -04:00
Mrunal Patel 59da502256 Update deps to github.com/sirupsen/logrus v1.0.0
Also updates github.com/Microsoft/hcsshim
and github.com/docker/go-connections so they work
with the newer version of logrus.

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2017-08-01 07:25:56 -07:00
Nalin Dahyabhai 2036680a3a Finish renaming oci-storage to containers-storage
Update the rest of the documentation, scripts, and output.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-07-10 16:11:09 -04:00
Nalin Dahyabhai fb0b0e7cfe Make Diff() methods take an optional *DiffOptions
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>
2017-06-16 10:50:08 -04:00
Nalin Dahyabhai 77ad6176a9 Rename CLI from oci-storage to containers-storage
Rename the CLI tool to match the name that we gave the transport that
uses it in containers/image, which affects just about every consumer of
this library.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-05-25 15:50:33 -04:00