Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

container: T4870: Update podman to use overlay storage driver #1702

Merged
merged 1 commit into from Dec 23, 2022

Conversation

TGNThump
Copy link
Contributor

@TGNThump TGNThump commented Dec 9, 2022

Change Summary

We currently use the vfs storage driver for podman, which has poor performance and results in much more disk space usage.

The vfs storage driver is intended for testing purposes, and for situations where no copy-on-write filesystem can be used. Performance of this storage driver is poor, and is not generally recommended for production use.

This PR switches the storage driver to overlay, which is docker's preferred storage driver.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe):

Related Task(s)

Component(s) name

  • container

Proposed changes

How to test

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@sever-sever
Copy link
Member

Only one question what to do if it exists old images/containers
As the new driver doesn't work with the old driver. So we should delete all container images/containers before we can use driver = overlay

@sarthurdev
Copy link
Member

Good point, tested on system with existing vfs images:

ERRO[0000] User-selected graph driver "overlay" overwritten by graph driver "vfs" from database - delete libpod local files to resolve.  May prevent use of images created by other tools

Resolved by deleting all podman data with podman system reset.

@TGNThump
Copy link
Contributor Author

Yeah, not sure what to do about the manual migration steps required.

@TGNThump TGNThump marked this pull request as ready for review December 12, 2022 16:45
@sarthurdev
Copy link
Member

I don't think the image/container data can be converted between drivers.

I'm thinking it could either be an "expected breakage" as part of rolling releases, or a warning could be given on boot if vfs storage still exists: sudo podman info | grep "graphDriverName: vfs".

@c-po
Copy link
Member

c-po commented Dec 17, 2022

Would it be possible to move all the container storage files to a temporary place, run podman system reset and copy back the data? That could save us from numerous bug reports.

@sarthurdev
Copy link
Member

The data would not be stored in a compatible format for the overlay storage driver.

Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the change is justified and that the best way to solve the compatibility is to provide a script that people can run before upgrade.

Since this feature is not in an LTS release, it's only used by the most adventurous users who are likely prepared to have to perform some manual migration steps.

@c-po
Copy link
Member

c-po commented Dec 23, 2022

The "incompatibility" can be resolved by running the following script prior to upgrading to a new image:

#!/bin/sh
# Migration helper script needed to be executed before upgrading to a more
# recent VyOS version as the container storage driver is changed incompatible

for pod in $(cli-shell-api listActiveNodes container name); do
    systemctl stop vyos-container-${pod//\'}.service
done

sed -i 's/vfs/overlay2/g' /etc/containers/storage.conf /usr/share/vyos/templates/container/storage.conf.j2
rm -rf /usr/lib/live/mount/persistence/container/storage/libpod

for pod in $(cli-shell-api listActiveNodes container name); do
    image=$(cli-shell-api returnActiveValue container name ${pod//\'} image)
    podman image pull $image
    systemctl start vyos-container-${pod//\'}.service
done

for dir in vfs vfs-containers vfs-images vfs-layers; do
    rm -rf /usr/lib/live/mount/persistence/container/storage/$dir
done

@c-po c-po merged commit 40efa3e into vyos:current Dec 23, 2022
@TGNThump TGNThump deleted the patch-1 branch December 23, 2022 17:35
@c-po
Copy link
Member

c-po commented Dec 24, 2022

This manual step just got removed by f3956a5 which simply exports active images as oci-image and re-imports the image after the filesystem got migrated. No manual interaction by the user required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants