profile/ivi/node-startup-controller.git
11 years agoUse passive language in test-test-environment-setup.xml
Jonathan Maw [Fri, 3 Aug 2012 14:42:04 +0000 (15:42 +0100)]
Use passive language in test-test-environment-setup.xml

Changes the single instance of "we" in this file.

Minor grammatical fixes.

11 years agoGrammatical fix to test-nsm-dummy.xml
Jonathan Maw [Fri, 3 Aug 2012 14:15:14 +0000 (15:15 +0100)]
Grammatical fix to test-nsm-dummy.xml

It now uses passive language throughout.

Other minor grammatical fixes

11 years agoMake the description of the NSM dummy more clear to unfamiliar readers
Jannis Pohlmann [Fri, 3 Aug 2012 14:24:53 +0000 (15:24 +0100)]
Make the description of the NSM dummy more clear to unfamiliar readers

11 years agoFix the link to test-luc-finish-only
Francisco Redondo Marchena [Fri, 3 Aug 2012 13:42:59 +0000 (14:42 +0100)]
Fix the link to test-luc-finish-only

11 years agoRevert "Depend on systemd 37 to be able to build on Fedora 16"
Jannis Pohlmann [Fri, 3 Aug 2012 14:13:45 +0000 (15:13 +0100)]
Revert "Depend on systemd 37 to be able to build on Fedora 16"

This reverts commit 5dfb47b1b80d3aa91b8493491050b9d70c31c57b.

11 years agoFinish documentation of build commands
Jannis Pohlmann [Fri, 3 Aug 2012 14:13:02 +0000 (15:13 +0100)]
Finish documentation of build commands

11 years agoFix conflicting part/refentry IDs to make the building page show up
Jannis Pohlmann [Fri, 3 Aug 2012 13:38:52 +0000 (14:38 +0100)]
Fix conflicting part/refentry IDs to make the building page show up

11 years agoAdd required command line utilities to build dependency docs
Jannis Pohlmann [Fri, 3 Aug 2012 13:33:00 +0000 (14:33 +0100)]
Add required command line utilities to build dependency docs

11 years agoAdd library dependencies for building to the docs
Jannis Pohlmann [Fri, 3 Aug 2012 13:07:35 +0000 (14:07 +0100)]
Add library dependencies for building to the docs

11 years agoDepend on systemd 37 to be able to build on Fedora 16
Jannis Pohlmann [Fri, 3 Aug 2012 13:07:12 +0000 (14:07 +0100)]
Depend on systemd 37 to be able to build on Fedora 16

11 years agoAdd parentheses in the shutdown mode rejection conditionals
Jannis Pohlmann [Fri, 3 Aug 2012 13:44:11 +0000 (14:44 +0100)]
Add parentheses in the shutdown mode rejection conditionals

11 years agoMake shutdown mode registration similar in NSC and helper binary
Jonathan Maw [Fri, 3 Aug 2012 13:31:57 +0000 (14:31 +0100)]
Make shutdown mode registration similar in NSC and helper binary

The shutdown mode checker in the Node Startup Controller now uses the
same logging message as the legacy app handler helper binary.

The shutdown mode checker in the helper binary now uses the condition
statement from the Node Startup Controller

11 years agoMake legacy app handler refuse invalid shutdown modes
Jonathan Maw [Fri, 3 Aug 2012 13:09:06 +0000 (14:09 +0100)]
Make legacy app handler refuse invalid shutdown modes

Added code to the register signal handler to refuse any register signal
which is not a combination of NSM_SHUTDOWN_TYPE_NORMAL and
NSM_SHUTDOWN_TYPE_FAST and log an error.

11 years agoFix the title of the Test legacy application handler.
Francisco Redondo Marchena [Fri, 3 Aug 2012 13:20:15 +0000 (14:20 +0100)]
Fix the title of the Test legacy application handler.

Replace the previous title by "Tests for legazy application handling".
Fix some paragraphs.

11 years agoBetter test case titles and always set the node state in TSM tests
Jonathan Maw [Fri, 3 Aug 2012 12:20:59 +0000 (13:20 +0100)]
Better test case titles and always set the node state in TSM tests

Test titles are made more descriptive by including the name of the node
state which is being set.

A link is included to the enum which defines the NSMNodeState.

Tests are changed to always set the node state. This is done by
starting the unit twice in most cases. In addition, the less-important
lines in the DLT log output are no longer specified.

Capitalization in titles has been cleaned up somewhat.

