]> git.ozlabs.org Git - petitboot/commitdiff
discover/device-handler: Disable safe mode warning on reinit
authorSamuel Mendoza-Jonas <sam@mendozajonas.com>
Wed, 23 Aug 2017 01:05:58 +0000 (11:05 +1000)
committerSamuel Mendoza-Jonas <sam@mendozajonas.com>
Wed, 11 Oct 2017 00:31:09 +0000 (11:31 +1100)
If a user pressed "Rescan Devices" in safe mode the reinit would
complete successfully, but the big warning that safe mode is active
would remain. On reinit clear the safe_mode flag properly.

This has no functional change aside from clearing the UI warning - the
IPMI override remains active until cleared or a successful boot occurs.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
(cherry picked from commit b9b5fa357e5921eb752e62f7146339007d9f767f)

discover/device-handler.c

index ec1eee344802a24e3c9f4febdd69d1c6f6fdc6c4..efeb6264d7cc5f8d7c031f6ed9509deeaab5c6c7 100644 (file)
@@ -18,6 +18,7 @@
 #include <process/process.h>
 #include <url/url.h>
 #include <i18n/i18n.h>
 #include <process/process.h>
 #include <url/url.h>
 #include <i18n/i18n.h>
+#include <pb-config/pb-config.h>
 
 #include <sys/sysmacros.h>
 #include <sys/types.h>
 
 #include <sys/sysmacros.h>
 #include <sys/types.h>
@@ -349,6 +350,7 @@ void device_handler_reinit(struct device_handler *handler)
 {
        struct discover_boot_option *opt, *tmp;
        struct ramdisk_device *ramdisk;
 {
        struct discover_boot_option *opt, *tmp;
        struct ramdisk_device *ramdisk;
+       struct config *config;
        unsigned int i;
 
        device_handler_cancel_default(handler);
        unsigned int i;
 
        device_handler_cancel_default(handler);
@@ -384,6 +386,14 @@ void device_handler_reinit(struct device_handler *handler)
        handler->ramdisks = NULL;
        handler->n_ramdisks = 0;
 
        handler->ramdisks = NULL;
        handler->n_ramdisks = 0;
 
+       /* If the safe mode warning was active disable it now */
+       if (config_get()->safe_mode) {
+               config = config_copy(handler, config_get());
+               config->safe_mode = false;
+               config_set(config);
+               discover_server_notify_config(handler->server, config);
+       }
+
        device_handler_reinit_sources(handler);
 }
 
        device_handler_reinit_sources(handler);
 }