[PATCH] kdump-module-setup.sh: Handle static IPs defined in NetworkManager gui
by Marc Milgram
NetworkManager changed the format of ifcfg-device files. They may define
static IP addresses with the following format:
IPADDR0=192.168.122.100
PREFIX0=24
There may be up to 255 ip addresses for a network device - each with a unique
number tagged to the end of IPADDR and PREFIX.
Prior to this fix, kdump only handled static ip addresses defined with
IPADDR=192.168.122.100
PREFIX=24
ie. without the number.
The solution is to use "ip" commands to find the correct network information.
Tested with both static and dynamic IP addresses.
Signed-off-by: Marc Milgram <mmilgram(a)redhat.com>
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 2a16900..9309853 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -67,14 +67,17 @@ kdump_setup_dns() {
}
#$1: netdev name
-#checking /etc/sysconfig/network-scripts/ifcfg-$1,
+#$2: srcaddr
#if it use static ip echo it, or echo null
kdump_static_ip() {
- . /etc/sysconfig/network-scripts/ifcfg-$1
- if [ -n "$IPADDR" ]; then
- [ -z "$NETMASK" -a -n "$PREFIX" ] && \
- NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2)
- echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
+ local _netmask _gateway
+ local _netdev="$1" _srcaddr="$2"
+ local _ipaddr=$(ip addr show dev $_netdev permanent | \
+ awk "/ $_srcaddr\/.* $_netdev\$/{print \$2}")
+ if [ -n "$_ipaddr" ]; then
+ _netmask=$(ipcalc -m $_ipaddr | cut -d'=' -f2)
+ _gateway=$(ip route list dev $_netdev | awk '/^default /{print $3}')
+ echo -n "${_srcaddr}::${_gateway}:${_netmask}::"
fi
}
@@ -181,7 +184,7 @@ kdump_setup_znet() {
# Setup dracut to bringup a given network interface
kdump_setup_netdev() {
- local _netdev=$1
+ local _netdev=$1 $_srcaddr=$2
local _static _proto _ip_conf _ip_opts _ifname_opts
if [ "$(uname -m)" = "s390x" ]; then
@@ -189,7 +192,7 @@ kdump_setup_netdev() {
fi
_netmac=$(kdump_get_mac_addr $_netdev)
- _static=$(kdump_static_ip $_netdev)
+ _static=$(kdump_static_ip $_netdev $_srcaddr)
if [ -n "$_static" ]; then
_proto=none
else
@@ -223,8 +226,9 @@ kdump_setup_netdev() {
#Function:kdump_install_net
#$1: config values of net line in kdump.conf
+#$2: srcaddr of network device
kdump_install_net() {
- local _server _netdev
+ local _server _netdev _srcaddr
local config_val="$1"
_server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1`
@@ -239,13 +243,15 @@ kdump_install_net() {
if [ -n "`echo $_netdev | grep via`" ]
then
# we are going to a different subnet
+ _srcaddr=`echo $_netdev|awk '{print $7}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $5;}'|head -n 1`
else
# we are on the same subnet
+ _srcaddr=`echo $_netdev|awk '{print $5}'|head -n 1`
_netdev=`echo $_netdev|awk '{print $3}'|head -n 1`
fi
- kdump_setup_netdev "${_netdev}"
+ kdump_setup_netdev "${_netdev}" "${_srcaddr}"
#save netdev used for kdump as cmdline
# Whoever calling kdump_install_net() is setting up the default gateway,
9 years, 10 months
[PATCH 3/3 resend] Modify the kexec-tools.spec file to generate a kdump-anaconda-addon subpackage
by Arthur Zou
Signed-off-by: Arthur Zou <zzou(a)redhat.com>
---
kexec-tools.spec | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index a1490db..9bb004b 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -26,6 +26,7 @@ Source19: eppic_030413.tar.gz
Source20: kdump-lib.sh
Source21: kdump-in-cluster-environment.txt
Source22: kdump-dep-generator.sh
+Source23: kdump-anaconda-addon-0.1.tar.gz
#######################################
# These are sources for mkdumpramfs
@@ -96,12 +97,21 @@ The eppic_makedumpfile.so shared object is loaded by the
or confidential kernel data from a dumpfile.
%endif
+%package -n kdump-anaconda-addon
+Version: 0.1
+Release: 1%{?dist}
+Summary: Kdump configration anaconda addon
+Requires: anaconda >= 21.33
+%description -n kdump-anaconda-addon
+Kdump anaconda addon
+
%prep
%setup -q
mkdir -p -m755 kcp
tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
+tar -z -x -v -f %{SOURCE23}
%patch601 -p1
@@ -133,6 +143,7 @@ make -C eppic/libeppic
make -C makedumpfile-1.5.6 LINKTYPE=dynamic USELZO=on USESNAPPY=on
%endif
make -C kexec-tools-po
+make -C kdump-anaconda-addon-0.1/po
%install
make install DESTDIR=$RPM_BUILD_ROOT
@@ -180,6 +191,8 @@ install -m 755 makedumpfile-1.5.6/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdi
%endif
make -C kexec-tools-po install DESTDIR=$RPM_BUILD_ROOT
%find_lang %{name}
+make -C kdump-anaconda-addon-0.1 install DESTDIR=$RPM_BUILD_ROOT
+%find_lang kdump-anaconda-addon
%define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g')
@@ -312,6 +325,10 @@ done
%{_libdir}/eppic_makedumpfile.so
%endif
+%files -n kdump-anaconda-addon -f kdump-anaconda-addon.lang
+%{_datadir}/anaconda/addons/com_redhat_kdump
+%doc
+
%changelog
* Wed Apr 30 2014 WANG Chao <chaowang(a)redhat.com> - 2.0.6-5
- Remove nofail mount option
--
1.8.4.2
9 years, 10 months
About kdump error handler
by Dave Young
Hi, Chao and Vivek
As far as I understand your new error handler will jump into kdump.sh in
case any error in systemd. It will fix most of the problems. But there will
be limitation for new error handler service that dump_to_rootfs will always
fail in case error happens before entering kdump.sh.
>From the thread link you sent about systemd discussion, they proposed below
solution:
http://thread.gmane.org/gmane.comp.sysutils.systemd.devel/18278
It will create a local-fs-all.target for us to wait them, I'd like to know
what's the conclusion, why can't we do this way?
Possiblly there's other fail point other than fsck/mount in systemd which
we can not catch, is this the reason we ignore the proposal?
Thanks
Dave
9 years, 10 months
[Patch v7 1/6] introduce several basic utility function
by Baoquan He
These utility function will be shared by several files, they are all
operation related to mount stuff.
Meantime define DEFAULT_PATH="/var/crash".
v5-> v6:
Since in rhel7 nfs4 becomes default nfs version, and its fstype is
nfs4. So change the implementation of get_fs_type_from_target(),
whatever fstype returned from findmount, just echo nfs as fstype for all
nfs version.
v6->v7:
Introduce is_fs_type_nfs to check if fstype is nfs or nfs4 per Vivek's
idea.
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
kdump-lib.sh | 28 ++++++++++++++++++++++++++++
mkdumprd | 2 +-
2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh
index 831d063..e20197e 100755
--- a/kdump-lib.sh
+++ b/kdump-lib.sh
@@ -3,6 +3,7 @@
# Kdump common variables and functions
#
+DEFAULT_PATH="/var/crash/"
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
@@ -21,6 +22,13 @@ is_raw_dump_target()
grep -q "^raw" /etc/kdump.conf
}
+is_fs_type_nfs()
+{
+ local _fstype=$1
+ [ $_fstype = "nfs" ] || [ $_fstype = "nfs4" ] && return 0
+ return 1
+}
+
strip_comments()
{
echo $@ | sed -e 's/\(.*\)#.*/\1/'
@@ -82,6 +90,26 @@ get_root_fs_device()
return
}
+get_mntpoint_from_path()
+{
+ echo $(df $1 | tail -1 | awk '{print $NF}')
+}
+
+get_target_from_path()
+{
+ echo $(df $1 | tail -1 | awk '{print $1}')
+}
+
+get_fs_type_from_target()
+{
+ echo $(findmnt -k -f -n -r -o FSTYPE $1)
+}
+
+get_mntpoint_from_target()
+{
+ echo $(findmnt -k -f -n -r -o TARGET $1)
+}
+
# get_option_value <option_name>
# retrieves value of option defined in kdump.conf
get_option_value() {
diff --git a/mkdumprd b/mkdumprd
index 84f1e18..3849866 100644
--- a/mkdumprd
+++ b/mkdumprd
@@ -12,7 +12,7 @@ export IN_KDUMP=1
conf_file="/etc/kdump.conf"
SSH_KEY_LOCATION="/root/.ssh/kdump_id_rsa"
SAVE_PATH=$(grep ^path $conf_file| cut -d' ' -f2)
-[ -z "$SAVE_PATH" ] && SAVE_PATH="/var/crash"
+[ -z "$SAVE_PATH" ] && SAVE_PATH=$DEFAULT_PATH
extra_modules=""
dracut_args=("--hostonly" "-o" "plymouth dash resume")
OVERRIDE_RESETTABLE=0
--
1.8.5.3
9 years, 10 months
[PATCH 3/3] Modify the kexec-tools.spec file to generate a kdump-anaconda-addon subpackage
by Arthur Zou
Signed-off-by: Arthur Zou <zzou(a)redhat.com>
---
kexec-tools.spec | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/kexec-tools.spec b/kexec-tools.spec
index c738162..edc51a4 100644
--- a/kexec-tools.spec
+++ b/kexec-tools.spec
@@ -26,6 +26,7 @@ Source18: kdump.sysconfig.s390x
Source19: eppic_030413.tar.gz
Source20: kdump-lib.sh
Source21: kdump-in-cluster-environment.txt
+Source22: kdump-anaconda-addon-0.1.tar.gz
#######################################
# These are sources for mkdumpramfs
@@ -43,6 +44,12 @@ Requires: dracut, dracut-network, ethtool
BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel
BuildRequires: pkgconfig intltool gettext
BuildRequires: systemd-units
+BuildRequires: gettext
+BuildRequires: python2-devel
+BuildRequires: python-cpio
+BuildRequires: anaconda >= 19
+Requires: anaconda >= 19
+Requires: python-cpio
%ifarch %{ix86} x86_64 ppc64 ia64 ppc s390x
Obsoletes: diskdumputils netdump
%endif
@@ -118,13 +125,22 @@ The eppic_makedumpfile.so shared object is loaded by the
or confidential kernel data from a dumpfile.
%endif
+%package -n kdump-anaconda-addon
+Version: 0.1
+Release: 1%{?dist}
+Summary: Kdump configration anaconda addon
+License: GPLv2+
+URL: git@github.com:daveyoung/kdump-anaconda-addon.git
+%description -n kdump-anaconda-addon
+Kdump anaconda addon
+
%prep
%setup -q
mkdir -p -m755 kcp
tar -z -x -v -f %{SOURCE9}
tar -z -x -v -f %{SOURCE19}
-
+tar -z -x -v -f %{SOURCE22}
%patch101 -p1
%patch301 -p1
@@ -150,6 +166,7 @@ tar -z -x -v -f %{SOURCE19}
%patch619 -p1
tar -z -x -v -f %{SOURCE13}
+tar -z -x -v -f %{SOURCE22}
%ifarch ppc
%define archdef ARCH=ppc
@@ -182,6 +199,7 @@ make -C eppic/libeppic
make -C makedumpfile-1.5.4 LINKTYPE=dynamic USELZO=on USESNAPPY=on
%endif
make -C kexec-tools-po
+make -C kdump-anaconda-addon-0.1/po
%install
make install DESTDIR=$RPM_BUILD_ROOT
@@ -228,6 +246,8 @@ install -m 755 makedumpfile-1.5.4/eppic_makedumpfile.so $RPM_BUILD_ROOT/%{_libdi
%endif
make -C kexec-tools-po install DESTDIR=$RPM_BUILD_ROOT
%find_lang %{name}
+make -C kdump-anaconda-addon-0.1 install DESTDIR=$RPM_BUILD_ROOT
+%find_lang kdump-anaconda-addon
%define remove_dracut_prefix() %(echo -n %1|sed 's/.*dracut-//g')
@@ -336,7 +356,7 @@ do
fi
done
-%files -f %{name}.lang
+%files -f %{name}.lang
/sbin/*
/usr/sbin/*
%{_bindir}/*
@@ -366,6 +386,10 @@ done
%{_libdir}/eppic_makedumpfile.so
%endif
+%files -n kdump-anaconda-addon -f kdump-anaconda-addon.lang
+%{_datadir}/anaconda/addons/com_redhat_kdump
+%doc
+
%changelog
* Thu Apr 03 2014 WANG Chao <chaowang(a)redhat.com> - 2.0.4-27
- Add fence_kdump support for generic clusters
--
1.8.4.2
9 years, 10 months
[PATCH 0/5] Kdump error handling service
by WANG Chao
Hi, All
This patchset introduce a new kdump emergency service. It will override the
existing emergency.service. When fatal error occurs, this emergency service
will be triggered and systemd will isolate to emergency path.
This kdump emergency service can will read kdump.conf and act according to the
configired "default action" (reboot/poweroff/halt/shell/dump_to_rootfs).
Along with this patchset, kdump-capture.service is introduced as a service unit
to run kdump.sh. When kdump-capture.service fails, systemd will isolate to
kdump emergency service. I copied all the dependencies from
dracut-pre-pivot.service to kdump-capture.service so that kdump.sh will be
called the correct time window.
WANG Chao (5):
mkdumprd: changes for mount point and options in 2nd kernel
cleanup: extract functions from kdump.sh to kdump-lib.sh
Introduce kdump error handling service
Introduce kdump capture service
disable dracut-emergency.service the whole time
dracut-kdump-capture.service | 32 ++++++++
dracut-kdump-emergency.service | 32 ++++++++
dracut-kdump-error-handler.sh | 10 +++
dracut-kdump.sh | 161 +----------------------------------------
dracut-module-setup.sh | 7 +-
kdump-lib.sh | 161 +++++++++++++++++++++++++++++++++++++++++
kexec-tools.spec | 7 +-
mkdumprd | 25 ++++---
8 files changed, 264 insertions(+), 171 deletions(-)
create mode 100644 dracut-kdump-capture.service
create mode 100644 dracut-kdump-emergency.service
create mode 100755 dracut-kdump-error-handler.sh
--
1.9.0
9 years, 10 months
[PATCH] dracut-module-setup.sh: recognize the IPADDR[0-3] in ifcfg-xx
by Baoquan He
User complained they set static ip address in ifcfg-xx with IPADDR0,
but that ip address is not set successfully. That's because the
IPADDRn can not be recognized by dracut-module-setup.sh. Even though
in initscript, ifup-eth can recognize IPADDDR[0-255], and if 2 IPADDRxx
missed the latter will be skipped, that's enough to only respect
IPADDR[0-3].
Signed-off-by: Baoquan He <bhe(a)redhat.com>
---
dracut-module-setup.sh | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index bdadf7c..738d304 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -70,11 +70,18 @@ kdump_setup_dns() {
#checking /etc/sysconfig/network-scripts/ifcfg-$1,
#if it use static ip echo it, or echo null
kdump_static_ip() {
+ local _ipaddr
+
. /etc/sysconfig/network-scripts/ifcfg-$1
- if [ -n "$IPADDR" ]; then
+ _ipaddr=${IPADDR:-$IPADDR0}
+ _ipaddr=${_ipaddr:-$IPADDR1}
+ _ipaddr=${_ipaddr:-$IPADDR2}
+ _ipaddr=${_ipaddr:-$IPADDR3}
+
+ if [ -n "$_ipaddr" ]; then
[ -z "$NETMASK" -a -n "$PREFIX" ] && \
- NETMASK=$(ipcalc -m $IPADDR/$PREFIX | cut -d'=' -f2)
- echo -n "${IPADDR}::${GATEWAY}:${NETMASK}::"
+ NETMASK=$(ipcalc -m $_ipaddr/$PREFIX | cut -d'=' -f2)
+ echo -n "${_ipaddr}::${GATEWAY}:${NETMASK}::"
fi
}
--
1.8.5.3
9 years, 10 months
[PATCH 1/3] Add a anaconda addon to configurate kdump in the system installation process
by Arthur Zou
Currently this work is done by firstboot. Now we move to anaconda addon
to configurate in the system installation process.
Signed-off-by: Arthur Zou <zzou(a)redhat.com>
---
kdump-anaconda-addon/Makefile | 81 ++++++
kdump-anaconda-addon/README | 29 +++
kdump-anaconda-addon/com_redhat_kdump/__init__.py | 0
kdump-anaconda-addon/com_redhat_kdump/common.py | 88 +++++++
kdump-anaconda-addon/com_redhat_kdump/constants.py | 23 ++
.../com_redhat_kdump/gui/__init__.py | 0
.../com_redhat_kdump/gui/spokes/RHEL.glade | 274 +++++++++++++++++++++
.../com_redhat_kdump/gui/spokes/__init__.py | 0
.../com_redhat_kdump/gui/spokes/fedora.glade | 218 ++++++++++++++++
.../com_redhat_kdump/gui/spokes/kdump.py | 192 +++++++++++++++
kdump-anaconda-addon/com_redhat_kdump/i18n.py | 27 ++
.../com_redhat_kdump/ks/__init__.py | 0
kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py | 128 ++++++++++
.../com_redhat_kdump/tui/__init__.py | 0
.../com_redhat_kdump/tui/spokes/__init__.py | 0
.../com_redhat_kdump/tui/spokes/kdump.py | 87 +++++++
kdump-anaconda-addon/po/Makefile | 75 ++++++
kdump-anaconda-addon/po/kdump-anaconda-addon.pot | 81 ++++++
18 files changed, 1303 insertions(+)
create mode 100644 kdump-anaconda-addon/Makefile
create mode 100644 kdump-anaconda-addon/README
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/common.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/constants.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/spokes/RHEL.glade
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/spokes/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/spokes/fedora.glade
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/spokes/kdump.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/i18n.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/ks/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/tui/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/tui/spokes/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/tui/spokes/kdump.py
create mode 100644 kdump-anaconda-addon/po/Makefile
create mode 100644 kdump-anaconda-addon/po/kdump-anaconda-addon.pot
diff --git a/kdump-anaconda-addon/Makefile b/kdump-anaconda-addon/Makefile
new file mode 100644
index 0000000..721ce9e
--- /dev/null
+++ b/kdump-anaconda-addon/Makefile
@@ -0,0 +1,81 @@
+NAME = kdump-anaconda-addon
+
+VERSION = 0.1
+
+ADDON = com_redhat_kdump
+TESTS = test
+
+FILES = $(ADDON) \
+ po \
+ Makefile \
+ README
+
+EXCLUDES = \
+ *~ \
+ *.pyc
+
+all:
+ @echo "usage: make dist"
+ @echo " make test"
+ @echo " make install"
+ @echo " make uninstall"
+
+DISTNAME = $(NAME)-$(VERSION)
+ADDONDIR = /usr/share/anaconda/addons/
+DISTBALL = $(DISTNAME).tar.gz
+NUM_PROCS = $$(getconf _NPROCESSORS_ONLN)
+
+install:
+ mkdir -p $(DESTDIR)$(ADDONDIR)
+ cp -rv $(ADDON) $(DESTDIR)$(ADDONDIR)
+ make install-po-files
+
+uninstall:
+ rm -rfv $(DESTDIR)$(ADDONDIR)
+
+dist:
+ rm -rf $(DISTNAME)
+ mkdir -p $(DISTNAME)
+ @if test -d ".git"; \
+ then \
+ echo Creating ChangeLog && \
+ ( cd "$(top_srcdir)" && \
+ echo '# Generate automatically. Do not edit.'; echo; \
+ git log --stat --date=short ) > ChangeLog.tmp \
+ && mv -f ChangeLog.tmp $(DISTNAME)/ChangeLog \
+ || ( rm -f ChangeLog.tmp ; \
+ echo Failed to generate ChangeLog >&2 ); \
+ else \
+ echo A git clone is required to generate a ChangeLog >&2; \
+ fi
+ for file in $(FILES); do \
+ cp -rpv $$file $(DISTNAME)/$$file; \
+ done
+ for excl in $(EXCLUDES); do \
+ find $(DISTNAME) -name "$$excl" -delete; \
+ done
+ tar -czvf $(DISTBALL) $(DISTNAME)
+ rm -rf $(DISTNAME)
+
+potfile:
+ $(MAKE) DESTDIR=$(DESTDIR) -C po potfile
+
+po-pull:
+ tx pull -a --disable-overwrite
+
+install-po-files:
+ $(MAKE) -C po install
+
+test:
+ @echo "***Running pylint checks***"
+ @find . -name '*.py' -print|xargs -n1 --max-procs=$(NUM_PROCS) pylint -E 2> /dev/null
+ @echo "[ OK ]"
+ @echo "***Running unittests checks***"
+ @PYTHONPATH=. nosetests --processes=-1 -vw tests/
+
+runpylint:
+ @find . -name '*.py' -print|xargs -n1 --max-procs=$(NUM_PROCS) pylint -E 2> /dev/null
+ @echo "[ OK ]"
+
+unittest:
+ PYTHONPATH=. nosetests --processes=-1 -vw tests/
diff --git a/kdump-anaconda-addon/README b/kdump-anaconda-addon/README
new file mode 100644
index 0000000..50a7c97
--- /dev/null
+++ b/kdump-anaconda-addon/README
@@ -0,0 +1,29 @@
+This is an anaconda addon for configuring kdump. To use, copy the
+com_redhat_kdump directory into /usr/share/anaconda/addons on your
+installation media.
+
+The syntax of the addon's kickstart section is:
+
+%addon com_redhat_kdump (--enable|--disable) --reserve-mb=("auto"|<amount>)
+%end
+
+Note that support for arguments on the %addon line was added in
+anaconda-21.23. See anaconda commit 3a512e4f9e15977f0ce2d0bbe39e841b881398f3,
+https://bugzilla.redhat.com/show_bug.cgi?id=1065674
+
+How to test the kdump-anaconda-addon?
+You can provide an updates image in the kernel boot arguments as updates=,
+and the contents will be added to the stage2 filesystem.
+https://fedoraproject.org/wiki/Anaconda/Updates has more details, but usually
+the easiest is to make it available via HTTP or FTP and provide a url to updates=.
+
+The file is a gzip-compressed cpio archive, and the files need to be put into
+stage2 in /usr/share/anaconda/addons, so something like this will work to create
+an updates.img:
+
+mkdir -p updates/usr/share/anaconda/addons
+cp -r com_redhat_kdump updates/usr/share/anaconda/addons/
+( cd updates; find . | cpio -oc | gzip -c9 ) > updates.img
+
+then you can upload the updates.img to some http or ftp server so the anaconda
+can get it by boot parameter as updates=http://some.website.com/path/to/updates.img.
diff --git a/kdump-anaconda-addon/com_redhat_kdump/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/common.py b/kdump-anaconda-addon/com_redhat_kdump/common.py
new file mode 100644
index 0000000..cd37131
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/common.py
@@ -0,0 +1,88 @@
+# Kdump configuration common methods
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+import os
+__all__ = ["getReservedMemory", "getTotalMemory", "getMemoryBounds", "getOS"]
+
+from pyanaconda.isys import total_memory
+from pyanaconda.flags import flags
+from com_redhat_kdump.constants import OS_RELEASE
+
+_reservedMemory = None
+def getReservedMemory():
+ """Return the amount of memory currently reserved for kdump in MB."""
+ global _reservedMemory
+
+ # Check if the value has already been read
+ if _reservedMemory is not None:
+ return _reservedMemory
+
+ try:
+ with open("/sys/kernel/kexec_crash_size", "r") as fobj:
+ _reservedMemory = int(fobj.read()) / (1024*1024)
+ return _reservedMemory
+ except (ValueError, IOError):
+ return 0
+
+def getTotalMemory():
+ """Return the total amount of system memory in MB
+
+ This is the amount reported by /proc/meminfo plus the aount
+ currently reserved for kdump.
+ """
+
+ # total_memory return memory in KB, convert to MB
+ availMem = total_memory() / 1024
+
+ return availMem + getReservedMemory()
+
+def getMemoryBounds():
+ """Return a tuple of (lower, upper, step) for kdump reservation limits.
+
+ If there is not enough memory available to use kdump, both lower and
+ upper will be 0.
+ """
+
+ totalMemory = getTotalMemory()
+
+ if flags.targetarch == 'ppc64':
+ lowerBound = 256
+ minUsable = 1024
+ step = 1
+ else:
+ lowerBound = 128
+ minUsable = 256
+ step = 1
+
+ upperBound = (totalMemory - minUsable) - (totalMemory % step)
+
+ if upperBound < lowerBound:
+ upperBound = lowerBound = 0
+
+ return (lowerBound, upperBound, step)
+
+def getOS():
+ with open(os.path.normpath(OS_RELEASE), "r") as fobj:
+ line = fobj.readline()
+
+ if not "Fedora" in line:
+ return "redhat"
+ else:
+ return "fedora"
diff --git a/kdump-anaconda-addon/com_redhat_kdump/constants.py b/kdump-anaconda-addon/com_redhat_kdump/constants.py
new file mode 100644
index 0000000..aab9537
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/constants.py
@@ -0,0 +1,23 @@
+# Kdump configuration constants
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+# The location of the kdump config file
+OS_RELEASE = "/etc/os-release"
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/gui/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/RHEL.glade b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/RHEL.glade
new file mode 100644
index 0000000..272f745
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/RHEL.glade
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface domain="kdump-anaconda-addon">
+ <requires lib="gtk+" version="3.6"/>
+ <!-- interface-requires AnacondaWidgets 1.0 -->
+ <object class="AnacondaSpokeWindow" id="KdumpWindow">
+ <property name="startup_id">filler</property>
+ <property name="can_focus">False</property>
+ <property name="startup_id">filler</property>
+ <property name="window_name" translatable="yes">KDUMP</property>
+ <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
+ <child internal-child="main_box">
+ <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child internal-child="nav_box">
+ <object class="GtkEventBox" id="AnacondaSpokeWindow-nav_box1">
+ <property name="app_paintable">True</property>
+ <property name="can_focus">False</property>
+ <child internal-child="nav_area">
+ <object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
+ <property name="can_focus">False</property>
+ <property name="margin_left">6</property>
+ <property name="margin_right">6</property>
+ <property name="margin_top">6</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="alignment">
+ <object class="GtkAlignment" id="AnacondaSpokeWindow-alignment1">
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="AnacondaSpokeWindow-action_area1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">10</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkLabel" id="summaryLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Kdump is a kernel crash dumping mechanism. In the event of a system crash, kdump will capture information from your system that can be invaluable in determining the cause of the crash. Note that kdump does require reserving a portion of system memory that will be unavailable for other uses.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="enableKdumpCheck">
+ <property name="label" translatable="yes">_Enable kdump?</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_enable_kdump_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="reservationTypeLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Kdump Memory Reservation:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="autoButton">
+ <property name="label" translatable="yes">_Automatic</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_reservation_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="manualButton">
+ <property name="label" translatable="yes">_Manual</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">autoButton</property>
+ <signal name="toggled" handler="on_reservation_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="toBeReservedLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Memory To Be _Reserved (MB):</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">toBeReservedSpin</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="toBeReservedSpin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="input_purpose">digits</property>
+ <property name="update_policy">if-valid</property>
+ <signal name="value-changed" handler="on_reserved_value_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="totalMemLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Total System Memory (MB):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="totalMemMB">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usableMemLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Usable System Memory (MB):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usableMemMB">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/fedora.glade b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/fedora.glade
new file mode 100644
index 0000000..55442a8
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/fedora.glade
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface domain="kdump-anaconda-addon">
+ <requires lib="gtk+" version="3.6"/>
+ <!-- interface-requires AnacondaWidgets 1.0 -->
+ <object class="AnacondaSpokeWindow" id="KdumpWindow">
+ <property name="startup_id">filler</property>
+ <property name="can_focus">False</property>
+ <property name="startup_id">filler</property>
+ <property name="window_name" translatable="yes">KDUMP</property>
+ <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
+ <child internal-child="main_box">
+ <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child internal-child="nav_box">
+ <object class="GtkEventBox" id="AnacondaSpokeWindow-nav_box1">
+ <property name="app_paintable">True</property>
+ <property name="can_focus">False</property>
+ <child internal-child="nav_area">
+ <object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
+ <property name="can_focus">False</property>
+ <property name="margin_left">6</property>
+ <property name="margin_right">6</property>
+ <property name="margin_top">6</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="alignment">
+ <object class="GtkAlignment" id="AnacondaSpokeWindow-alignment1">
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="AnacondaSpokeWindow-action_area1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">10</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkLabel" id="summaryLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Kdump is a kernel crash dumping mechanism. In the event of a system crash, kdump will capture information from your system that can be invaluable in determining the cause of the crash. Note that kdump does require reserving a portion of system memory that will be unavailable for other uses.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="toBeReservedLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Memory To Be _Reserved (MB):</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">toBeReservedSpin</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="toBeReservedSpin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="input_purpose">digits</property>
+ <property name="update_policy">if-valid</property>
+ <signal name="value-changed" handler="on_reserved_value_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="totalMemLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Total System Memory (MB):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="totalMemMB">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usableMemLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Usable System Memory (MB):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usableMemMB">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="enableKdumpCheck">
+ <property name="label" translatable="yes">_Enable kdump?</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_enable_kdump_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/kdump.py b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/kdump.py
new file mode 100644
index 0000000..cec6b06
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/kdump.py
@@ -0,0 +1,192 @@
+# Kdump anaconda configuration
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+"""Kdump anaconda GUI configuration"""
+
+from gi.repository import Gtk
+
+from pyanaconda.ui.gui.categories.system import SystemCategory
+from pyanaconda.ui.gui.spokes import NormalSpoke
+from pyanaconda.ui.gui.utils import fancy_set_sensitive
+
+from com_redhat_kdump.i18n import _, N_
+from com_redhat_kdump.common import getReservedMemory, getTotalMemory, getMemoryBounds, getOS
+
+__all__ = ["KdumpSpoke"]
+
+class KdumpSpoke(NormalSpoke):
+ """Kdump configuration spoke"""
+
+ builderObjects = ["KdumpWindow", "advancedConfigBuffer"]
+ mainWidgetName = "KdumpWindow"
+ uiFile = "RHEL.glade"
+ translationDomain = "kdump-anaconda-addon"
+
+ icon = "computer-fail-symbolic"
+ title = N_("KDUMP")
+ category = SystemCategory
+ OS = "redhat"
+ def __init__(self, data, storage, payload, instclass):
+ KdumpSpoke.OS = getOS()
+ if KdumpSpoke.OS == "fedora":
+ KdumpSpoke.uiFile = "fedora.glade"
+ NormalSpoke.__init__(self, data, storage, payload, instclass)
+ self._reserveMem = 0
+
+ def initialize(self):
+ NormalSpoke.initialize(self)
+ self._enableButton = self.builder.get_object("enableKdumpCheck")
+ KdumpSpoke.OS = getOS()
+ if KdumpSpoke.OS == "redhat":
+ self._reservationTypeLabel = self.builder.get_object("reservationTypeLabel")
+ self._autoButton = self.builder.get_object("autoButton")
+ self._manualButton = self.builder.get_object("manualButton")
+
+ self._toBeReservedLabel = self.builder.get_object("toBeReservedLabel")
+ self._toBeReservedSpin = self.builder.get_object("toBeReservedSpin")
+ self._totalMemLabel = self.builder.get_object("totalMemLabel")
+ self._totalMemMB = self.builder.get_object("totalMemMB")
+ self._usableMemLabel = self.builder.get_object("usableMemLabel")
+ self._usableMemMB = self.builder.get_object("usableMemMB")
+
+ # Set an initial value and adjustment on the spin button
+ lower, upper, step = getMemoryBounds()
+ adjustment = Gtk.Adjustment(lower, lower, upper, step, step, 0)
+ self._toBeReservedSpin.set_adjustment(adjustment)
+ self._toBeReservedSpin.set_value(lower)
+
+ def refresh(self):
+ # If a reserve amount is requested, set it in the spin button
+ if self.data.addons.com_redhat_kdump.reserveMB != "auto":
+ # Strip the trailing 'M'
+ reserveMB = self.data.addons.com_redhat_kdump.reserveMB
+ if reserveMB and reserveMB[-1] == 'M':
+ reserveMB = reserveMB[:-1]
+ if reserveMB:
+ self._toBeReservedSpin.set_value(int(reserveMB))
+
+ # Set the various labels. Use the spin button signal handler to set the
+ # usable memory label once the other two have been set.
+ self._totalMemMB.set_text("%d" % getTotalMemory())
+ self._toBeReservedSpin.emit("value-changed")
+
+ # Set the states on the toggle buttons and let the signal handlers set
+ # the sensitivities on the related widgets. Set the radio button first,
+ # since the radio buttons' bailiwick is a subset of that of the
+ # enable/disable checkbox.
+ if KdumpSpoke.OS == "redhat":
+ if self.data.addons.com_redhat_kdump.reserveMB == "auto":
+ self._autoButton.set_active(True)
+ self._manualButton.set_active(False)
+ else:
+ self._autoButton.set_active(False)
+ self._manualButton.set_active(True)
+
+ if self.data.addons.com_redhat_kdump.enabled:
+ self._enableButton.set_active(True)
+ else:
+ self._enableButton.set_active(False)
+
+ # Force a toggled signal on the button in case it's state has not changed
+ self._enableButton.emit("toggled")
+
+ def apply(self):
+ # Copy the GUI state into the AddonData object
+ self.data.addons.com_redhat_kdump.enabled = self._enableButton.get_active()
+
+ if KdumpSpoke.OS == "redhat" and self._autoButton.get_active():
+ reserveMem = "auto"
+ else:
+ reserveMem = "%dM" % self._toBeReservedSpin.get_value_as_int()
+
+ self.data.addons.com_redhat_kdump.reserveMB = reserveMem
+
+
+ @property
+ def ready(self):
+ return True
+
+ @property
+ def completed(self):
+ # Always treat as completed
+ return True
+
+ @property
+ def mandatory(self):
+ return False
+
+ @property
+ def status(self):
+ if self.data.addons.com_redhat_kdump.enabled:
+ state = _("Kdump is enabled")
+ else:
+ state = _("Kdump is disabled")
+
+ return state
+
+ # SIGNAL HANDLERS
+
+ def on_enable_kdump_toggled(self, checkbutton, user_data=None):
+ status = checkbutton.get_active()
+
+ # If disabling, set everything to insensitve. Otherwise, only set the radio
+ # button and currently reserved widgets to sensitive and then fake a
+ # toggle event on the radio button to set the state on the reserve
+ # amount spin button and total/usable mem display.
+ if KdumpSpoke.OS == "redhat":
+ self._autoButton.set_sensitive(status)
+ self._manualButton.set_sensitive(status)
+ self._reservationTypeLabel.set_sensitive(status)
+
+ if not status:
+ fancy_set_sensitive(self._toBeReservedSpin, status)
+ self._totalMemLabel.set_sensitive(status)
+ self._totalMemMB.set_sensitive(status)
+ self._usableMemLabel.set_sensitive(status)
+ self._usableMemMB.set_sensitive(status)
+ elif KdumpSpoke.OS == "redhat":
+ self._autoButton.emit("toggled")
+ else:
+ fancy_set_sensitive(self._toBeReservedSpin, True)
+ self._totalMemLabel.set_sensitive(True)
+ self._totalMemMB.set_sensitive(True)
+ self._usableMemLabel.set_sensitive(True)
+ self._usableMemMB.set_sensitive(True)
+
+ def on_reservation_toggled(self, radiobutton, user_data=None):
+ status = self._manualButton.get_active()
+
+ # If setting to auto, disable the manual config spinner and
+ # the total/usable memory labels
+ fancy_set_sensitive(self._toBeReservedSpin, status)
+ self._totalMemLabel.set_sensitive(status)
+ self._totalMemMB.set_sensitive(status)
+ self._usableMemLabel.set_sensitive(status)
+ self._usableMemMB.set_sensitive(status)
+
+ def on_reserved_value_changed(self, spinbutton, user_data=None):
+ reserveMem = spinbutton.get_value_as_int()
+ totalMemText = self._totalMemMB.get_text()
+
+ # If no total memory is available yet, do nothing
+ if totalMemText:
+ totalMem = int(self._totalMemMB.get_text())
+ self._usableMemMB.set_text("%d" % (totalMem - reserveMem))
diff --git a/kdump-anaconda-addon/com_redhat_kdump/i18n.py b/kdump-anaconda-addon/com_redhat_kdump/i18n.py
new file mode 100644
index 0000000..a8cd27a
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/i18n.py
@@ -0,0 +1,27 @@
+# Kdump configuration translation functions
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+__all__ = ["_", "N_"]
+
+import gettext
+
+_ = lambda x: gettext.ldgettext("kdump-anaconda-addon", x)
+N_ = lambda x: x
diff --git a/kdump-anaconda-addon/com_redhat_kdump/ks/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/ks/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py b/kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py
new file mode 100644
index 0000000..b4b346c
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py
@@ -0,0 +1,128 @@
+# Kdump anaconda configuration
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+import os
+
+from pyanaconda.addons import AddonData
+from pyanaconda.constants import ROOT_PATH
+from pyanaconda import iutil
+
+from pykickstart.options import KSOptionParser
+from pykickstart.errors import KickstartParseError, formatErrorMsg
+from com_redhat_kdump.common import getOS, getMemoryBounds
+from com_redhat_kdump.i18n import _
+
+__all__ = ["KdumpData"]
+
+class KdumpData(AddonData):
+ """Addon data for the kdump configuration"""
+
+ def __init__(self, name):
+ AddonData.__init__(self, name)
+
+ self.enabled = True
+ self.reserveMB = "auto"
+ if getOS() == "fedora":
+ self.enabled = False
+ lower, upper, step = getMemoryBounds()
+ self.reserveMB = "%d" % lower
+
+ def __str__(self):
+ addon_str = "%%addon %s" % self.name
+
+ if self.enabled:
+ addon_str += " --enable"
+ else:
+ addon_str += " --disable"
+
+ if self.reserveMB:
+ addon_str += " --reserve-mb='%s'" % self.reserveMB
+
+ addon_str += "\n%s\n%%end\n" % self.content.strip()
+
+ return addon_str
+
+ def setup(self, storage, ksdata, instClass):
+ # Clear any existing crashkernel bootloader arguments
+ if ksdata.bootloader.appendLine:
+ ksdata.bootloader.appendLine = ' '.join(
+ (arg for arg in ksdata.bootloader.appendLine.split() \
+ if not arg.startswith('crashkernel=')))
+
+ # Copy our reserved amount to the bootloader arguments
+ if self.enabled:
+ # Ensure that the amount is "auto" or an amount in MB
+ if self.reserveMB != "auto" and self.reserveMB[-1] != 'M':
+ self.reserveMB += 'M'
+ ksdata.bootloader.appendLine += ' crashkernel=%s' % self.reserveMB
+
+ # Do the same thing with the storage.bootloader.boot_args set
+ if storage.bootloader.boot_args:
+ crashargs = [arg for arg in storage.bootloader.boot_args \
+ if arg.startswith('crashkernel=')]
+ storage.bootloader.boot_args -= set(crashargs)
+
+ if self.enabled:
+ storage.bootloader.boot_args.add('crashkernel=%s' % self.reserveMB)
+ ksdata.packages.packageList.append("kexec-tools")
+
+ def handle_header(self, lineno, args):
+ op = KSOptionParser()
+ op.add_option("--enable", action="store_true", default=True,
+ dest="enabled", help="Enable kdump")
+ op.add_option("--disable", action="store_false",
+ dest="enabled", help="Disable kdump")
+ op.add_option("--reserve-mb", type="string", dest="reserveMB",
+ default="auto", help="Amount of memory in MB to reserve for kdump, or auto")
+
+ (opts, extra) = op.parse_args(args=args, lineno=lineno)
+
+ # Reject any additional arguments
+ if extra:
+ AddonData.handle_header(self, lineno, extra)
+
+ # Validate the reserve-mb argument
+ if opts.reserveMB != "auto":
+ # Allow a final 'M' for consistency with the crashkernel kernel
+ # parameter. Strip it if found.
+ if opts.reserveMB and opts.reserveMB[-1] == 'M':
+ opts.reserveMB = opts.reserveMB[:-1]
+
+ try:
+ _test = int(opts.reserveMB)
+ except ValueError:
+ msg = _("Invalid value %s for --reserve-mb") % opts.reserveMB
+ if lineno != None:
+ raise KickstartParseError(formatErrorMsg(lineno, msg=msg))
+ else:
+ raise KickstartParseError(msg)
+
+ # Store the parsed arguments
+ self.enabled = opts.enabled
+ self.reserveMB =opts.reserveMB
+
+ def execute(self, storage, ksdata, instClass, users):
+ if self.enabled:
+ action = "enable"
+ else:
+ action = "disable"
+
+ iutil.execWithRedirect("systemctl", [action, "kdump.service"], root=ROOT_PATH)
diff --git a/kdump-anaconda-addon/com_redhat_kdump/tui/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/tui/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/kdump.py b/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/kdump.py
new file mode 100644
index 0000000..23e8040
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/kdump.py
@@ -0,0 +1,87 @@
+# Kdump anaconda configuration
+#
+# Copyright (C) 2013 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+"""Kdump anaconda TUI configuration"""
+
+import re
+
+from pyanaconda.ui.tui.spokes import EditTUISpoke
+from pyanaconda.ui.tui.spokes import EditTUISpokeEntry as Entry
+from com_redhat_kdump.common import getOS, getMemoryBounds
+from com_redhat_kdump.i18n import N_, _
+
+__all__ = ["KdumpSpoke"]
+
+class _re:
+ def __init__(self, patten, low, up):
+ self.re = re.compile(patten)
+ self.low = low
+ self.up = up
+
+ def match(self, key):
+ if self.re.match(key):
+ if key == "auto":
+ return True
+ if key[-1] == 'M':
+ key = key[:-1]
+ key = int(key)
+ if key <= self.up and key >= self.low :
+ return True
+ return False
+
+lower, upper ,step = getMemoryBounds()
+# Allow either "auto" or a string of digits optionally followed by 'M'
+RESERVE_VALID = _re(r'^((auto)|(\d+M?))$', lower, upper)
+FEDORA_RESERVE_VALID = _re(r'^(\d+M?)$', lower, upper)
+
+class KdumpSpoke(EditTUISpoke):
+ title = N_("Kdump")
+ category = "system"
+
+ edit_fields = [
+ Entry("Enable kdump", "enabled", EditTUISpoke.CHECK, True),
+ Entry("Reserve amount", "reserveMB", RESERVE_VALID, lambda self,args: args.enabled)
+ ]
+
+ def __init__(self, app, data, storage, payload, instclass):
+ if getOS() == "fedora":
+ KdumpSpoke.edit_fields = [
+ Entry("Enable kdump", "enabled", EditTUISpoke.CHECK, True),
+ Entry("Reserve amount", "reserveMB", FEDORA_RESERVE_VALID, lambda self,args: args.enabled)
+ ]
+
+ EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
+ self.args = self.data.addons.com_redhat_kdump
+
+ def apply(self):
+ pass
+
+ @property
+ def completed(self):
+ return True
+
+ @property
+ def status(self):
+ if self.args.enabled:
+ state = _("Kdump is enabled")
+ else:
+ state = _("Kdump is disabled")
+ return state
diff --git a/kdump-anaconda-addon/po/Makefile b/kdump-anaconda-addon/po/Makefile
new file mode 100644
index 0000000..b82cca4
--- /dev/null
+++ b/kdump-anaconda-addon/po/Makefile
@@ -0,0 +1,75 @@
+#
+# Makefile for the PO files (translation) catalog
+#
+# $Id$
+
+TOP = ../..
+
+# What is this package?
+NLSPACKAGE = kdump-anaconda-addon
+POTFILE = $(NLSPACKAGE).pot
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_DIR = /usr/bin/install -d
+
+# destination directory
+INSTALL_NLS_DIR = $(DESTDIR)/usr/share/locale
+# PO catalog handling
+MSGMERGE = msgmerge -v
+XGETTEXT = xgettext --default-domain=$(NLSPACKAGE) \
+ --add-comments
+MSGFMT = msgfmt --statistics --verbose
+
+# What do we need to do
+POFILES = $(wildcard ./*.po)
+MOFILES = $(patsubst %.po,%.mo,$(POFILES))
+PYSRC = $(wildcard ../com_redhat_kdump/*.py ../com_redhat_kdump/*/*.py ../com_redhat_kdump/*/*/*.py)
+GLADEFILES = $(wildcard ../com_redhat_kdump/gui/spokes/*.glade)
+
+all:: update-po $(MOFILES)
+
+potfile: $(PYSRC) glade-po
+ $(XGETTEXT) -L Python --keyword=_ --keyword=N_ $(PYSRC) tmp/*.h
+ @if cmp -s $(NLSPACKAGE).po $(POTFILE); then \
+ rm -f $(NLSPACKAGE).po; \
+ else \
+ mv -f $(NLSPACKAGE).po $(POTFILE); \
+ fi; \
+ rm -rf tmp/
+
+glade-po: $(GLADEFILES)
+ rm -rf tmp/
+ for f in $(GLADEFILES); do \
+ intltool-extract --type=gettext/glade -l $$f ;\
+ done
+
+update-po: Makefile refresh-po potfile
+
+refresh-po: Makefile
+ for cat in $(POFILES); do \
+ if $(MSGMERGE) $$cat $(POTFILE) --out=$$cat ; then \
+ echo "$(MSGMERGE) of $$cat succeeded" ; \
+ else \
+ echo "$(MSGMERGE) of $$cat failed" ; \
+ fi \
+ done
+
+clean:
+ @rm -fv *mo *~ .depend
+ @rm -rf tmp
+
+install: $(MOFILES)
+ @for n in $(MOFILES); do \
+ l=`basename $$n .mo`; \
+ $(INSTALL_DIR) $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \
+ $(INSTALL_DATA) --verbose $$n $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \
+ done
+
+uninstall:
+ rm -rfv $(INSTALL_NLS_DIR)/*/LC_MESSAGES/$(NLSPACKAGE).mo
+
+%.mo: %.po
+ $(MSGFMT) -o $@ $<
+
+.PHONY: missing depend
+
diff --git a/kdump-anaconda-addon/po/kdump-anaconda-addon.pot b/kdump-anaconda-addon/po/kdump-anaconda-addon.pot
new file mode 100644
index 0000000..3b9b641
--- /dev/null
+++ b/kdump-anaconda-addon/po/kdump-anaconda-addon.pot
@@ -0,0 +1,81 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-04-09 15:07+0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL(a)li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../com_redhat_kdump/ks/kdump.py:112
+#, python-format
+msgid "Invalid value %s for --reserve-mb"
+msgstr ""
+
+#: ../com_redhat_kdump/tui/spokes/kdump.py:56
+msgid "Kdump"
+msgstr ""
+
+#: ../com_redhat_kdump/tui/spokes/kdump.py:84
+#: ../com_redhat_kdump/gui/spokes/kdump.py:138
+msgid "Kdump is enabled"
+msgstr ""
+
+#: ../com_redhat_kdump/tui/spokes/kdump.py:86
+#: ../com_redhat_kdump/gui/spokes/kdump.py:140
+msgid "Kdump is disabled"
+msgstr ""
+
+#: ../com_redhat_kdump/gui/spokes/kdump.py:43
+msgid "_KDUMP"
+msgstr ""
+
+#: tmp/fedora.glade.h:1 tmp/kdump.glade.h:1
+msgid "KDUMP"
+msgstr ""
+
+#: tmp/fedora.glade.h:2 tmp/kdump.glade.h:2
+msgid ""
+"Kdump is a kernel crash dumping mechanism. In the event of a system crash, "
+"kdump will capture information from your system that can be invaluable in "
+"determining the cause of the crash. Note that kdump does require reserving a "
+"portion of system memory that will be unavailable for other uses."
+msgstr ""
+
+#: tmp/fedora.glade.h:3 tmp/kdump.glade.h:7
+msgid "Memory To Be Reserved (MB):"
+msgstr ""
+
+#: tmp/fedora.glade.h:4 tmp/kdump.glade.h:8
+msgid "Total System Memory (MB):"
+msgstr ""
+
+#: tmp/fedora.glade.h:5 tmp/kdump.glade.h:9
+msgid "Usable System Memory (MB):"
+msgstr ""
+
+#: tmp/fedora.glade.h:6 tmp/kdump.glade.h:3
+msgid "_Enable kdump?"
+msgstr ""
+
+#: tmp/kdump.glade.h:4
+msgid "Kdump Memory Reservation:"
+msgstr ""
+
+#: tmp/kdump.glade.h:5
+msgid "_Automatic"
+msgstr ""
+
+#: tmp/kdump.glade.h:6
+msgid "_Manual"
+msgstr ""
--
1.8.4.2
9 years, 10 months
Query about some files in fedora kexec-tools tree
by Vivek Goyal
Hi Chao,
I have few questions.
- What is makedumpfile-1.4.2.tar.gz ? IIUC, kexec-tools.spec seem to
suggest that during build following tar file needs to be downloaded.
http://downloads.sourceforge.net/project/makedumpfile/makedumpfile/1.5.6/...
Does that mean makedumpfile-1.4.2.tar.gz is redundant?
- Should we maintain a cache of makedumpfile tar file on fedora server
(like kexec-tools tar file), instead of relying on download.sourceforge.net.
I feel it is better to maintain one on fedora server cache.
- I see one entry for makedumpfile in "sources" file. So does that mean
we are already maintaining makedumpfile with said hash. If yes, does
that mean entry in spec file is redundant?
- We have tons of entries in .gitignore file. Should we remove entry for
older version of kexec-tools and makedumpfile from the file. Why should
we continue to ignore older versions of these?
- Similarly why are we carrying kexec-tools-2.0.3.tar.bz2 in the tree?
- What about kexec-tools-po.tar.gz?
Thanks
Vivek
9 years, 10 months
[PATCH v3] Add a anaconda addon to configurate kdump in the system installation process
by Arthur Zou
Currently this work is done by firstboot. Now we move to anaconda addon
to configurate in the system installation process.
Signed-off-by: Arthur Zou <zzou(a)redhat.com>
---
kdump-anaconda-addon/Makefile | 81 ++++++
kdump-anaconda-addon/README | 29 +++
kdump-anaconda-addon/com_redhat_kdump/__init__.py | 0
kdump-anaconda-addon/com_redhat_kdump/common.py | 88 +++++++
kdump-anaconda-addon/com_redhat_kdump/constants.py | 22 ++
.../com_redhat_kdump/gui/__init__.py | 0
.../com_redhat_kdump/gui/spokes/RHEL.glade | 274 +++++++++++++++++++++
.../com_redhat_kdump/gui/spokes/__init__.py | 0
.../com_redhat_kdump/gui/spokes/fedora.glade | 218 ++++++++++++++++
.../com_redhat_kdump/gui/spokes/kdump.py | 192 +++++++++++++++
kdump-anaconda-addon/com_redhat_kdump/i18n.py | 27 ++
.../com_redhat_kdump/ks/__init__.py | 0
kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py | 128 ++++++++++
.../com_redhat_kdump/tui/__init__.py | 0
.../com_redhat_kdump/tui/spokes/__init__.py | 0
.../com_redhat_kdump/tui/spokes/kdump.py | 87 +++++++
kdump-anaconda-addon/po/Makefile | 75 ++++++
kdump-anaconda-addon/po/kdump-anaconda-addon.pot | 81 ++++++
18 files changed, 1302 insertions(+)
create mode 100644 kdump-anaconda-addon/Makefile
create mode 100644 kdump-anaconda-addon/README
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/common.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/constants.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/spokes/RHEL.glade
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/spokes/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/spokes/fedora.glade
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/gui/spokes/kdump.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/i18n.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/ks/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/tui/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/tui/spokes/__init__.py
create mode 100644 kdump-anaconda-addon/com_redhat_kdump/tui/spokes/kdump.py
create mode 100644 kdump-anaconda-addon/po/Makefile
create mode 100644 kdump-anaconda-addon/po/kdump-anaconda-addon.pot
diff --git a/kdump-anaconda-addon/Makefile b/kdump-anaconda-addon/Makefile
new file mode 100644
index 0000000..7fd5ac4
--- /dev/null
+++ b/kdump-anaconda-addon/Makefile
@@ -0,0 +1,81 @@
+NAME = kdump-anaconda-addon
+
+VERSION = 0.1
+
+ADDON = com_redhat_kdump
+TESTS = test
+
+FILES = $(ADDON) \
+ $(TESTS) \
+ po \
+ Makefile \
+ README
+
+EXCLUDES = \
+ *~ \
+ *.pyc
+
+all:
+ @echo "usage: make dist"
+ @echo " make test"
+ @echo " make install"
+ @echo " make uninstall"
+
+DISTNAME = $(NAME)-$(VERSION)
+ADDONDIR = /usr/share/anaconda/addons/
+DISTBALL = $(DISTNAME).tar.gz
+NUM_PROCS = $$(getconf _NPROCESSORS_ONLN)
+
+install:
+ mkdir -p $(DESTDIR)$(ADDONDIR)
+ cp -rv $(ADDON) $(DESTDIR)$(ADDONDIR)
+
+uninstall:
+ rm -rfv $(DESTDIR)$(ADDONDIR)
+
+dist:
+ rm -rf $(DISTNAME)
+ mkdir -p $(DISTNAME)
+ @if test -d ".git"; \
+ then \
+ echo Creating ChangeLog && \
+ ( cd "$(top_srcdir)" && \
+ echo '# Generate automatically. Do not edit.'; echo; \
+ git log --stat --date=short ) > ChangeLog.tmp \
+ && mv -f ChangeLog.tmp $(DISTNAME)/ChangeLog \
+ || ( rm -f ChangeLog.tmp ; \
+ echo Failed to generate ChangeLog >&2 ); \
+ else \
+ echo A git clone is required to generate a ChangeLog >&2; \
+ fi
+ for file in $(FILES); do \
+ cp -rpv $$file $(DISTNAME)/$$file; \
+ done
+ for excl in $(EXCLUDES); do \
+ find $(DISTNAME) -name "$$excl" -delete; \
+ done
+ tar -czvf $(DISTBALL) $(DISTNAME)
+ rm -rf $(DISTNAME)
+
+potfile:
+ $(MAKE) DESTDIR=$(DESTDIR) -C po potfile
+
+po-pull:
+ tx pull -a --disable-overwrite
+
+install-po-files:
+ $(MAKE) -C po install
+
+test:
+ @echo "***Running pylint checks***"
+ @find . -name '*.py' -print|xargs -n1 --max-procs=$(NUM_PROCS) pylint -E 2> /dev/null
+ @echo "[ OK ]"
+ @echo "***Running unittests checks***"
+ @PYTHONPATH=. nosetests --processes=-1 -vw tests/
+
+runpylint:
+ @find . -name '*.py' -print|xargs -n1 --max-procs=$(NUM_PROCS) pylint -E 2> /dev/null
+ @echo "[ OK ]"
+
+unittest:
+ PYTHONPATH=. nosetests --processes=-1 -vw tests/
diff --git a/kdump-anaconda-addon/README b/kdump-anaconda-addon/README
new file mode 100644
index 0000000..50a7c97
--- /dev/null
+++ b/kdump-anaconda-addon/README
@@ -0,0 +1,29 @@
+This is an anaconda addon for configuring kdump. To use, copy the
+com_redhat_kdump directory into /usr/share/anaconda/addons on your
+installation media.
+
+The syntax of the addon's kickstart section is:
+
+%addon com_redhat_kdump (--enable|--disable) --reserve-mb=("auto"|<amount>)
+%end
+
+Note that support for arguments on the %addon line was added in
+anaconda-21.23. See anaconda commit 3a512e4f9e15977f0ce2d0bbe39e841b881398f3,
+https://bugzilla.redhat.com/show_bug.cgi?id=1065674
+
+How to test the kdump-anaconda-addon?
+You can provide an updates image in the kernel boot arguments as updates=,
+and the contents will be added to the stage2 filesystem.
+https://fedoraproject.org/wiki/Anaconda/Updates has more details, but usually
+the easiest is to make it available via HTTP or FTP and provide a url to updates=.
+
+The file is a gzip-compressed cpio archive, and the files need to be put into
+stage2 in /usr/share/anaconda/addons, so something like this will work to create
+an updates.img:
+
+mkdir -p updates/usr/share/anaconda/addons
+cp -r com_redhat_kdump updates/usr/share/anaconda/addons/
+( cd updates; find . | cpio -oc | gzip -c9 ) > updates.img
+
+then you can upload the updates.img to some http or ftp server so the anaconda
+can get it by boot parameter as updates=http://some.website.com/path/to/updates.img.
diff --git a/kdump-anaconda-addon/com_redhat_kdump/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/common.py b/kdump-anaconda-addon/com_redhat_kdump/common.py
new file mode 100644
index 0000000..cd37131
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/common.py
@@ -0,0 +1,88 @@
+# Kdump configuration common methods
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+import os
+__all__ = ["getReservedMemory", "getTotalMemory", "getMemoryBounds", "getOS"]
+
+from pyanaconda.isys import total_memory
+from pyanaconda.flags import flags
+from com_redhat_kdump.constants import OS_RELEASE
+
+_reservedMemory = None
+def getReservedMemory():
+ """Return the amount of memory currently reserved for kdump in MB."""
+ global _reservedMemory
+
+ # Check if the value has already been read
+ if _reservedMemory is not None:
+ return _reservedMemory
+
+ try:
+ with open("/sys/kernel/kexec_crash_size", "r") as fobj:
+ _reservedMemory = int(fobj.read()) / (1024*1024)
+ return _reservedMemory
+ except (ValueError, IOError):
+ return 0
+
+def getTotalMemory():
+ """Return the total amount of system memory in MB
+
+ This is the amount reported by /proc/meminfo plus the aount
+ currently reserved for kdump.
+ """
+
+ # total_memory return memory in KB, convert to MB
+ availMem = total_memory() / 1024
+
+ return availMem + getReservedMemory()
+
+def getMemoryBounds():
+ """Return a tuple of (lower, upper, step) for kdump reservation limits.
+
+ If there is not enough memory available to use kdump, both lower and
+ upper will be 0.
+ """
+
+ totalMemory = getTotalMemory()
+
+ if flags.targetarch == 'ppc64':
+ lowerBound = 256
+ minUsable = 1024
+ step = 1
+ else:
+ lowerBound = 128
+ minUsable = 256
+ step = 1
+
+ upperBound = (totalMemory - minUsable) - (totalMemory % step)
+
+ if upperBound < lowerBound:
+ upperBound = lowerBound = 0
+
+ return (lowerBound, upperBound, step)
+
+def getOS():
+ with open(os.path.normpath(OS_RELEASE), "r") as fobj:
+ line = fobj.readline()
+
+ if not "Fedora" in line:
+ return "redhat"
+ else:
+ return "fedora"
diff --git a/kdump-anaconda-addon/com_redhat_kdump/constants.py b/kdump-anaconda-addon/com_redhat_kdump/constants.py
new file mode 100644
index 0000000..c6bafcc
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/constants.py
@@ -0,0 +1,22 @@
+# Kdump configuration constants
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+OS_RELEASE = "/etc/os-release"
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/gui/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/RHEL.glade b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/RHEL.glade
new file mode 100644
index 0000000..272f745
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/RHEL.glade
@@ -0,0 +1,274 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface domain="kdump-anaconda-addon">
+ <requires lib="gtk+" version="3.6"/>
+ <!-- interface-requires AnacondaWidgets 1.0 -->
+ <object class="AnacondaSpokeWindow" id="KdumpWindow">
+ <property name="startup_id">filler</property>
+ <property name="can_focus">False</property>
+ <property name="startup_id">filler</property>
+ <property name="window_name" translatable="yes">KDUMP</property>
+ <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
+ <child internal-child="main_box">
+ <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child internal-child="nav_box">
+ <object class="GtkEventBox" id="AnacondaSpokeWindow-nav_box1">
+ <property name="app_paintable">True</property>
+ <property name="can_focus">False</property>
+ <child internal-child="nav_area">
+ <object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
+ <property name="can_focus">False</property>
+ <property name="margin_left">6</property>
+ <property name="margin_right">6</property>
+ <property name="margin_top">6</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="alignment">
+ <object class="GtkAlignment" id="AnacondaSpokeWindow-alignment1">
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="AnacondaSpokeWindow-action_area1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">10</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkLabel" id="summaryLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Kdump is a kernel crash dumping mechanism. In the event of a system crash, kdump will capture information from your system that can be invaluable in determining the cause of the crash. Note that kdump does require reserving a portion of system memory that will be unavailable for other uses.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="enableKdumpCheck">
+ <property name="label" translatable="yes">_Enable kdump?</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_enable_kdump_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">3</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="reservationTypeLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Kdump Memory Reservation:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="autoButton">
+ <property name="label" translatable="yes">_Automatic</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_reservation_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkRadioButton" id="manualButton">
+ <property name="label" translatable="yes">_Manual</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">autoButton</property>
+ <signal name="toggled" handler="on_reservation_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="toBeReservedLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Memory To Be _Reserved (MB):</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">toBeReservedSpin</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="toBeReservedSpin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="input_purpose">digits</property>
+ <property name="update_policy">if-valid</property>
+ <signal name="value-changed" handler="on_reserved_value_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="totalMemLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Total System Memory (MB):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="totalMemMB">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usableMemLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Usable System Memory (MB):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usableMemMB">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/fedora.glade b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/fedora.glade
new file mode 100644
index 0000000..55442a8
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/fedora.glade
@@ -0,0 +1,218 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
+<interface domain="kdump-anaconda-addon">
+ <requires lib="gtk+" version="3.6"/>
+ <!-- interface-requires AnacondaWidgets 1.0 -->
+ <object class="AnacondaSpokeWindow" id="KdumpWindow">
+ <property name="startup_id">filler</property>
+ <property name="can_focus">False</property>
+ <property name="startup_id">filler</property>
+ <property name="window_name" translatable="yes">KDUMP</property>
+ <signal name="button-clicked" handler="on_back_clicked" swapped="no"/>
+ <child internal-child="main_box">
+ <object class="GtkBox" id="AnacondaSpokeWindow-main_box1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child internal-child="nav_box">
+ <object class="GtkEventBox" id="AnacondaSpokeWindow-nav_box1">
+ <property name="app_paintable">True</property>
+ <property name="can_focus">False</property>
+ <child internal-child="nav_area">
+ <object class="GtkGrid" id="AnacondaSpokeWindow-nav_area1">
+ <property name="can_focus">False</property>
+ <property name="margin_left">6</property>
+ <property name="margin_right">6</property>
+ <property name="margin_top">6</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="alignment">
+ <object class="GtkAlignment" id="AnacondaSpokeWindow-alignment1">
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <child internal-child="action_area">
+ <object class="GtkBox" id="AnacondaSpokeWindow-action_area1">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">10</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">10</property>
+ <child>
+ <object class="GtkLabel" id="summaryLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Kdump is a kernel crash dumping mechanism. In the event of a system crash, kdump will capture information from your system that can be invaluable in determining the cause of the crash. Note that kdump does require reserving a portion of system memory that will be unavailable for other uses.</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="toBeReservedLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Memory To Be _Reserved (MB):</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">toBeReservedSpin</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="toBeReservedSpin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="input_purpose">digits</property>
+ <property name="update_policy">if-valid</property>
+ <signal name="value-changed" handler="on_reserved_value_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="totalMemLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Total System Memory (MB):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="totalMemMB">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usableMemLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Usable System Memory (MB):</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="usableMemMB">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="enableKdumpCheck">
+ <property name="label" translatable="yes">_Enable kdump?</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_enable_kdump_toggled" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
diff --git a/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/kdump.py b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/kdump.py
new file mode 100644
index 0000000..cec6b06
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/gui/spokes/kdump.py
@@ -0,0 +1,192 @@
+# Kdump anaconda configuration
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+"""Kdump anaconda GUI configuration"""
+
+from gi.repository import Gtk
+
+from pyanaconda.ui.gui.categories.system import SystemCategory
+from pyanaconda.ui.gui.spokes import NormalSpoke
+from pyanaconda.ui.gui.utils import fancy_set_sensitive
+
+from com_redhat_kdump.i18n import _, N_
+from com_redhat_kdump.common import getReservedMemory, getTotalMemory, getMemoryBounds, getOS
+
+__all__ = ["KdumpSpoke"]
+
+class KdumpSpoke(NormalSpoke):
+ """Kdump configuration spoke"""
+
+ builderObjects = ["KdumpWindow", "advancedConfigBuffer"]
+ mainWidgetName = "KdumpWindow"
+ uiFile = "RHEL.glade"
+ translationDomain = "kdump-anaconda-addon"
+
+ icon = "computer-fail-symbolic"
+ title = N_("KDUMP")
+ category = SystemCategory
+ OS = "redhat"
+ def __init__(self, data, storage, payload, instclass):
+ KdumpSpoke.OS = getOS()
+ if KdumpSpoke.OS == "fedora":
+ KdumpSpoke.uiFile = "fedora.glade"
+ NormalSpoke.__init__(self, data, storage, payload, instclass)
+ self._reserveMem = 0
+
+ def initialize(self):
+ NormalSpoke.initialize(self)
+ self._enableButton = self.builder.get_object("enableKdumpCheck")
+ KdumpSpoke.OS = getOS()
+ if KdumpSpoke.OS == "redhat":
+ self._reservationTypeLabel = self.builder.get_object("reservationTypeLabel")
+ self._autoButton = self.builder.get_object("autoButton")
+ self._manualButton = self.builder.get_object("manualButton")
+
+ self._toBeReservedLabel = self.builder.get_object("toBeReservedLabel")
+ self._toBeReservedSpin = self.builder.get_object("toBeReservedSpin")
+ self._totalMemLabel = self.builder.get_object("totalMemLabel")
+ self._totalMemMB = self.builder.get_object("totalMemMB")
+ self._usableMemLabel = self.builder.get_object("usableMemLabel")
+ self._usableMemMB = self.builder.get_object("usableMemMB")
+
+ # Set an initial value and adjustment on the spin button
+ lower, upper, step = getMemoryBounds()
+ adjustment = Gtk.Adjustment(lower, lower, upper, step, step, 0)
+ self._toBeReservedSpin.set_adjustment(adjustment)
+ self._toBeReservedSpin.set_value(lower)
+
+ def refresh(self):
+ # If a reserve amount is requested, set it in the spin button
+ if self.data.addons.com_redhat_kdump.reserveMB != "auto":
+ # Strip the trailing 'M'
+ reserveMB = self.data.addons.com_redhat_kdump.reserveMB
+ if reserveMB and reserveMB[-1] == 'M':
+ reserveMB = reserveMB[:-1]
+ if reserveMB:
+ self._toBeReservedSpin.set_value(int(reserveMB))
+
+ # Set the various labels. Use the spin button signal handler to set the
+ # usable memory label once the other two have been set.
+ self._totalMemMB.set_text("%d" % getTotalMemory())
+ self._toBeReservedSpin.emit("value-changed")
+
+ # Set the states on the toggle buttons and let the signal handlers set
+ # the sensitivities on the related widgets. Set the radio button first,
+ # since the radio buttons' bailiwick is a subset of that of the
+ # enable/disable checkbox.
+ if KdumpSpoke.OS == "redhat":
+ if self.data.addons.com_redhat_kdump.reserveMB == "auto":
+ self._autoButton.set_active(True)
+ self._manualButton.set_active(False)
+ else:
+ self._autoButton.set_active(False)
+ self._manualButton.set_active(True)
+
+ if self.data.addons.com_redhat_kdump.enabled:
+ self._enableButton.set_active(True)
+ else:
+ self._enableButton.set_active(False)
+
+ # Force a toggled signal on the button in case it's state has not changed
+ self._enableButton.emit("toggled")
+
+ def apply(self):
+ # Copy the GUI state into the AddonData object
+ self.data.addons.com_redhat_kdump.enabled = self._enableButton.get_active()
+
+ if KdumpSpoke.OS == "redhat" and self._autoButton.get_active():
+ reserveMem = "auto"
+ else:
+ reserveMem = "%dM" % self._toBeReservedSpin.get_value_as_int()
+
+ self.data.addons.com_redhat_kdump.reserveMB = reserveMem
+
+
+ @property
+ def ready(self):
+ return True
+
+ @property
+ def completed(self):
+ # Always treat as completed
+ return True
+
+ @property
+ def mandatory(self):
+ return False
+
+ @property
+ def status(self):
+ if self.data.addons.com_redhat_kdump.enabled:
+ state = _("Kdump is enabled")
+ else:
+ state = _("Kdump is disabled")
+
+ return state
+
+ # SIGNAL HANDLERS
+
+ def on_enable_kdump_toggled(self, checkbutton, user_data=None):
+ status = checkbutton.get_active()
+
+ # If disabling, set everything to insensitve. Otherwise, only set the radio
+ # button and currently reserved widgets to sensitive and then fake a
+ # toggle event on the radio button to set the state on the reserve
+ # amount spin button and total/usable mem display.
+ if KdumpSpoke.OS == "redhat":
+ self._autoButton.set_sensitive(status)
+ self._manualButton.set_sensitive(status)
+ self._reservationTypeLabel.set_sensitive(status)
+
+ if not status:
+ fancy_set_sensitive(self._toBeReservedSpin, status)
+ self._totalMemLabel.set_sensitive(status)
+ self._totalMemMB.set_sensitive(status)
+ self._usableMemLabel.set_sensitive(status)
+ self._usableMemMB.set_sensitive(status)
+ elif KdumpSpoke.OS == "redhat":
+ self._autoButton.emit("toggled")
+ else:
+ fancy_set_sensitive(self._toBeReservedSpin, True)
+ self._totalMemLabel.set_sensitive(True)
+ self._totalMemMB.set_sensitive(True)
+ self._usableMemLabel.set_sensitive(True)
+ self._usableMemMB.set_sensitive(True)
+
+ def on_reservation_toggled(self, radiobutton, user_data=None):
+ status = self._manualButton.get_active()
+
+ # If setting to auto, disable the manual config spinner and
+ # the total/usable memory labels
+ fancy_set_sensitive(self._toBeReservedSpin, status)
+ self._totalMemLabel.set_sensitive(status)
+ self._totalMemMB.set_sensitive(status)
+ self._usableMemLabel.set_sensitive(status)
+ self._usableMemMB.set_sensitive(status)
+
+ def on_reserved_value_changed(self, spinbutton, user_data=None):
+ reserveMem = spinbutton.get_value_as_int()
+ totalMemText = self._totalMemMB.get_text()
+
+ # If no total memory is available yet, do nothing
+ if totalMemText:
+ totalMem = int(self._totalMemMB.get_text())
+ self._usableMemMB.set_text("%d" % (totalMem - reserveMem))
diff --git a/kdump-anaconda-addon/com_redhat_kdump/i18n.py b/kdump-anaconda-addon/com_redhat_kdump/i18n.py
new file mode 100644
index 0000000..a8cd27a
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/i18n.py
@@ -0,0 +1,27 @@
+# Kdump configuration translation functions
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+__all__ = ["_", "N_"]
+
+import gettext
+
+_ = lambda x: gettext.ldgettext("kdump-anaconda-addon", x)
+N_ = lambda x: x
diff --git a/kdump-anaconda-addon/com_redhat_kdump/ks/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/ks/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py b/kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py
new file mode 100644
index 0000000..b4b346c
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/ks/kdump.py
@@ -0,0 +1,128 @@
+# Kdump anaconda configuration
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+import os
+
+from pyanaconda.addons import AddonData
+from pyanaconda.constants import ROOT_PATH
+from pyanaconda import iutil
+
+from pykickstart.options import KSOptionParser
+from pykickstart.errors import KickstartParseError, formatErrorMsg
+from com_redhat_kdump.common import getOS, getMemoryBounds
+from com_redhat_kdump.i18n import _
+
+__all__ = ["KdumpData"]
+
+class KdumpData(AddonData):
+ """Addon data for the kdump configuration"""
+
+ def __init__(self, name):
+ AddonData.__init__(self, name)
+
+ self.enabled = True
+ self.reserveMB = "auto"
+ if getOS() == "fedora":
+ self.enabled = False
+ lower, upper, step = getMemoryBounds()
+ self.reserveMB = "%d" % lower
+
+ def __str__(self):
+ addon_str = "%%addon %s" % self.name
+
+ if self.enabled:
+ addon_str += " --enable"
+ else:
+ addon_str += " --disable"
+
+ if self.reserveMB:
+ addon_str += " --reserve-mb='%s'" % self.reserveMB
+
+ addon_str += "\n%s\n%%end\n" % self.content.strip()
+
+ return addon_str
+
+ def setup(self, storage, ksdata, instClass):
+ # Clear any existing crashkernel bootloader arguments
+ if ksdata.bootloader.appendLine:
+ ksdata.bootloader.appendLine = ' '.join(
+ (arg for arg in ksdata.bootloader.appendLine.split() \
+ if not arg.startswith('crashkernel=')))
+
+ # Copy our reserved amount to the bootloader arguments
+ if self.enabled:
+ # Ensure that the amount is "auto" or an amount in MB
+ if self.reserveMB != "auto" and self.reserveMB[-1] != 'M':
+ self.reserveMB += 'M'
+ ksdata.bootloader.appendLine += ' crashkernel=%s' % self.reserveMB
+
+ # Do the same thing with the storage.bootloader.boot_args set
+ if storage.bootloader.boot_args:
+ crashargs = [arg for arg in storage.bootloader.boot_args \
+ if arg.startswith('crashkernel=')]
+ storage.bootloader.boot_args -= set(crashargs)
+
+ if self.enabled:
+ storage.bootloader.boot_args.add('crashkernel=%s' % self.reserveMB)
+ ksdata.packages.packageList.append("kexec-tools")
+
+ def handle_header(self, lineno, args):
+ op = KSOptionParser()
+ op.add_option("--enable", action="store_true", default=True,
+ dest="enabled", help="Enable kdump")
+ op.add_option("--disable", action="store_false",
+ dest="enabled", help="Disable kdump")
+ op.add_option("--reserve-mb", type="string", dest="reserveMB",
+ default="auto", help="Amount of memory in MB to reserve for kdump, or auto")
+
+ (opts, extra) = op.parse_args(args=args, lineno=lineno)
+
+ # Reject any additional arguments
+ if extra:
+ AddonData.handle_header(self, lineno, extra)
+
+ # Validate the reserve-mb argument
+ if opts.reserveMB != "auto":
+ # Allow a final 'M' for consistency with the crashkernel kernel
+ # parameter. Strip it if found.
+ if opts.reserveMB and opts.reserveMB[-1] == 'M':
+ opts.reserveMB = opts.reserveMB[:-1]
+
+ try:
+ _test = int(opts.reserveMB)
+ except ValueError:
+ msg = _("Invalid value %s for --reserve-mb") % opts.reserveMB
+ if lineno != None:
+ raise KickstartParseError(formatErrorMsg(lineno, msg=msg))
+ else:
+ raise KickstartParseError(msg)
+
+ # Store the parsed arguments
+ self.enabled = opts.enabled
+ self.reserveMB =opts.reserveMB
+
+ def execute(self, storage, ksdata, instClass, users):
+ if self.enabled:
+ action = "enable"
+ else:
+ action = "disable"
+
+ iutil.execWithRedirect("systemctl", [action, "kdump.service"], root=ROOT_PATH)
diff --git a/kdump-anaconda-addon/com_redhat_kdump/tui/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/tui/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/__init__.py b/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/kdump.py b/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/kdump.py
new file mode 100644
index 0000000..23e8040
--- /dev/null
+++ b/kdump-anaconda-addon/com_redhat_kdump/tui/spokes/kdump.py
@@ -0,0 +1,87 @@
+# Kdump anaconda configuration
+#
+# Copyright (C) 2013 Red Hat, Inc.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions of
+# the GNU General Public License v.2, or (at your option) any later version.
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY expressed or implied, including the implied warranties 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, write to the
+# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
+# source code or documentation are not subject to the GNU General Public
+# License and may only be used or replicated with the express permission of
+# Red Hat, Inc.
+#
+# Red Hat Author(s): David Shea <dshea(a)redhat.com>
+#
+
+"""Kdump anaconda TUI configuration"""
+
+import re
+
+from pyanaconda.ui.tui.spokes import EditTUISpoke
+from pyanaconda.ui.tui.spokes import EditTUISpokeEntry as Entry
+from com_redhat_kdump.common import getOS, getMemoryBounds
+from com_redhat_kdump.i18n import N_, _
+
+__all__ = ["KdumpSpoke"]
+
+class _re:
+ def __init__(self, patten, low, up):
+ self.re = re.compile(patten)
+ self.low = low
+ self.up = up
+
+ def match(self, key):
+ if self.re.match(key):
+ if key == "auto":
+ return True
+ if key[-1] == 'M':
+ key = key[:-1]
+ key = int(key)
+ if key <= self.up and key >= self.low :
+ return True
+ return False
+
+lower, upper ,step = getMemoryBounds()
+# Allow either "auto" or a string of digits optionally followed by 'M'
+RESERVE_VALID = _re(r'^((auto)|(\d+M?))$', lower, upper)
+FEDORA_RESERVE_VALID = _re(r'^(\d+M?)$', lower, upper)
+
+class KdumpSpoke(EditTUISpoke):
+ title = N_("Kdump")
+ category = "system"
+
+ edit_fields = [
+ Entry("Enable kdump", "enabled", EditTUISpoke.CHECK, True),
+ Entry("Reserve amount", "reserveMB", RESERVE_VALID, lambda self,args: args.enabled)
+ ]
+
+ def __init__(self, app, data, storage, payload, instclass):
+ if getOS() == "fedora":
+ KdumpSpoke.edit_fields = [
+ Entry("Enable kdump", "enabled", EditTUISpoke.CHECK, True),
+ Entry("Reserve amount", "reserveMB", FEDORA_RESERVE_VALID, lambda self,args: args.enabled)
+ ]
+
+ EditTUISpoke.__init__(self, app, data, storage, payload, instclass)
+ self.args = self.data.addons.com_redhat_kdump
+
+ def apply(self):
+ pass
+
+ @property
+ def completed(self):
+ return True
+
+ @property
+ def status(self):
+ if self.args.enabled:
+ state = _("Kdump is enabled")
+ else:
+ state = _("Kdump is disabled")
+ return state
diff --git a/kdump-anaconda-addon/po/Makefile b/kdump-anaconda-addon/po/Makefile
new file mode 100644
index 0000000..2fab84d
--- /dev/null
+++ b/kdump-anaconda-addon/po/Makefile
@@ -0,0 +1,75 @@
+#
+# Makefile for the PO files (translation) catalog
+#
+# $Id$
+
+TOP = ../..
+
+# What is this package?
+NLSPACKAGE = kdump-anaconda-addon
+POTFILE = $(NLSPACKAGE).pot
+INSTALL = /usr/bin/install -c
+INSTALL_DATA = $(INSTALL) -m 644
+INSTALL_DIR = /usr/bin/install -d
+
+# destination directory
+INSTALL_NLS_DIR = $(DESTDIR)/usr/share/locale
+# PO catalog handling
+MSGMERGE = msgmerge -v
+XGETTEXT = xgettext --default-domain=$(NLSPACKAGE) \
+ --add-comments
+MSGFMT = msgfmt --statistics --verbose
+
+# What do we need to do
+POFILES = $(wildcard ./kexec-tools-po/*.po)
+MOFILES = $(patsubst %.po,%.mo,$(POFILES))
+PYSRC = $(wildcard ../com_redhat_kdump/*.py ../com_redhat_kdump/*/*.py ../com_redhat_kdump/*/*/*.py)
+GLADEFILES = $(wildcard ../com_redhat_kdump/gui/spokes/*.glade)
+
+all:: update-po $(MOFILES)
+
+potfile: $(PYSRC) glade-po
+ $(XGETTEXT) -L Python --keyword=_ --keyword=N_ $(PYSRC) tmp/*.h
+ @if cmp -s $(NLSPACKAGE).po $(POTFILE); then \
+ rm -f $(NLSPACKAGE).po; \
+ else \
+ mv -f $(NLSPACKAGE).po $(POTFILE); \
+ fi; \
+ rm -rf tmp/
+
+glade-po: $(GLADEFILES)
+ rm -rf tmp/
+ for f in $(GLADEFILES); do \
+ intltool-extract --type=gettext/glade -l $$f ;\
+ done
+
+update-po: Makefile refresh-po
+
+refresh-po: Makefile
+ for cat in $(POFILES); do \
+ if $(MSGMERGE) $$cat $(POTFILE) --out=$$cat ; then \
+ echo "$(MSGMERGE) of $$cat succeeded" ; \
+ else \
+ echo "$(MSGMERGE) of $$cat failed" ; \
+ fi \
+ done
+
+clean:
+ @rm -fv *mo *~ .depend
+ @rm -rf tmp
+
+install: $(MOFILES)
+ @for n in $(MOFILES); do \
+ l=`basename $$n .mo`; \
+ $(INSTALL_DIR) $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES; \
+ $(INSTALL_DATA) --verbose $$n $(INSTALL_NLS_DIR)/$$l/LC_MESSAGES/$(NLSPACKAGE).mo; \
+ done
+
+uninstall:
+ rm -rfv $(INSTALL_NLS_DIR)/*/LC_MESSAGES/$(NLSPACKAGE).mo
+
+%.mo: %.po
+ $(MSGFMT) -o $@ $<
+
+.PHONY: missing depend
+
diff --git a/kdump-anaconda-addon/po/kdump-anaconda-addon.pot b/kdump-anaconda-addon/po/kdump-anaconda-addon.pot
new file mode 100644
index 0000000..3b9b641
--- /dev/null
+++ b/kdump-anaconda-addon/po/kdump-anaconda-addon.pot
@@ -0,0 +1,81 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-04-09 15:07+0800\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL(a)li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../com_redhat_kdump/ks/kdump.py:112
+#, python-format
+msgid "Invalid value %s for --reserve-mb"
+msgstr ""
+
+#: ../com_redhat_kdump/tui/spokes/kdump.py:56
+msgid "Kdump"
+msgstr ""
+
+#: ../com_redhat_kdump/tui/spokes/kdump.py:84
+#: ../com_redhat_kdump/gui/spokes/kdump.py:138
+msgid "Kdump is enabled"
+msgstr ""
+
+#: ../com_redhat_kdump/tui/spokes/kdump.py:86
+#: ../com_redhat_kdump/gui/spokes/kdump.py:140
+msgid "Kdump is disabled"
+msgstr ""
+
+#: ../com_redhat_kdump/gui/spokes/kdump.py:43
+msgid "_KDUMP"
+msgstr ""
+
+#: tmp/fedora.glade.h:1 tmp/kdump.glade.h:1
+msgid "KDUMP"
+msgstr ""
+
+#: tmp/fedora.glade.h:2 tmp/kdump.glade.h:2
+msgid ""
+"Kdump is a kernel crash dumping mechanism. In the event of a system crash, "
+"kdump will capture information from your system that can be invaluable in "
+"determining the cause of the crash. Note that kdump does require reserving a "
+"portion of system memory that will be unavailable for other uses."
+msgstr ""
+
+#: tmp/fedora.glade.h:3 tmp/kdump.glade.h:7
+msgid "Memory To Be Reserved (MB):"
+msgstr ""
+
+#: tmp/fedora.glade.h:4 tmp/kdump.glade.h:8
+msgid "Total System Memory (MB):"
+msgstr ""
+
+#: tmp/fedora.glade.h:5 tmp/kdump.glade.h:9
+msgid "Usable System Memory (MB):"
+msgstr ""
+
+#: tmp/fedora.glade.h:6 tmp/kdump.glade.h:3
+msgid "_Enable kdump?"
+msgstr ""
+
+#: tmp/kdump.glade.h:4
+msgid "Kdump Memory Reservation:"
+msgstr ""
+
+#: tmp/kdump.glade.h:5
+msgid "_Automatic"
+msgstr ""
+
+#: tmp/kdump.glade.h:6
+msgid "_Manual"
+msgstr ""
--
1.8.4.2
9 years, 10 months