11 years agoAdd the documentation for legacy app handling tests
Francisco Redondo Marchena [Fri, 3 Aug 2012 11:30:42 +0000 (12:30 +0100)]
Add the documentation for legacy app handling tests

Add the documentation for legacy app handling tests.
The following tests are provided:
 1. Register a normal and a fast shutdown consumer.
   - Check that node-startup-controller.service registers itself
     as a shutdown consumer.
   - Check that the registration for the shutdown consumer are ok.
   - Check that in the process of shutting down the fast consumers
     shutting down first and the normal consumers second.
   - Check that the shutdown consumers are unregister as a shutdown
     consumers when they have been shutting down.
   - Check that node-startup-controller.service unregisters itself
     as a shutdown consumer when it has been shutting down.

 2. Register two normal shutdown consumers
   - Check that in the process of shutting down the consumers are
     shutting down in reverse order of registration.

 3. Register a shutdown consumer twice within different modes and timeouts
   - Check that the re-registration modify the final mode to a combination
     of both modes (normal and fast) and the timeout has been set to the
     last registration value of timeout.
   - Check that in the process of shutting down the consumer is shutting down
     for the both modes.

 4. Register a shutdown consumer with invalid arguments
  - Check that register a consumer without unit name fails.
  - Check that register a consumer within mode 0 fails
  - Check that register a consumer with a negative timeout fails.

11 years agoDocument that timeout is non-mandatory parameter and its default value
Francisco Redondo Marchena [Fri, 3 Aug 2012 09:27:27 +0000 (10:27 +0100)]
Document that timeout is non-mandatory parameter and its default value

Modify in the documentation for legacy app handler that timeout is a
non-mandatory legacy app handler argument and its default value is
1000 milliseconds.

11 years agoAdd NSM dummy documentation page
Jannis Pohlmann [Fri, 3 Aug 2012 11:55:51 +0000 (12:55 +0100)]
Add NSM dummy documentation page

11 years agoRestructure and number the Target Startup Monitoring tests
Jonathan Maw [Fri, 3 Aug 2012 10:33:58 +0000 (11:33 +0100)]
Restructure and number the Target Startup Monitoring tests

Tests are restructured in the same way as the previous commit

11 years agoNumber and restructure luc management test cases
Jonathan Maw [Fri, 3 Aug 2012 09:57:33 +0000 (10:57 +0100)]
Number and restructure luc management test cases

Test cases are restructured into:
* Description
* Test Commands
* Desired behaviour and Output

11 years agoAdd missing XML files to the reference manual Makefile.am
Jannis Pohlmann [Fri, 3 Aug 2012 10:57:10 +0000 (11:57 +0100)]
Add missing XML files to the reference manual Makefile.am

11 years agoWork on documentation of functional scope and interfaces
Jannis Pohlmann [Fri, 3 Aug 2012 09:56:03 +0000 (10:56 +0100)]
Work on documentation of functional scope and interfaces

Also fix a mistyped systemd command.

11 years agoRework reference manual a bit, start reworking test case layout
Jannis Pohlmann [Thu, 2 Aug 2012 17:42:22 +0000 (18:42 +0100)]
Rework reference manual a bit, start reworking test case layout

11 years agoSplit test scenarios into separate pages, add legacy app skeleton
Jonathan Maw [Thu, 2 Aug 2012 14:20:51 +0000 (15:20 +0100)]
Split test scenarios into separate pages, add legacy app skeleton

Each test scenario (i.e. luc, legacy app, tsm) has been split into a
separate file.

Setup steps which have to be performed for every scenario are moved into
test-general-setup.xml

Cross-references are used so that the test overview links to each test
case, and the "Testing" page links to the general setup and also each
test.

test-example has been removed because it is no longer necessary.

11 years agoAdd test scenarios for the Last User Context handling
Jonathan Maw [Thu, 2 Aug 2012 08:44:33 +0000 (09:44 +0100)]
Add test scenarios for the Last User Context handling

The following test scenarios are added to the documentation:
* Registration of a simple dictionary
* Registration does not happen on an isolated RegisterWithLUC() call
* An isolated FinishLUCRegistration() call will not change the LUC
* Registration of a complex dictionary
* Registration can happen with a series of RegisterWithLUC() calls
* Repeated registration of an app changes the order in the LUC

11 years agoSpecify difference between NSM and NSM dummy in docmentation
Jonathan Maw [Wed, 1 Aug 2012 13:08:41 +0000 (14:08 +0100)]
Specify difference between NSM and NSM dummy in docmentation

