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

fix: only use workaround for overlay if there are zero lowerdirs #493

Merged
merged 1 commit into from
Aug 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pkg/overlay/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package overlay
import (
"bytes"
"encoding/json"
"fmt"
"os"
"path"

Expand Down Expand Up @@ -139,17 +138,16 @@ func (ovl overlayMetadata) lxcRootfsString(config types.StackerConfig, tag strin
lowerdirs = append(lowerdirs, contents)
}

// overlayfs doesn't work with < 2 lowerdirs, so we add some
// overlayfs doesn't work with 0 lowerdirs, so we add some
// workaround dirs if necessary (if e.g. the source only has
// one layer, or it's an empty rootfs with no layers, we still
// want an overlay mount to keep things consistent)
for i := 0; i < 2-len(lowerdirs); i++ {
workaround := path.Join(config.RootFSDir, tag, fmt.Sprintf("workaround%d", i))
if len(lowerdirs) == 0 {
workaround := path.Join(config.RootFSDir, tag, "workaround")
err := os.MkdirAll(workaround, 0755)
if err != nil {
return "", errors.Wrapf(err, "couldn't make workaround dir")
}

lowerdirs = append(lowerdirs, workaround)
}

Expand Down
Loading