diff options
author | Jeremy Kerr <jk@ozlabs.org> | 2014-07-21 18:18:35 +0800 |
---|---|---|
committer | Jeremy Kerr <jk@ozlabs.org> | 2014-07-22 09:04:59 +0800 |
commit | d2b12ddb905a74fa6b2e454142b0b9f71fd99398 (patch) | |
tree | ef6ab12a56aa0dc9fc0f6b35795ed2b9f01c0411 /discover/device-handler.c | |
parent | 3c49b3fa6e6038fd226253e71cb082e09b4ff7a5 (diff) | |
download | talos-petitboot-d2b12ddb905a74fa6b2e454142b0b9f71fd99398.tar.gz talos-petitboot-d2b12ddb905a74fa6b2e454142b0b9f71fd99398.zip |
discover: Add safe mode
Safe mode configures the discover server to not start any device
parsing; this can be used to diagnose any problems with early device
handing.
In safe mode, we don't initialise any of the device sources - udev,
network and user events are disabled.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'discover/device-handler.c')
-rw-r--r-- | discover/device-handler.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/discover/device-handler.c b/discover/device-handler.c index b93cdfa..e4978fa 100644 --- a/discover/device-handler.c +++ b/discover/device-handler.c @@ -285,6 +285,9 @@ struct device_handler *device_handler_init(struct discover_server *server, parser_init(); + if (config_get()->safe_mode) + return handler; + rc = device_handler_init_sources(handler); if (rc) { talloc_free(handler); @@ -842,6 +845,13 @@ static int device_handler_init_sources(struct device_handler *handler) static void device_handler_reinit_sources(struct device_handler *handler) { + /* if we haven't initialised sources previously (becuase we started in + * safe mode), then init once here. */ + if (!(handler->udev || handler->network || handler->user_event)) { + device_handler_init_sources(handler); + return; + } + udev_reinit(handler->udev); network_shutdown(handler->network); |