Explicitly states the difference between the Node State Manager Dummy
and the real Node State Manager, i.e.
* The NSM dummy toggles between successfully setting the node state
  and failing to set the node state.
* The NSM dummy toggles between the LUC being required, and the LUC
  not being required.
* The NSM dummy will shut down its fast shutdown clients, then its
  normal shutdown clients, on receiving the SIGHUP signal

11 years agoAdd TSM test and improve layout of test document
Jonathan Maw [Wed, 1 Aug 2012 12:30:59 +0000 (13:30 +0100)]
Add TSM test and improve layout of test document

The improvements to the layout of the test document are that the
individual tests will now show up on the table of contents.

The Target Startup Monitor (TSM) tests check that the following cases
attempt to change the node state:
* The Node Startup Controller starting
* focussed.target starting
* unfocussed.target starting
* lazy.target starting

The following case should not attempt to change the node state:
* focussed.target stopping

11 years agoAdd testing skeleton
Jonathan Maw [Wed, 1 Aug 2012 09:22:54 +0000 (10:22 +0100)]
Add testing skeleton

Lays out the structure of the test document XML

11 years agoChange required version of systemd from 37 to 183
Jannis Pohlmann [Thu, 2 Aug 2012 14:15:55 +0000 (15:15 +0100)]
Change required version of systemd from 37 to 183

11 years agoFix build instructions to include creating the m4 directory
Jannis Pohlmann [Thu, 2 Aug 2012 14:14:03 +0000 (15:14 +0100)]
Fix build instructions to include creating the m4 directory

11 years agoUnregister exported D-Bus objects on finalization
Jonathan Maw [Thu, 2 Aug 2012 10:10:49 +0000 (11:10 +0100)]
Unregister exported D-Bus objects on finalization

Adds unregistration to the following services:
* legacy app handler
* shutdown client
* node startup controller
* nsm dummy lifecycle control
* nsm dummy consumer

11 years agoRework log messages a bit to make them more readable
Jannis Pohlmann [Wed, 1 Aug 2012 16:31:50 +0000 (17:31 +0100)]
Rework log messages a bit to make them more readable

11 years agoUse DLT_LOG_INFO rather than DLT_LOG_DEBUG for everything
Jannis Pohlmann [Wed, 1 Aug 2012 15:47:50 +0000 (16:47 +0100)]
Use DLT_LOG_INFO rather than DLT_LOG_DEBUG for everything

We can't get DLT to log our debug messages, setting LoggingLevel to 7
(LOG_DEBUG) in /etc/dlt.conf does not work as expected. So for now we'll
have to resort to logging all debug messages as info messages.

11 years agoAdjust DLT log levels (info -> debug, some warnings, some errors)
Jannis Pohlmann [Wed, 1 Aug 2012 15:04:02 +0000 (16:04 +0100)]
Adjust DLT log levels (info -> debug, some warnings, some errors)

11 years agoExclusively use DLT facilities to build log strings
Jannis Pohlmann [Wed, 1 Aug 2012 14:48:35 +0000 (15:48 +0100)]
Exclusively use DLT facilities to build log strings

We used to build the log strings using g_strdup_printf() but this
results in a certain amount of overhead and extra code.

11 years agoFix the name used for the LUCStarter::node-startup-controller property
Jannis Pohlmann [Wed, 1 Aug 2012 12:48:09 +0000 (13:48 +0100)]
Fix the name used for the LUCStarter::node-startup-controller property

11 years agoReplace g_debug/g_warning calls with DLT logging
Jannis Pohlmann [Wed, 1 Aug 2012 11:37:08 +0000 (12:37 +0100)]
Replace g_debug/g_warning calls with DLT logging

11 years agoUnregister the NSM dummy DLT connection at exit
Jannis Pohlmann [Wed, 1 Aug 2012 11:26:29 +0000 (12:26 +0100)]
Unregister the NSM dummy DLT connection at exit

11 years agoFix small issues in Makefiles to make "make distcheck" happy
Jannis Pohlmann [Tue, 31 Jul 2012 18:17:18 +0000 (19:17 +0100)]
Fix small issues in Makefiles to make "make distcheck" happy

11 years agoRename all remaining bits and pieces
Jannis Pohlmann [Tue, 31 Jul 2012 18:06:03 +0000 (19:06 +0100)]
Rename all remaining bits and pieces

11 years agoRename service files and boot-manager binary
Jannis Pohlmann [Tue, 31 Jul 2012 17:41:33 +0000 (18:41 +0100)]
Rename service files and boot-manager binary

