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
=== modified file 'bin/kpack-from-image'
--- bin/kpack-from-image 2016-03-03 17:11:42 +0000
+++ bin/kpack-from-image 2016-10-03 16:07:24 +0000
@@ -241,6 +241,26 @@
241 "$@"241 "$@"
242}242}
243243
244can_use_overlay() {
245 mount-image-callback --help | grep -q -- --overlay || {
246 debug 1 "Cannot use overlay due to no mount-image-callback support"
247 return 1
248 }
249 local mod="" mods="overlay overlayfs"
250 for mod in $mods; do
251 awk '-F\t' '$2 == mod { e=0; } END {exit(e);}' \
252 e=1 "mod=$mod" /proc/filesystems && {
253 debug 1 "Support overlay through '$mod' in /proc/filesystems"
254 return 0
255 }
256 done
257 for mod in $mods; do
258 modprobe --quite --use-blacklist "fs-$mod" && return 0
259 done
260 debug 1 "No support in /proc/filesystems for overlay."
261 return 1
262}
263
244chrooted() {264chrooted() {
245 # this is expected to run chrooted inside the root265 # this is expected to run chrooted inside the root
246 # installs all packages (arguments), writes kernel266 # installs all packages (arguments), writes kernel
@@ -431,7 +451,7 @@
431 trap cleanup EXIT451 trap cleanup EXIT
432452
433 if [ "$copy" = "auto" ]; then453 if [ "$copy" = "auto" ]; then
434 if mount-image-callback --help | grep -q -- --overlay; then454 if can_use_overlay; then
435 copy="overlay"455 copy="overlay"
436 elif command -v qemu-img >/dev/null 2>&1; then456 elif command -v qemu-img >/dev/null 2>&1; then
437 copy="qcow"457 copy="qcow"

Subscribers

People subscribed via source and target branches