Skip to content

Commit

Permalink
storage: drop ostree deduplication
Browse files Browse the repository at this point in the history
it was an attempt to use OSTree to deduplicate files, at the time we
already had a dependency on OSTree for system containers in
containers/image.  Since the feature never really took off, let's just
drop it.

Closes: containers#419

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Oct 5, 2019
1 parent fb8e928 commit c40548d
Show file tree
Hide file tree
Showing 39 changed files with 7 additions and 2,399 deletions.
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ lint_task:
build_script: |
echo "deb http://deb.debian.org/debian stretch-backports main" > /etc/apt/sources.list.d/backports.list
apt-get update
apt-get install -y libbtrfs-dev libostree-dev libdevmapper-dev
apt-get install -y libbtrfs-dev libdevmapper-dev
test_script: make lint

# Update metadata on VM images referenced by this repository state
Expand Down
2 changes: 0 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
run:
build-tags:
- ostree
concurrency: 6
deadline: 5m
linters:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null)
GIT_BRANCH_CLEAN := $(shell echo $(GIT_BRANCH) | sed -e "s/[^[:alnum:]]/-/g")
EPOCH_TEST_COMMIT := 0418ebf59f9e1f564831c0ba9378b7f8e40a1c73
NATIVETAGS :=
AUTOTAGS := $(shell ./hack/btrfs_tag.sh) $(shell ./hack/libdm_tag.sh) $(shell ./hack/ostree_tag.sh)
AUTOTAGS := $(shell ./hack/btrfs_tag.sh) $(shell ./hack/libdm_tag.sh)
BUILDFLAGS := -tags "$(AUTOTAGS) $(TAGS)" $(FLAGS)
GO ?= go

Expand Down
4 changes: 2 additions & 2 deletions contrib/cirrus/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ show_env_vars

cd $GOSRC

export RPMBuildRequires="podman autoconf automake gcc golang go-md2man gpgme-devel device-mapper-devel btrfs-progs-devel libassuan-devel libseccomp-devel glib2-devel ostree-devel make bats fuse3-devel fuse3"
export RPMBuildRequires="podman autoconf automake gcc golang go-md2man gpgme-devel device-mapper-devel btrfs-progs-devel libassuan-devel libseccomp-devel glib2-devel make bats fuse3-devel fuse3"
export RPMBuildConflicts="gcc-go"
export AptBuildRequires="autoconf automake gcc golang go-md2man libgpgme11-dev libdevmapper-dev libseccomp-dev libglib2.0-dev libostree-dev make bats aufs-tools fuse3 libfuse3-dev libbtrfs-dev"
export AptBuildRequires="autoconf automake gcc golang go-md2man libgpgme11-dev libdevmapper-dev libseccomp-dev libglib2.0-dev make bats aufs-tools fuse3 libfuse3-dev libbtrfs-dev"
export AptBuildConflicts="cryptsetup-initramfs"

case "$OS_REL_VER" in
Expand Down
3 changes: 0 additions & 3 deletions docs/containers-storage.conf.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ The `storage.options` table supports the following options:

Comma separated list of default options to be used to mount container images. Suggested value "nodev".

**ostree_repo** = ""
If specified, use OSTree to deduplicate files with the overlay or vfs backends.

**size**=""
Maximum size of a container image. This flag can be used to set quota on the size of container images. (default: 10GB)

Expand Down
3 changes: 0 additions & 3 deletions docs/containers-storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ configuration data which is recommended for use in *containers* which derive
from the *image*. It is also expected that a *container*'s run-time
configuration will be stored as data items.

Files belonging to a *readonly* *layer* will become deduplicated with *OSTree* if the configuration option *storage.ostree_repo* for saving the corresponding OSTree repository is provided.
This option won't work if *containers-storage* gets built without support for OSTree.