11 years agoRename BMGR DLT app ID to NSC, rename MGR context to CTRL
Jannis Pohlmann [Tue, 31 Jul 2012 17:36:44 +0000 (18:36 +0100)]
Rename BMGR DLT app ID to NSC, rename MGR context to CTRL

11 years agoRename BootManagerApplication to NodeStartupControllerApplication
Jannis Pohlmann [Tue, 31 Jul 2012 17:32:30 +0000 (18:32 +0100)]
Rename BootManagerApplication to NodeStartupControllerApplication

11 years agoRename boot manager D-Bus interface and BootManagerService class
Jannis Pohlmann [Tue, 31 Jul 2012 17:15:06 +0000 (18:15 +0100)]
Rename boot manager D-Bus interface and BootManagerService class

11 years agoFirst step of renaming the Boot Manager to Node Startup Controller
Jannis Pohlmann [Tue, 31 Jul 2012 16:45:10 +0000 (17:45 +0100)]
First step of renaming the Boot Manager to Node Startup Controller

This includes mostly files, directories and the package/tarball name.
The classes and D-Bus interfaces will be renamed in the next step.

11 years agoQuery the "active-state" property of units in the "job-removed" handler
Francisco Redondo Marchena [Tue, 31 Jul 2012 15:52:06 +0000 (16:52 +0100)]
Query the "active-state" property of units in the "job-removed" handler

Our previous attempt to fix the TargetStartupMonitor failed because when
a target is stopped, systemd drops the unit from the system bus and the
proxies we created in TargetStartupMonitor were no longer associated
with these unit objects that previously existed on the bus. When such a
target is started again, the proxy will no longer receive property
change signals from systemd.

This commit tries to implement the TargetStartupMonitor in yet another
way, which is to listen to systemd's "job-removed" signal again. In
response to receiving "job-removed" signals, we now create a SystemdUnit
for the affected unit and query that for its current "active-state"
value. Perhaps this will work.

11 years agoAvoid a segmentation fault by fixing a GVariant format string
Francisco Redondo Marchena [Tue, 31 Jul 2012 15:17:07 +0000 (16:17 +0100)]
Avoid a segmentation fault by fixing a GVariant format string

11 years agoRetrieve invalidated properties before emitting "g-properties-changed"
Francisco Redondo Marchena [Tue, 31 Jul 2012 14:55:51 +0000 (15:55 +0100)]
Retrieve invalidated properties before emitting "g-properties-changed"

It seems like the "active-state" property might be part of the
invalidated properties, not the changed ones. By passing
G_DBUS_PROXY_FLAGS_GET_INVALIDATED_PROPERTIES to the proxy constructor
we force GDBusProxy to retrieve the new "active-state" value before
calling "g-properties-changed".

Hopefully this will fix TargetStartupMonitor for real.

11 years agoTry the units' "g-properties-changed" signal to monitor the active state
Francisco Redondo Marchena [Tue, 31 Jul 2012 14:34:23 +0000 (15:34 +0100)]
Try the units' "g-properties-changed" signal to monitor the active state

For some reason the cached "active-state" property of the SystemdUnit
objects was NULL even when the "notify::active-state" signal had been
emitted.

11 years agoRemove the assertion for an unused parameter
Francisco Redondo Marchena [Tue, 31 Jul 2012 13:55:35 +0000 (14:55 +0100)]
Remove the assertion for an unused parameter

Apparently the callback for g_dbus_proxy_new() does not receive a
GDBusConnection as the first parameter, so this assertion fails.
However, since we don't need the parameter, we can just drop the
assertion.

11 years agoRework small bits of the legacy-app-handler documentation
Jannis Pohlmann [Tue, 31 Jul 2012 15:12:24 +0000 (16:12 +0100)]
Rework small bits of the legacy-app-handler documentation

11 years agoDocument the legacy app handler API
Jonathan Maw [Tue, 31 Jul 2012 14:57:40 +0000 (15:57 +0100)]
Document the legacy app handler API

11 years agoRewrite TargetStartupMonitor to monitor ActiveState properties of units
Jannis Pohlmann [Tue, 31 Jul 2012 12:20:06 +0000 (13:20 +0100)]
Rewrite TargetStartupMonitor to monitor ActiveState properties of units

11 years agoTry to query systemd jobs synchronously in the "job-removed" handler
Francisco Redondo Marchena [Tue, 31 Jul 2012 10:17:05 +0000 (11:17 +0100)]
Try to query systemd jobs synchronously in the "job-removed" handler

