Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/pkg-bug-1050033 into
lp:~maas-maintainers/maas/packaging.
Commit message:
Migrate pre-Quantal ephemeral images from linux/initrd pairs to
kernel/initrd.gz pairs.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1050033 in MAAS: "maas-import-pxe-files has copying errors after package
upgrade"
https://bugs.launchpad.net/maas/+bug/1050033
For more details, see:
https://code.launchpad.net/~jtv/maas/pkg-bug-1050033/+merge/128572
This was blocking upgrades from Precise to Quantal: the "kernel" and
"initrd.gz" files from downloadd ephemeral images were not found, because the
older version of the maas-import-ephemerals script downloaded "linux" and
"initrd" files instead.
The branch you see here does some in-place migration: if there's a linux file
but no kernel file, hardlink the latter to the former. If there's an initrd
file but no initrd.gz, gzip the former to the latter. In both cases, the
existing files are left in place (gzip's -c option has this effect) and no
existing files are overwritten.
While trying this change I found that the initrd files were actually already
gzipped, but that's OK: gzipping it again won't double-compress it. Instead
the command will produce essentially the same file, except the name/timestamp
are saved into the file. (You can disable that, but I didn't want to; the name
works out correctly and keeping the original file's timestamp is likely to be
clearer in post-mortem investigations than using the time of compression.) I
verified that uncompressing the initrd.gz produces an exact copy of the initrd
that went in.
Jeroen
--
https://code.launchpad.net/~jtv/maas/pkg-bug-1050033/+merge/128572
Your team Launchpad code reviewers is requested to review the proposed merge of
lp:~jtv/maas/pkg-bug-1050033 into lp:~maas-maintainers/maas/packaging.
=== modified file 'debian/maas-region-controller.postinst'
--- debian/maas-region-controller.postinst 2012-10-05 04:26:58 +0000
+++ debian/maas-region-controller.postinst 2012-10-08 19:18:44 +0000
@@ -133,6 +133,32 @@
fi
}
+# If ephemeral image directory $1 contains an initrd but not an initrd.gz,
+# create the latter. If it contains a "kernel" but not a "linux," create
+# the latter.
+migrate_ephemeral_image() {
+ local image="$1"
+ if [ -d "$image" ]; then
+ if [ -f "$image/initrd" ] && [ ! -f "$image/initrd.gz" ]; then
+ gzip -c -- "$image/initrd" >"$image/initrd.gz"
+ fi
+ if [ -f "$image/kernel" ] && [ ! -f "$image/linux" ]; then
+ ln -- "$image/kernel" "$image/linux"
+ fi
+ fi
+}
+
+# Pre-Quantal versions of maas-import-ephemerals imported boot images with a
+# "kernel" and "initrd." Newer versions expect to find "linux" and
+# "initrd.gz." Produce those from the existing files.
+migrate_ephemeral_images() {
+ if [ -d /var/lib/maas/ephemeral/precise/ephemeral ]; then
+ for image in /var/lib/maas/ephemeral/precise/ephemeral/*/*/; do
+ migrate_ephemeral_image "$image"
+ done
+ fi
+}
+
configure_maas_squid_deb_proxy() {
local ipaddr="$1"
@@ -310,6 +336,8 @@
maas_sync_migrate_db
+ migrate_ephemeral_images
+
fi
restart_apache2
_______________________________________________
Mailing list: https://launchpad.net/~launchpad-reviewers
Post to : [email protected]
Unsubscribe : https://launchpad.net/~launchpad-reviewers
More help : https://help.launchpad.net/ListHelp