## SUB-COMMANDS
The *containers-storage* command's features are broken down into several subcommands:
**containers-storage add-names(1)** Add layer, image, or container name or names
Expand Down
32 changes: 0 additions & 32 deletions drivers/overlay/overlay.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/containers/storage/pkg/idtools"
"github.com/containers/storage/pkg/locker"
"github.com/containers/storage/pkg/mount"
"github.com/containers/storage/pkg/ostree"
"github.com/containers/storage/pkg/parsers"
"github.com/containers/storage/pkg/system"
units "github.com/docker/go-units"
Expand Down Expand Up @@ -88,7 +87,6 @@ type overlayOptions struct {
imageStores []string
quota quota.Quota
mountProgram string
ostreeRepo string
skipMountHome bool
mountOptions string
ignoreChownErrors bool
Expand All @@ -108,7 +106,6 @@ type Driver struct {
supportsDType bool
usingMetacopy bool
locker *locker.Locker
convert map[string]bool
}

var (
Expand Down Expand Up @@ -234,12 +231,6 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
}
}

if opts.ostreeRepo != "" {
if err := ostree.CreateOSTreeRepository(opts.ostreeRepo, rootUID, rootGID); err != nil {
return nil, err
}
}

d := &Driver{
name: "overlay",
home: home,
Expand All @@ -251,7 +242,6 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
usingMetacopy: usingMetacopy,
locker: locker.New(),
options: *opts,
convert: make(map[string]bool),
}

d.naiveDiff = graphdriver.NewNaiveDiffDriver(d, graphdriver.NewNaiveLayerIDMapUpdater(d))
Expand Down Expand Up @@ -316,12 +306,6 @@ func parseOptions(options []string) (*overlayOptions, error) {
return nil, fmt.Errorf("overlay: can't stat program %s: %v", val, err)
}
o.mountProgram = val
case "overlay2.ostree_repo", "overlay.ostree_repo", ".ostree_repo":
logrus.Debugf("overlay: ostree_repo=%s", val)
if !ostree.OstreeSupport() {
return nil, fmt.Errorf("overlay: ostree_repo specified but support for ostree is missing")
}
o.ostreeRepo = val
case ".ignore_chown_errors", "overlay2.ignore_chown_errors", "overlay.ignore_chown_errors":
logrus.Debugf("overlay: ignore_chown_errors=%s", val)
o.ignoreChownErrors, err = strconv.ParseBool(val)
Expand Down Expand Up @@ -556,10 +540,6 @@ func (d *Driver) Create(id, parent string, opts *graphdriver.CreateOpts) (retErr
}
}

if d.options.ostreeRepo != "" {
d.convert[id] = true
}

return d.create(id, parent, opts)
}

Expand Down Expand Up @@ -766,11 +746,6 @@ func (d *Driver) Remove(id string) error {
d.locker.Lock(id)
defer d.locker.Unlock(id)

// Ignore errors, we don't want to fail if the ostree branch doesn't exist,
if d.options.ostreeRepo != "" {
ostree.DeleteOSTree(d.options.ostreeRepo, id)
}

dir := d.dir(id)
lid, err := ioutil.ReadFile(path.Join(dir, "link"))
if err == nil {
Expand Down Expand Up @@ -1125,13 +1100,6 @@ func (d *Driver) ApplyDiff(id, parent string, options graphdriver.ApplyDiffOpts)
return 0, err
}

_, convert := d.convert[id]
if convert {
if err := ostree.ConvertToOSTree(d.options.ostreeRepo, applyDir, id); err != nil {
return 0, err
}
}

return directory.Size(applyDir)
}