When we query the jobs asynchronously, systemd might have removed the
job we are looking for, and it will not be in the list of jobs it
returns. Perhaps querying jobs synchronously in the "job-removed"
handler helps to work around that.

11 years agoRevert "Indicate the system manager that the job remove callback finished."
Francisco Redondo Marchena [Tue, 31 Jul 2012 10:03:05 +0000 (11:03 +0100)]
Revert "Indicate the system manager that the job remove callback finished."

This reverts commit 97e53e2458589c5a7f7ad65b5af45626fa4d1ea1.

The "job-removed" signal doesn't expect signal handlers to return a
boolean value, so adding such a return value to our handlers will not
have any effect.

11 years agoFix built sources not always being built in common/Makefile.am
Jannis Pohlmann [Tue, 31 Jul 2012 09:59:17 +0000 (10:59 +0100)]
Fix built sources not always being built in common/Makefile.am

11 years agoAdd missing parentheses in macro definitions
Jannis Pohlmann [Tue, 31 Jul 2012 09:52:06 +0000 (10:52 +0100)]
Add missing parentheses in macro definitions

These are difficult to spot but shouldn't have caused any problems
so far because we never use the affected macros in our code.

11 years agoRemove LUC registration debug output
Jannis Pohlmann [Tue, 31 Jul 2012 09:45:28 +0000 (10:45 +0100)]
Remove LUC registration debug output

11 years agoIndicate the system manager that the job remove callback finished.
Francisco Redondo Marchena [Tue, 31 Jul 2012 07:15:28 +0000 (08:15 +0100)]
Indicate the system manager that the job remove callback finished.

Return a boolean to indicate is the job remove callback was
successful or failure.

11 years agoAdd even more debug output to TargetStartupMonitor
Francisco Redondo Marchena [Mon, 30 Jul 2012 17:04:31 +0000 (18:04 +0100)]
Add even more debug output to TargetStartupMonitor

11 years agoAdd more debugging output to TargetStartupMonitor
Francisco Redondo Marchena [Mon, 30 Jul 2012 16:31:55 +0000 (17:31 +0100)]
Add more debugging output to TargetStartupMonitor

11 years agoFix missing build rules for .c files of generated D-Bus sources
Francisco Redondo Marchena [Mon, 30 Jul 2012 16:09:33 +0000 (17:09 +0100)]
Fix missing build rules for .c files of generated D-Bus sources

The order in which make processes the source files can be random. So
sometimes it will pick the -dbus.c file before the -dbus.h file. This
commit makes sure that we have a rule to build both in the Makefile.am
instead of just having a rule for the -dbus.h file.

11 years agoRemove unused org.freedesktop.systemd1.Manager D-Bus methods
Jannis Pohlmann [Mon, 30 Jul 2012 14:51:04 +0000 (15:51 +0100)]
Remove unused org.freedesktop.systemd1.Manager D-Bus methods

We don't need to generate code for these methods unless we actually
intend to use them.

11 years agoSet the node state only in response to start jobs
Francisco Redondo Marchena [Mon, 30 Jul 2012 13:21:23 +0000 (14:21 +0100)]
Set the node state only in response to start jobs

The node state only should be set it for systemd start jobs.
To avoid setting the node state for other types of jobs like kill,
stop etc. we query systemd for a list of all jobs and check if
the type of the removed job is "start". Only then do we change
the node state.

11 years agoApply a few changes to fix make distcheck and regular builds
Jannis Pohlmann [Mon, 30 Jul 2012 14:43:14 +0000 (15:43 +0100)]
Apply a few changes to fix make distcheck and regular builds

11 years agoAdd initial version of the reference manual templates
Jannis Pohlmann [Mon, 30 Jul 2012 13:45:54 +0000 (14:45 +0100)]
Add initial version of the reference manual templates

Most of the chapters in this manual still need to be written but this
is a start.

11 years agoAdd rudimentary gtk-doc support to the project
Jannis Pohlmann [Fri, 20 Jul 2012 14:24:52 +0000 (15:24 +0100)]
Add rudimentary gtk-doc support to the project

This includes adjusting the configure script to check for gtk-doc as
well as creating the necessary directories and Makefile.am files.

At the moment, no documentation is generated. We'll have to add initial
templates that include the docbook XML generated for the D-Bus API.

