← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:bug/1379080-fix-xen-kernel-detection into cloud-init:ubuntu/devel

 

Scott Moser has proposed merging ~smoser/cloud-init:bug/1379080-fix-xen-kernel-detection into cloud-init:ubuntu/devel.

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1379080 in cloud-init (Ubuntu): "update-grub-legacy-ec2 fails to detect xen kernel"
  https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1379080

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/314623
-- 
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:bug/1379080-fix-xen-kernel-detection into cloud-init:ubuntu/devel.
diff --git a/debian/update-grub-legacy-ec2 b/debian/update-grub-legacy-ec2
index 19648f6..c7a5687 100755
--- a/debian/update-grub-legacy-ec2
+++ b/debian/update-grub-legacy-ec2
@@ -1398,9 +1398,19 @@ fi
 
 
 if ! type is_xen_kernel >/dev/null 2>&1; then
+  check_xen_config_for_kernel() {
+    local kernel="$1" config="" dir="" bname=""
+    dir=${kernel%/*}
+    bname=${kernel##*/}
+    config=config-${bname#*-}
+    [ -f "$config" ] || return 1
+    grep -q CONFIG_XEN=y "$config"
+  }
+
   is_xen_kernel() {
     # input is like /boot/vmlinuz-2.6.35-13-virtual
     # get the version string out of it.
+    check_xen_config_for_kernel "$1" && return 0
     local ver_flavor="";
     ver_flavor="${1##*vmlinuz-}"
 
@@ -1418,6 +1428,9 @@ if ! type is_xen_kernel >/dev/null 2>&1; then
 fi
 
 for kern in /boot/vmlinuz-*; do
+  case "$kern" in
+    *.signed) continue;;
+  esac
   is_xen_kernel "${kern}" &&
     xen_verlist="${xen_verlist} ${kern#/boot/vmlinuz-}"
 done

Follow ups