Expand Down
25 changes: 0 additions & 25 deletions drivers/vfs/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/containers/storage/drivers"
"github.com/containers/storage/pkg/archive"
"github.com/containers/storage/pkg/idtools"
"github.com/containers/storage/pkg/ostree"
"github.com/containers/storage/pkg/parsers"
"github.com/containers/storage/pkg/system"
"github.com/opencontainers/selinux/go-selinux/label"
Expand Down Expand Up @@ -51,11 +50,6 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
case "vfs.imagestore", ".imagestore":
d.homes = append(d.homes, strings.Split(val, ",")...)
continue
case "vfs.ostree_repo", ".ostree_repo":
if !ostree.OstreeSupport() {
return nil, fmt.Errorf("vfs: ostree_repo specified but support for ostree is missing")
}
d.ostreeRepo = val
case "vfs.mountopt":
return nil, fmt.Errorf("vfs driver does not support mount options")
case ".ignore_chown_errors", "vfs.ignore_chown_errors":
Expand All @@ -69,15 +63,6 @@ func Init(home string, options graphdriver.Options) (graphdriver.Driver, error)
return nil, fmt.Errorf("vfs driver does not support %s options", key)
}
}
if d.ostreeRepo != "" {
rootUID, rootGID, err := idtools.GetRootUIDGID(options.UIDMaps, options.GIDMaps)
if err != nil {
return nil, err
}
if err := ostree.CreateOSTreeRepository(d.ostreeRepo, rootUID, rootGID); err != nil {
return nil, err
}
}
d.updater = graphdriver.NewNaiveLayerIDMapUpdater(d)
d.naiveDiff = graphdriver.NewNaiveDiffDriver(d, d.updater)

Expand All @@ -92,7 +77,6 @@ type Driver struct {
name string
homes []string
idMappings *idtools.IDMappings
ostreeRepo string
ignoreChownErrors bool
naiveDiff graphdriver.DiffDriver
updater graphdriver.LayerIDMapUpdater
Expand Down Expand Up @@ -191,11 +175,6 @@ func (d *Driver) create(id, parent string, opts *graphdriver.CreateOpts, ro bool
}
}

if ro && d.ostreeRepo != "" {
if err := ostree.ConvertToOSTree(d.ostreeRepo, dir, id); err != nil {
return err
}
}
return nil

}
Expand All @@ -216,10 +195,6 @@ func (d *Driver) dir(id string) string {

// Remove deletes the content from the directory for a given id.
func (d *Driver) Remove(id string) error {
if d.ostreeRepo != "" {
// Ignore errors, we don't want to fail if the ostree branch doesn't exist,
ostree.DeleteOSTree(d.ostreeRepo, id)
}
return system.EnsureRemoveAll(d.dir(id))
}

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
github.com/opencontainers/go-digest v1.0.0-rc1
github.com/opencontainers/runc v1.0.0-rc8
github.com/opencontainers/selinux v1.2.2
github.com/ostreedev/ostree-go v0.0.0-20190702140239-759a8c1ac913
github.com/pkg/errors v0.8.1
github.com/pquerna/ffjson v0.0.0-20181028064349-e517b90714f7
github.com/sirupsen/logrus v1.4.2
Expand Down
10 changes: 0 additions & 10 deletions hack/ostree_tag.sh

This file was deleted.

6 changes: 3 additions & 3 deletions hack/spc_ci_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export UPDATE_CMD="true"
case "$DISTRO" in
*ubuntu*)
export UPDATE_CMD="apt-get update"
export INSTALL_CMD="apt-get -qq install bats btrfs-tools libdevmapper-dev ostree libostree-dev"
export INSTALL_CMD="apt-get -qq install bats btrfs-tools libdevmapper-dev"
;;
*fedora*)
export INSTALL_CMD="dnf -y install bats btrfs-progs btrfs-progs-devel
e2fsprogs xfsprogs device-mapper-devel ostree ostree-devel"
e2fsprogs xfsprogs device-mapper-devel"
;;
*centos*)
export INSTALL_CMD="yum install -y bats btrfs-progs btrfs-progs-devel
e2fsprogs xfsprogs device-mapper-devel ostree ostree-devel"
e2fsprogs xfsprogs device-mapper-devel"
;;
*)
echo "Unknown/unsupported \$DISTRO=$DISTRO"
Expand Down
2 changes: 0 additions & 2 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ type OptionsConfig struct {
RemapGroup string `toml:"remap-group"`
// Thinpool container options to be handed to thinpool drivers
Thinpool struct{ ThinpoolOptionsConfig } `toml:"thinpool"`
// OSTree repository
OstreeRepo string `toml:"ostree_repo"`

// Do not create a bind mount on the storage home
SkipMountHome string `toml:"skip_mount_home"`
Expand Down
19 changes: 0 additions & 19 deletions pkg/ostree/no_ostree.go

This file was deleted.

Loading

0 comments on commit c40548d

Please sign in to comment.