Merge lp:~smoser/maas-images/trunk.better-check-overlay into lp:maas-images

Proposed by Scott Moser
Status: Rejected
Rejected by: Scott Moser
Proposed branch: lp:~smoser/maas-images/trunk.better-check-overlay
Merge into: lp:maas-images
Diff against target: 39 lines (+21/-1)
1 file modified
bin/kpack-from-image (+21/-1)
To merge this branch: bzr merge lp:~smoser/maas-images/trunk.better-check-overlay
Reviewer Review Type Date Requested Status
maintainers of maas images Pending
Review via email: mp+307453@code.launchpad.net

Commit message

bin/kpack-from-image: better determine if overlay support is available.

Instead of assuming that mount-image-callback having a flag '--overlay'
indicates that overlay support is usable, further check.

This makes the --copy=auto (the default) work in scenarios where
there are no modules available for loading or kernel module loading
is not allowed.

To post a comment you must log in.
335. By Scott Moser

load the module by fs-<filesystem>

this is a better path to loading a kernel module since
we're askign for a specific filesystem support, this will load
that filesystem rather than assuming that 'overlay' module
provides the 'overlay' filesystem.

Revision history for this message
Scott Moser (smoser) wrote :

This isn't needed now as the fix went into cloud-itils for mic.

Unmerged revisions

335. By Scott Moser

load the module by fs-<filesystem>

this is a better path to loading a kernel module since
we're askign for a specific filesystem support, this will load
that filesystem rather than assuming that 'overlay' module
provides the 'overlay' filesystem.

334. By Scott Moser

bin/kpack-from-image: better determine if overlay support is available.

Instead of assuming that mount-image-callback having a flag '--overlay'
indicates that overlay support is usable, further check.

This makes the --copy=auto (the default) work in scenarios where
there are no modules available for loading or kernel module loading
is not allowed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/kpack-from-image'
2--- bin/kpack-from-image 2016-03-03 17:11:42 +0000
3+++ bin/kpack-from-image 2016-10-03 16:07:24 +0000
4@@ -241,6 +241,26 @@
5 "$@"
6 }
7
8+can_use_overlay() {
9+ mount-image-callback --help | grep -q -- --overlay || {
10+ debug 1 "Cannot use overlay due to no mount-image-callback support"
11+ return 1
12+ }
13+ local mod="" mods="overlay overlayfs"
14+ for mod in $mods; do
15+ awk '-F\t' '$2 == mod { e=0; } END {exit(e);}' \
16+ e=1 "mod=$mod" /proc/filesystems && {
17+ debug 1 "Support overlay through '$mod' in /proc/filesystems"
18+ return 0
19+ }
20+ done
21+ for mod in $mods; do
22+ modprobe --quite --use-blacklist "fs-$mod" && return 0
23+ done
24+ debug 1 "No support in /proc/filesystems for overlay."
25+ return 1
26+}
27+
28 chrooted() {
29 # this is expected to run chrooted inside the root
30 # installs all packages (arguments), writes kernel
31@@ -431,7 +451,7 @@
32 trap cleanup EXIT
33
34 if [ "$copy" = "auto" ]; then
35- if mount-image-callback --help | grep -q -- --overlay; then
36+ if can_use_overlay; then
37 copy="overlay"
38 elif command -v qemu-img >/dev/null 2>&1; then
39 copy="qcow"

Subscribers

People subscribed via source and target branches