On 03/27/2017 at 05:51 PM, Baoquan He wrote:
On 03/27/17 at 05:45pm, Baoquan He wrote:
> On 03/27/17 at 01:10pm, Pratyush Anand wrote:
>> Hi Xunlei,
>> I could not understand why kdump emergency.service needs isolate while, it
>> is not needed in first kernel (ie in systemd). If kdump would work without
>> isolate then probably it will be more closer to upstream systemd and we will
>> need less modifications in kdump.
> OK, I got the reason.
>
> W/o isolate, any error will trigger kdump emergency service. And default
> action need be handled in kdump emergence service, namely kdump error
> handler. If it's dump to rootfs, it will call "systemctl start
dracut-initqueue"
> . However in dracut-initqueue, it will call "systemctl start emergency"
> directly, but not on-failure. The infinite loop happens in case the
> original failure is triggered in dracut-initqueue.
And seems there's thing wong in Wang Chao's comment, I remember,
according to our discussion, isolate is not to stop other service,
but to stop later new service from being started. isolate could not stop
other running services.
Should be "to stop current running services" when "systemctl isolate"
is executed.
For example, "dump_to_rootfs" will execute "systemctl start
dracut-initqueue", then
if it is "to stop later new service from being started", we will never be able
to start
any new service in case of emergency.
Regards,
Xunlei
>> ~Pratyush
>>> This will lead to systemd two contradictable jobs queued as an
>>> atomic transaction:
>>> job 1) the emergency service gets started by initrd-root-fs.target
>>> job 2) the emergency service gets stopped due to "systemctl
isolate"
>>> thereby throwing "Transaction is destructive".
>>>
>>> In order to solve it, we can utilize "IgnoreOnIsolate=yes" for
>>> both kdump-emergency.service and kdump-emergency.target to avoid
>>> being isolated, then they can keep going on as expected in case
>>> of failures.
>>>
>>> We add kdump-emergency.target dedicated to kdump the similar way
>>> as did for kdump-emergency.service(i.e. will replace systemd's
>>> emergency.target with kdump-emergency.target under kdump), and
>>> adds "IgnoreOnIsolate=yes" into both of them.
>>>
>>> Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
>>> ---
>>> dracut-kdump-emergency.service | 1 +
>>> dracut-kdump-emergency.target | 14 ++++++++++++++
>>> dracut-module-setup.sh | 3 ++-
>>> kexec-tools.spec | 2 ++
>>> 4 files changed, 19 insertions(+), 1 deletion(-)
>>> create mode 100644 dracut-kdump-emergency.target
>>>
>>> diff --git a/dracut-kdump-emergency.service b/dracut-kdump-emergency.service
>>> index fb764f2..e023284 100644
>>> --- a/dracut-kdump-emergency.service
>>> +++ b/dracut-kdump-emergency.service
>>> @@ -12,6 +12,7 @@
>>> [Unit]
>>> Description=Kdump Emergency
>>> DefaultDependencies=no
>>> +IgnoreOnIsolate=yes
>>>
>>> [Service]
>>> ExecStart=/usr/bin/systemctl --no-block isolate kdump-error-handler.service
>>> diff --git a/dracut-kdump-emergency.target b/dracut-kdump-emergency.target
>>> new file mode 100644
>>> index 0000000..a1bb493
>>> --- /dev/null
>>> +++ b/dracut-kdump-emergency.target
>>> @@ -0,0 +1,14 @@
>>> +# This file is part of systemd.
>>> +#
>>> +# systemd is free software; you can redistribute it and/or modify it
>>> +# under the terms of the GNU Lesser General Public License as published by
>>> +# the Free Software Foundation; either version 2.1 of the License, or
>>> +# (at your option) any later version.
>>> +
>>> +[Unit]
>>> +Description=Emergency Mode
>>> +Documentation=man:systemd.special(7)
>>> +Requires=emergency.service
>>> +After=emergency.service
>>> +AllowIsolate=yes
>>> +IgnoreOnIsolate=yes
>>> diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
>>> index 1f96bb8..fa4fa2a 100755
>>> --- a/dracut-module-setup.sh
>>> +++ b/dracut-module-setup.sh
>>> @@ -734,8 +734,9 @@ install() {
>>> ln_r "$systemdsystemunitdir/kdump-capture.service"
"$systemdsystemunitdir/initrd.target.wants/kdump-capture.service"
>>> inst "$moddir/kdump-error-handler.sh"
"/usr/bin/kdump-error-handler.sh"
>>> inst "$moddir/kdump-error-handler.service"
"$systemdsystemunitdir/kdump-error-handler.service"
>>> - # Replace existing emergency service
>>> + # Replace existing emergency service and emergency target
>>> cp "$moddir/kdump-emergency.service"
"$initdir/$systemdsystemunitdir/emergency.service"
>>> + cp "$moddir/kdump-emergency.target"
"$initdir/$systemdsystemunitdir/emergency.target"
>>> # Also redirect dracut-emergency to kdump error handler
>>> ln_r "$systemdsystemunitdir/emergency.service"
"$systemdsystemunitdir/dracut-emergency.service"
>>>
>>> diff --git a/kexec-tools.spec b/kexec-tools.spec
>>> index 2a176f3..c3359fb 100644
>>> --- a/kexec-tools.spec
>>> +++ b/kexec-tools.spec
>>> @@ -41,6 +41,7 @@ Source103: dracut-kdump-error-handler.sh
>>> Source104: dracut-kdump-emergency.service
>>> Source105: dracut-kdump-error-handler.service
>>> Source106: dracut-kdump-capture.service
>>> +Source107: dracut-kdump-emergency.target
>>>
>>> Requires(post): systemd-units
>>> Requires(preun): systemd-units
>>> @@ -197,6 +198,7 @@ cp %{SOURCE103}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpb
>>> cp %{SOURCE104}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE104}}
>>> cp %{SOURCE105}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE105}}
>>> cp %{SOURCE106}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE106}}
>>> +cp %{SOURCE107}
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE107}}
>>> chmod 755
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE100}}
>>> chmod 755
$RPM_BUILD_ROOT/etc/kdump-adv-conf/kdump_dracut_modules/99kdumpbase/%{remove_dracut_prefix
%{SOURCE101}}
>>>
>>>
>> _______________________________________________
>> kexec mailing list -- kexec(a)lists.fedoraproject.org
>> To unsubscribe send an email to kexec-leave(a)lists.fedoraproject.org