Accepting request 224032 from home:michael-chang:branches:Base:System

- grub2-snapper-plugin: fix important snapshots are not marked as such
  in grub2 menu, also display the snapshot entries in the format
  "important distribution version (kernel_version, timestamp, pre/post)"
  (bnc#864842)

- refresh grub2-fix-menu-in-xen-host-server.patch (bnc#859361)
  * prevent 10_linux from booting xen kernel without pv_opt support
    on systems other than xen PV domU guest   
  * prevent 20_linux_xen.in from setting up nested virt running from
    Xen domU
- refresh grub2-fix-Grub2-with-SUSE-Xen-package-install.patch
  * adjust accordingly

OBS-URL: https://build.opensuse.org/request/show/224032
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=79
This commit is contained in:
Marcus Meissner 2014-03-03 09:08:52 +00:00 committed by Git OBS Bridge
parent 929faf54e7
commit 73ea23ebe4
4 changed files with 99 additions and 12 deletions

View File

@ -21,20 +21,17 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
===================================================================
--- grub-2.02~beta2.orig/util/grub.d/20_linux_xen.in
+++ grub-2.02~beta2/util/grub.d/20_linux_xen.in
@@ -170,6 +170,19 @@ file_is_not_sym () {
@@ -175,6 +175,16 @@ file_is_not_sym () {
xen_list=`for i in /boot/xen*.gz; do
if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" && test ! -L "$i" ; then echo -n "$i " ; fi
if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi
done`
+
+# bnc#774666 - Grub2 does not offer a Xen entry after installing hypervisor and tools
+# This is a workaround to the install sequence of xen-kernel and xen is unpredictable
+if [ "x${xen_list}" = "x" ] &&
+if [ "x${xen_list}" = "x" ]; then
+# If the code reaches here, it means that xen-kernel has been installed, but xen hypervisor
+# is missing. This is not likely a sane condition for dom0. We assume this is xen-kernel
+# triggers config update prior to the xen package.
+# Test the system is dom0, if it is, we set the xen_list to /boot/xen.gz which should become
+# available after xen package installed.
+ [ -e /proc/xen/xsd_port -o ! -e /proc/xen ]; then
+ xen_list="/boot/xen.gz"
+fi
+

View File

@ -40,16 +40,72 @@ Index: grub-2.02~beta2/util/grub.d/20_linux_xen.in
===================================================================
--- grub-2.02~beta2.orig/util/grub.d/20_linux_xen.in
+++ grub-2.02~beta2/util/grub.d/20_linux_xen.in
@@ -165,8 +165,10 @@ file_is_not_sym () {
@@ -26,6 +26,12 @@ datarootdir="@datarootdir@"
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR="@localedir@"
+if [ ! -e /proc/xen/xsd_port -a -e /proc/xen ]; then
+# we're running on xen domU guest
+# prevent setting up nested virt on HVM or PV domU guest
+ exit 0
+fi
+
CLASS="--class gnu-linux --class gnu --class os --class xen"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
@@ -165,7 +171,9 @@ file_is_not_sym () {
esac
}
-xen_list=`for i in /boot/xen*; do
- if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi
+# bnc#757895 - Grub2 menu items incorrect when "Xen Virtual Machines Host Server" selected
+# wildcard expasion with correct suffix (.gz) and exclude symlinks for not generating many duplicated menu entries
+# wildcard expasion with correct suffix (.gz) for not generating many duplicated menu entries
+xen_list=`for i in /boot/xen*.gz; do
+ if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" && test ! -L "$i" ; then echo -n "$i " ; fi
if grub_file_is_not_garbage "$i" && file_is_not_sym "$i" ; then echo -n "$i " ; fi
done`
prepare_boot_cache=
boot_device_id=
Index: grub-2.02~beta2/util/grub.d/10_linux.in
===================================================================
--- grub-2.02~beta2.orig/util/grub.d/10_linux.in
+++ grub-2.02~beta2/util/grub.d/10_linux.in
@@ -207,6 +207,40 @@ while [ "x$list" != "x" ] ; do
fi
done
+ # try to get the kernel config if $linux is a symlink
+ if test -z "${config}" ; then
+ lnk_version=`basename \`readlink -f $linux\` | sed -e "s,^[^0-9]*-,,g"`
+ if (test -n ${lnk_version} && test -e "${dirname}/config-${lnk_version}") ; then
+ config="${dirname}/config-${lnk_version}"
+ fi
+ fi
+
+ # check if we are in xen domU
+ if [ ! -e /proc/xen/xsd_port -a -e /proc/xen ]; then
+ # we're running on xen domU guest
+ dmi=/sys/class/dmi/id
+ if [ -r "${dmi}/product_name" -a -r "${dmi}/sys_vendor" ]; then
+ product_name=`cat ${dmi}/product_name`
+ sys_vendor=`cat ${dmi}/sys_vendor`
+ if test "${sys_vendor}" = "Xen" -a "${product_name}" = "HVM domU"; then
+ # xen HVM guest
+ xen_pv_domU=false
+ fi
+ fi
+ else
+ # we're running on baremetal or xen dom0
+ xen_pv_domU=false
+ fi
+
+ if test "$xen_pv_domU" = "false" ; then
+ # prevent xen kernel without pv_opt support from booting
+ if (grep -qx "CONFIG_XEN=y" "${config}" 2> /dev/null && grep -qvx "CONFIG_PARAVIRT=y" "${config}" 2> /dev/null); then
+ echo "Skip xenlinux kernel $linux" >&2
+ list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
+ continue
+ fi
+ fi
+
initramfs=
if test -n "${config}" ; then
initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"`

View File

@ -41,8 +41,23 @@ for s_dir in /.snapshots/*; do
continue
fi
# bnc#864842 Important snapshots are not marked as such in grub2 menu
# the format is "important distribution version (kernel_version, timestamp, pre/post)"
cfgs="${s_dir}/${snapshot_menuentry_name} ${snapshot}/${snapshot_menuentry_cfg}"
date=`xmllint --xpath '/snapshot/date/text()' "${s_dir}/info.xml" || echo ""`
date=`echo $date | sed 's/\(.*\) \(.*\):.*/\1,\2/'`
important=`xmllint --xpath "/snapshot/userdata[key='important']/value/text()" "${s_dir}/info.xml" || echo ""`
stype=`xmllint --xpath '/snapshot/type/text()' "${s_dir}/info.xml" || echo ""`
kernel_ver=`readlink /boot/vmlinuz | sed 's/vmlinuz-\([^-]*\).*/\1/'`
eval `cat ${snapshot}/etc/os-release`
test "$important" = "yes" && important="*" || important=""
test "$stype" = "single" && stype=""
if test -n "$stype"; then
title="${important}${NAME} $VERSION ($kernel_ver,$date,$stype)"
else
title="${important}${NAME} $VERSION ($kernel_ver,$date)"
fi
cat <<EOF > "${snapper_cfg}.new"
@ -52,7 +67,7 @@ for s_dir in /.snapshots/*; do
if [ -f "\$snap_cfg" ]; then
snapshot_found=true
submenu "$date" "\$snap" "\$snap_cfg" {
submenu "$title" "\$snap" "\$snap_cfg" {
set subvol="\$2"
export subvol
source "\$3"

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Thu Feb 27 04:30:07 UTC 2014 - mchang@suse.com
- grub2-snapper-plugin: fix important snapshots are not marked as such
in grub2 menu, also display the snapshot entries in the format
"important distribution version (kernel_version, timestamp, pre/post)"
(bnc#864842)
-------------------------------------------------------------------
Mon Feb 24 07:28:42 UTC 2014 - mchang@suse.com
- refresh grub2-fix-menu-in-xen-host-server.patch (bnc#859361)
* prevent 10_linux from booting xen kernel without pv_opt support
on systems other than xen PV domU guest
* prevent 20_linux_xen.in from setting up nested virt running from
Xen domU
- refresh grub2-fix-Grub2-with-SUSE-Xen-package-install.patch
* adjust accordingly
-------------------------------------------------------------------
Thu Feb 20 14:43:21 UTC 2014 - jw@suse.com