11 years agoAdd option to gdbus-codegen to generate DocBook for the public interface
Francisco Redondo Marchena [Fri, 20 Jul 2012 11:41:29 +0000 (12:41 +0100)]
Add option to gdbus-codegen to generate DocBook for the public interface

Add --generate-docbook to gdbus-codegen in Makefile.am in order to
get the documentation for org.genivi.BootManager1.BootManager
interface. It makes a .xml file called
boot-manager-dbus-doc-org.genivi.BootManager1.BootManager.xml

11 years agoAdd build dependencies to the README file
Jannis Pohlmann [Mon, 30 Jul 2012 12:18:38 +0000 (13:18 +0100)]
Add build dependencies to the README file

11 years agoAdd licensing/build/testing instructions to the README file
Jannis Pohlmann [Mon, 30 Jul 2012 12:12:41 +0000 (13:12 +0100)]
Add licensing/build/testing instructions to the README file

11 years agoFix make distcheck, rework tests, reorganise files
Jannis Pohlmann [Fri, 27 Jul 2012 15:50:22 +0000 (16:50 +0100)]
Fix make distcheck, rework tests, reorganise files

This commit fixes make distcheck by making the LUC handler test part of
"make installcheck" and by disabling the legacy app tests in "make
check".

For the LUC handler test to not interfere with the LUC on the system,
the boot-manager binary is now aware of a LUC_PATH environment variable
that overrides the LUC_PATH string defined at build-time. This way we
can use a different LUC file for the test.

This commit also drops the nsm-dummy/dbus/ and nsm-dummy/systemd/
directories and moves the corresponding files to nsm-dummy/.

11 years agoFix a crash caused by using the old JobRemoved signature in JobManager
Jannis Pohlmann [Sat, 28 Jul 2012 15:27:08 +0000 (16:27 +0100)]
Fix a crash caused by using the old JobRemoved signature in JobManager

The signature of the JobRemoved signal recently changed in systemd, when
a new "unit" parameter was added. This commit changes the JobManager to
include this parameter in its JobRemoved handler and thereby avoids
segmentation faults caused by assuming fourth parameter is a JobManager
object.

11 years agoLog more information when completing lifecycle requests
Jannis Pohlmann [Sat, 28 Jul 2012 14:41:47 +0000 (15:41 +0100)]
Log more information when completing lifecycle requests

11 years agoUse $(sysconfdir) and $(libdir) in NSM dummy Makefiles
Jannis Pohlmann [Fri, 27 Jul 2012 16:43:15 +0000 (17:43 +0100)]
Use $(sysconfdir) and $(libdir) in NSM dummy Makefiles

11 years agoSet node state in the TargetStartupMonitor when certain targets started
Francisco Redondo Marchena [Fri, 27 Jul 2012 12:55:18 +0000 (13:55 +0100)]
Set node state in the TargetStartupMonitor when certain targets started

Set the node state from the TargetStartupMonitor when certain targets
have been started (focussed, unfocussed, lazy).

Also, add a NSMNodeState enum type to nsm-enum-types.{c,h}.

11 years agoUse the WATCHDOG_USEC env variable to define the watchdog timeout
Jannis Pohlmann [Fri, 27 Jul 2012 13:27:15 +0000 (14:27 +0100)]
Use the WATCHDOG_USEC env variable to define the watchdog timeout

Also, set WatchdogSec to 5 seconds in boot-manager.service.in and
nsm-dummy.service.in.

The way this works is that systemd will take the WatchdogSec value,
convert it to micro-seconds and set the WATCHDOG_USEC environment
variable for the boot manager or nsm-dummy process. The boot manager
or NSM dummy then halves that value and creates the WatchdogClient
so that it calls sd_notify(0, WATCHDOG=1) twice in each
WATCHDOG_USEC interval. If WATCHDOG_USEC can't be parsed into a
number or if it is not set, the systemd watchdog timestamp is
never updated.

This is what systemd's requires services to do in order to support its
watchdog feature properly.

11 years agoAdd 'luc-groups-started' signal to send sd_notify(READY=1) to systemd
Jannis Pohlmann [Fri, 27 Jul 2012 11:29:43 +0000 (12:29 +0100)]
Add 'luc-groups-started' signal to send sd_notify(READY=1) to systemd

We need to notify systemd when the boot manager process has finished
starting the LUC. What we did so far was to call sd_notify() while
constructing the BootManagerApplication. This commit adds a
'luc-groups-started' signal to LUCStarter. BootManagerApplication now
connects to that in order to call sd_notify() at the right time.

