[Merge] lp:~utlemming/ubuntu/precise/cloud-init/lp1336855 into lp:ubuntu/precise-proposed/cloud-init
Robert C Jennings
robert.jennings at canonical.com
Thu Jul 3 19:51:39 UTC 2014
Comments below
Diff comments:
> === modified file '.pc/applied-patches'
> --- .pc/applied-patches 2014-04-07 14:59:56 +0000
> +++ .pc/applied-patches 2014-07-03 19:41:46 +0000
> @@ -22,3 +22,4 @@
> lp-1269626-azure_new_instance.patch
> lp-1292648-azure-format-ephemeral-new.patch
> lp-1302229-fix_futils_azure.patch
> +lp-1336855-grub_xvda.patch
>
> === added directory '.pc/lp-1336855-grub_xvda.patch'
> === added directory '.pc/lp-1336855-grub_xvda.patch/cloudinit'
> === added directory '.pc/lp-1336855-grub_xvda.patch/cloudinit/CloudConfig'
> === added file '.pc/lp-1336855-grub_xvda.patch/cloudinit/CloudConfig/cc_grub_dpkg.py'
> --- .pc/lp-1336855-grub_xvda.patch/cloudinit/CloudConfig/cc_grub_dpkg.py 1970-01-01 00:00:00 +0000
> +++ .pc/lp-1336855-grub_xvda.patch/cloudinit/CloudConfig/cc_grub_dpkg.py 2014-07-03 19:41:46 +0000
> @@ -0,0 +1,64 @@
> +# vi: ts=4 expandtab
> +#
> +# Copyright (C) 2009-2010 Canonical Ltd.
> +# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
> +#
> +# Author: Scott Moser <scott.moser at canonical.com>
> +# Author: Juerg Haefliger <juerg.haefliger at hp.com>
> +#
> +# This program is free software: you can redistribute it and/or modify
> +# it under the terms of the GNU General Public License version 3, as
> +# published by the Free Software Foundation.
> +#
> +# This program is distributed in the hope that it will be useful,
> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> +# GNU General Public License for more details.
> +#
> +# You should have received a copy of the GNU General Public License
> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
> +
> +import cloudinit.util as util
> +import traceback
> +import os
> +
> +
> +def handle(_name, cfg, _cloud, log, _args):
> + idevs = None
> + idevs_empty = None
> +
> + if "grub-dpkg" in cfg:
> + idevs = util.get_cfg_option_str(cfg["grub-dpkg"],
> + "grub-pc/install_devices", None)
> + idevs_empty = util.get_cfg_option_str(cfg["grub-dpkg"],
> + "grub-pc/install_devices_empty", None)
> +
> + if ((os.path.exists("/dev/sda1") and not os.path.exists("/dev/sda")) or
> + (os.path.exists("/dev/xvda1") and not os.path.exists("/dev/xvda"))):
> + if idevs == None:
> + idevs = ""
> + if idevs_empty == None:
> + idevs_empty = "true"
> + else:
> + if idevs_empty == None:
> + idevs_empty = "false"
> + if idevs == None:
> + idevs = "/dev/sda"
> + for dev in ("/dev/sda", "/dev/vda", "/dev/sda1", "/dev/vda1"):
> + if os.path.exists(dev):
> + idevs = dev
> + break
> +
> + # now idevs and idevs_empty are set to determined values
> + # or, those set by user
> +
> + dconf_sel = "grub-pc grub-pc/install_devices string %s\n" % idevs + \
> + "grub-pc grub-pc/install_devices_empty boolean %s\n" % idevs_empty
> + log.debug("setting grub debconf-set-selections with '%s','%s'" %
> + (idevs, idevs_empty))
> +
> + try:
> + util.subp(('debconf-set-selections'), dconf_sel)
> + except:
> + log.error("Failed to run debconf-set-selections for grub-dpkg")
> + log.debug(traceback.format_exc())
>
> === modified file 'cloudinit/CloudConfig/cc_grub_dpkg.py'
> --- cloudinit/CloudConfig/cc_grub_dpkg.py 2012-02-16 17:27:05 +0000
> +++ cloudinit/CloudConfig/cc_grub_dpkg.py 2014-07-03 19:41:46 +0000
> @@ -44,7 +44,8 @@
> idevs_empty = "false"
> if idevs == None:
> idevs = "/dev/sda"
> - for dev in ("/dev/sda", "/dev/vda", "/dev/sda1", "/dev/vda1"):
> + for dev in ("/dev/sda", "/dev/vda", "/dev/xvda",
> + "/dev/xvda1", "/dev/sda1", "/dev/vda1"):
> if os.path.exists(dev):
> idevs = dev
> break
>
> === modified file 'debian/changelog'
> --- debian/changelog 2014-04-07 15:18:55 +0000
> +++ debian/changelog 2014-07-03 19:41:46 +0000
> @@ -1,3 +1,13 @@
> +cloud-init (0.6.3-0ubuntu1.14) precise; urgency=medium
> +
> + * fixed issues where grub-pc does not consider xvda (LP: 1336855).
How about "does not consider /dev/xvda as a boot device" to give some context as to what xvda is what it should be considered for.
> + - debian/patches/lp-1336855-grub_xvda.patch: added xvda as a
> + considered device
> + - debian/cloud-init.postinst: check to see if grub-pc is configured
> + for the right device.
> +
> + -- Ben Howard <ben.howard at ubuntu.com> Wed, 02 Jul 2014 13:42:12 -0600
> +
> cloud-init (0.6.3-0ubuntu1.13) precise-proposed; urgency=medium
>
> * debian/patches/lp-1302229-fix_futils_azure.patch: fixed imports and
>
> === modified file 'debian/cloud-init.postinst'
> --- debian/cloud-init.postinst 2013-10-16 13:17:35 +0000
> +++ debian/cloud-init.postinst 2014-07-03 19:41:46 +0000
> @@ -157,6 +157,63 @@
>
> # if there is generic cloud-config preseed, apply them
> handle_preseed_local_cloud_config
> +
> + ### Begin fix for LP: 1336855
> + # fix issue where cloud-init misidentifies the location of grub
> + if [ -x /usr/sbin/grub-install ]; then
> +
> + # First, identify the root device for the parent.
> + for parm in $(cat /proc/cmdline); do
> + dev=$(echo $parm | awk -F\= '{print$NF}')
Add a comment describing $NF to that it's clear that a 'parm=dev=UUID=xxxxxx' would result in 'dev=xxxxxx' not 'dev=UUID=xxxxxx'
> + case $parm in
> + root=UUID*) [ -d /dev/disk/by-uuid ] &&
> + root_dev=$(readlink -f /dev/disk/by-uuid/$dev);;
> + root=LABEL*) [ -d /dev/disk/by-label ] &&
> + root_dev=$(readlink -f /dev/disk/by-label/$dev);;
> + root=/dev*) [ -d /dev ] &&
> + root_dev=$(readlink -f $dev);;
> + esac
> + [ -n "$root_dev" ] && break
> + done
> +
> + # Only deal with simple, cloud-based devices
Might want to call out what you're trying to exclude.
> + case $root_dev in
> + /dev/vda*|/dev/xvda*|/dev/sda*) safe_to_continue=1;;
> + *) safe_to_continue=0;;
> + esac
> +
> + if [ "$safe_to_continue" -eq 1 ]; then
> + # Find out where grub thinks the root device is
> + db_get grub-pc/install_devices && grub_cfg_dev=${RET} || :
> + db_get grub-pc/install_devices_empty && grub_dev_empty=${RET} || :
> +
> + # Find out the parent device for the root device
> + block_path=$(udevadm info -q path -n $root_dev | awk '-Fblock/' '{print$NF}')
> + pdev=$(echo $block_path | awk '-F/' '{print$1}')
> + [ -n "$pdev" ] && parent_dev="/dev/$pdev"
> +
> + # Make sure that we what we think is root, is the same as the parent
> + # device. We need to be safe about chroots.
> + root_matches=0
> + if [ -e /etc/mtab ]; then
> + while read dev mount _ _ _ _; do
> + [ "$mount" = "/" -a "$root_dev" = "$dev" ] &&
> + root_matches=1 && break
> + done < /etc/mtab
> + fi
> +
> + # If everything checks out, set grub-pc/install_devices and re-install
> + # grub.
> + if [ "$grub_dev_empty" = "false" -a -n "$parent_dev" -a "$parent_dev" != "$grub_cfg_dev" -a "$root_matches" -eq 1 ]; then
> + echo "Reconfiguring grub install device due to mismatch"
> + db_set grub-pc/install_devices "$parent_dev"
> + grub-install $parent_dev ||
> + echo "WARNING! Unable to fix grub device mismatch. You may be broken."
> + fi
> + fi
> + fi
> + ### END fix for LP: 1336855
> +
> fi
>
> #DEBHELPER#
>
> === added file 'debian/patches/lp-1336855-grub_xvda.patch'
> --- debian/patches/lp-1336855-grub_xvda.patch 1970-01-01 00:00:00 +0000
> +++ debian/patches/lp-1336855-grub_xvda.patch 2014-07-03 19:41:46 +0000
> @@ -0,0 +1,19 @@
> +Description: consider xvda devices for grub-pc configuration
> + Cloud-init previously did not consider /dev/xvda and /dev/xvda1 for
> + setting as the grub device. Subiquently, unattended updates with
> + grub may cause the instance to be unusable.
> +Author: Ben Howard <ben.howard at ubuntu.com>
> +Bug: https://bugs.launchpad.net/bugs/1336855
> +Forwarded: yes
> +--- a/cloudinit/CloudConfig/cc_grub_dpkg.py
> ++++ b/cloudinit/CloudConfig/cc_grub_dpkg.py
> +@@ -44,7 +44,8 @@
> + idevs_empty = "false"
> + if idevs == None:
> + idevs = "/dev/sda"
> +- for dev in ("/dev/sda", "/dev/vda", "/dev/sda1", "/dev/vda1"):
> ++ for dev in ("/dev/sda", "/dev/vda", "/dev/xvda",
> ++ "/dev/xvda1", "/dev/sda1", "/dev/vda1"):
> + if os.path.exists(dev):
> + idevs = dev
> + break
>
> === modified file 'debian/patches/series'
> --- debian/patches/series 2014-04-07 14:59:56 +0000
> +++ debian/patches/series 2014-07-03 19:41:46 +0000
> @@ -22,3 +22,4 @@
> lp-1269626-azure_new_instance.patch
> lp-1292648-azure-format-ephemeral-new.patch
> lp-1302229-fix_futils_azure.patch
> +lp-1336855-grub_xvda.patch
>
--
https://code.launchpad.net/~utlemming/ubuntu/precise/cloud-init/lp1336855/+merge/225549
Your team Ubuntu Development Team is requested to review the proposed merge of lp:~utlemming/ubuntu/precise/cloud-init/lp1336855 into lp:ubuntu/precise-proposed/cloud-init.
More information about the Ubuntu-reviews
mailing list