11 years agoUnregister the boot manager itself as a shutdown client
Francisco Redondo Marchena [Thu, 26 Jul 2012 17:42:44 +0000 (18:42 +0100)]
Unregister the boot manager itself as a shutdown client

Unregister the boot manager as a shutdown client after it has been
shutting down. Handle gracefully the application lifecycle request to
manage the shutting down and the unregistration correctly.

11 years agoAvoid compiler warnings due to casting pointers to uint
Francisco Redondo Marchena [Thu, 26 Jul 2012 17:40:12 +0000 (18:40 +0100)]
Avoid compiler warnings due to casting pointers to uint

11 years agoCheck with NSM whether to load the LUC or not
Francisco Redondo Marchena [Thu, 26 Jul 2012 15:26:40 +0000 (16:26 +0100)]
Check with NSM whether to load the LUC or not

If the NSM is not available or the NSMLifecycleControl proxy cannot be
created, we assume that we should start the LUC anyway.

11 years agoUpon receiving SIGHUP, shut down all clients asynchronously
Jannis Pohlmann [Thu, 26 Jul 2012 16:25:35 +0000 (17:25 +0100)]
Upon receiving SIGHUP, shut down all clients asynchronously

This is done by asynchronously processing the list of registered
shutdown clients once for each shutdown mode. We start with fast and
then continue with normal once all clients registered for fast shutdown
have been shut down.

This commit also implements waiting for pending lifecycle requests using
a timeout and advances to the next client in the queue if the timeout is
triggered before LifecycleRequestComplete is called by the client we are
currently waiting for.

11 years agoMake sure to release the NSMConsumer in LAHandlerService
Jannis Pohlmann [Thu, 26 Jul 2012 15:59:49 +0000 (16:59 +0100)]
Make sure to release the NSMConsumer in LAHandlerService

Otherwise we'd be leaking memory

11 years agoFix LifecycleRequest handler by returning a boolean value
Jannis Pohlmann [Thu, 26 Jul 2012 13:07:59 +0000 (14:07 +0100)]
Fix LifecycleRequest handler by returning a boolean value

This caused a GLib-internal critical warning about g_object_unref being
called with something that wasn't a GObject. It works fine now.

11 years agoRegister boot manager itself as a shutdown consumer asynchronously
Francisco Redondo Marchena [Thu, 26 Jul 2012 11:12:31 +0000 (12:12 +0100)]
Register boot manager itself as a shutdown consumer asynchronously

Replace the synchronous registration by an asynchronous
registration for the boot manager. Gracefully handle/ignore any
errors in the finish callback apart from logging them using the DLT
framework.

11 years agoRemove debugging output we no longer need
Jannis Pohlmann [Thu, 26 Jul 2012 12:43:15 +0000 (13:43 +0100)]
Remove debugging output we no longer need

11 years agoMake NSMShutdownType a flags type rather than an enum type
Jannis Pohlmann [Thu, 26 Jul 2012 12:41:33 +0000 (13:41 +0100)]
Make NSMShutdownType a flags type rather than an enum type

This makes more sense because enums are not supposed to be combined
using bitwise operators. Flags, however, exist exactly for this
purpose.

11 years agoMove deregistration of shutdown consumers into LAHandlerService
Jannis Pohlmann [Thu, 26 Jul 2012 12:39:11 +0000 (13:39 +0100)]
Move deregistration of shutdown consumers into LAHandlerService

LAHandlerService is a better place for this functionalit than
BootManagerApplication. Apart from this deregistration, anything related
to legacy app shutdown consumers is already handled solely by the
LAHandlerService anyway, so it makes sense to move the deregistration
there as well.

11 years agoAllow shutdown consumers for legacy apps to be re-registered
Jannis Pohlmann [Thu, 26 Jul 2012 12:36:52 +0000 (13:36 +0100)]
Allow shutdown consumers for legacy apps to be re-registered

Until now we always ignored re-registrations of legacy apps. In order
to allow the shutdown mode or timeout of a shutdown consumer for a
legacy app to be updated, however, this commit now forwards legacy app
re-registrations to the NSM.

11 years agoUse an int for the --shutdown-mode/-m option of legacy-app-handler
Jannis Pohlmann [Thu, 26 Jul 2012 10:51:35 +0000 (11:51 +0100)]
Use an int for the --shutdown-mode/-m option of legacy-app-handler

This allows to register for multiple modes at the same time, e.g. by
passing in 3 for normal and fast.

11 years agoHandle re-registration of shutdown clients by updating the mode/timeout
Jannis Pohlmann [Thu, 26 Jul 2012 10:10:16 +0000 (11:10 +0100)]
Handle re-registration of shutdown clients by updating the mode/timeout

Whenever a shutdown client (now identified only by the bus name and
object path instead of bus name, object path and shutdown mode) is
registered a second or third time, we simply update the shutdown mode
by combining the old and new one with a bitwise OR. The shutdown
timeout is also replaced with the new one.

11 years agoDeregister shutdown consumer when shutting down boot manager
Francisco Redondo Marchena [Wed, 25 Jul 2012 14:05:52 +0000 (15:05 +0100)]
Deregister shutdown consumer when shutting down boot manager

Implement deregister shutdown consumer when boot manager is
shutting down. Change the shutdown tables replacing shutdown
consumers by shutdown clients. Modify in the same terms the
boot manager registration (from shutdown consumer registration
to shutdown client registration).

11 years agoFix the previous commit, forgot to rename the SIGINT handler
Jannis Pohlmann [Wed, 25 Jul 2012 14:20:51 +0000 (15:20 +0100)]
Fix the previous commit, forgot to rename the SIGINT handler

11 years agoUse SIGHUP instead of SIGINT for simulating an NSM shutdown
Jannis Pohlmann [Wed, 25 Jul 2012 13:55:27 +0000 (14:55 +0100)]
Use SIGHUP instead of SIGINT for simulating an NSM shutdown

In the SIGHUP handler, we no longer shut down the NSM process so that we
can keep it around for debugging purposes.

11 years agoFix corrupted list after reverse shutdown client traversal
Jannis Pohlmann [Wed, 25 Jul 2012 13:52:06 +0000 (14:52 +0100)]
Fix corrupted list after reverse shutdown client traversal

The problem is that g_list_reverse() modifies the list in place, so in
order to not corrupt the shutdown client list of the NSMConsumerService,
we would have to copy the list. What this commit does instead is to not
call g_list_reverse() and instead traverse the list in reverse order
directly.

This commit also improves the shutdown logging a bit.

11 years agoImplement the LifecycleRequestComplete by logging request ID and status
Jannis Pohlmann [Wed, 25 Jul 2012 13:49:33 +0000 (14:49 +0100)]
Implement the LifecycleRequestComplete by logging request ID and status

11 years agoStart the boot manager D-Bus services in main()
Jannis Pohlmann [Wed, 25 Jul 2012 13:45:44 +0000 (14:45 +0100)]
Start the boot manager D-Bus services in main()

Before we started them in boot_manager_application_constructed() but
that meant that we could not react to errors properly. We now log a
fatal error using the DLT framework and exit if we can't bring up the
D-Bus services.

11 years agoImprove shutdown handling, keep shutdown clients around afterwards
Jannis Pohlmann [Tue, 24 Jul 2012 15:51:11 +0000 (16:51 +0100)]
Improve shutdown handling, keep shutdown clients around afterwards

Use the new ShutdownClient class to bundle information about registered
shutdown clients and their units, modes and timeouts.

Do not remove shutdown clients from the registered clients list after
shutting them down. Instead, wait for a separate unregister request.

Shut clients down mode by mode when receiving SIGINT. Start with clients
registered for fast, then continue with clients registered for normal.

Improve logging output a little bit.

11 years agoAdd new ShutdownClient class to bundle information about consumers
Jannis Pohlmann [Tue, 24 Jul 2012 16:18:14 +0000 (17:18 +0100)]
Add new ShutdownClient class to bundle information about consumers

Objects of this class store the bus name, the object path, the shutdown
mode, the shutdown timeout and a ShutdownConsumer proxy or skeleton for
a shutdown consumer.

11 years agoImplement a shutdown consumer for the boot manager itself
Francisco Redondo Marchena [Tue, 24 Jul 2012 12:16:04 +0000 (13:16 +0100)]
Implement a shutdown consumer for the boot manager itself

Create a ShutdownConsumer skeleton in BootManagerApplication and
implement its "handle-lifecycle-request" signal to shutdown the
process.

In addition to that, the "handle-lifecycle-request" implementation also
cancels the LUC startup. It replaces the SIGINT handler, which is
removed with this commit.

11 years agoFix the systemd unit associated with the boot manager D-Bus service
Jannis Pohlmann [Tue, 24 Jul 2012 13:19:32 +0000 (14:19 +0100)]
Fix the systemd unit associated with the boot manager D-Bus service