diff options
author | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-08-17 14:33:25 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-08-18 15:31:00 +1000 |
commit | 5b308c5680f349dd080f516f8c371efd67d496d5 (patch) | |
tree | aa8a2af8e2c315b66e482f9183fa9ec14c439b89 /discover | |
parent | 61e30136d88c1e2cef353e09789dbb969be64f55 (diff) | |
download | petitboot-5b308c5680f349dd080f516f8c371efd67d496d5.zip petitboot-5b308c5680f349dd080f516f8c371efd67d496d5.tar.gz |
discover: Add disable param for dm-snapshots
Add a debug-style nvram parameter to disallow the use of device-mapper
snapshots.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
Diffstat (limited to 'discover')
-rw-r--r-- | discover/devmapper.c | 4 | ||||
-rw-r--r-- | discover/platform-powerpc.c | 5 | ||||
-rw-r--r-- | discover/platform.c | 4 |
3 files changed, 13 insertions, 0 deletions
diff --git a/discover/devmapper.c b/discover/devmapper.c index 1fd1215..e2ef0b5 100644 --- a/discover/devmapper.c +++ b/discover/devmapper.c @@ -6,6 +6,7 @@ #include "libdevmapper.h" #include "devmapper.h" +#include "platform.h" #define MERGE_INTERVAL_US 200000 @@ -320,6 +321,9 @@ int devmapper_init_snapshot(struct device_handler *handler, { struct ramdisk_device *ramdisk; + if (config_get()->disable_snapshots) + return 0; + ramdisk = device_handler_get_ramdisk(handler); if (!ramdisk) { pb_log("No ramdisk available for snapshot %s\n", diff --git a/discover/platform-powerpc.c b/discover/platform-powerpc.c index fc96305..d45cced 100644 --- a/discover/platform-powerpc.c +++ b/discover/platform-powerpc.c @@ -54,6 +54,7 @@ static const char *known_params[] = { "petitboot,language", "petitboot,debug?", "petitboot,write?", + "petitboot,snapshots?", NULL, }; @@ -553,6 +554,10 @@ static void populate_config(struct platform_powerpc *platform, val = get_param(platform, "petitboot,write?"); if (val) config->allow_writes = !strcmp(val, "true"); + + val = get_param(platform, "petitboot,snapshots?"); + if (val) + config->disable_snapshots = !strcmp(val, "false"); } static char *iface_config_str(void *ctx, struct interface_config *config) diff --git a/discover/platform.c b/discover/platform.c index b1d0f19..a6bd74c 100644 --- a/discover/platform.c +++ b/discover/platform.c @@ -35,6 +35,9 @@ static void dump_config(struct config *config) if (config->safe_mode) pb_log(" safe mode: active\n"); + if (config->disable_snapshots) + pb_log(" dm-snapshots disabled\n"); + for (i = 0; i < config->network.n_interfaces; i++) { struct interface_config *ifconf = config->network.interfaces[i]; @@ -109,6 +112,7 @@ void config_set_defaults(struct config *config) config->safe_mode = false; config->lang = NULL; config->allow_writes = true; + config->disable_snapshots = false; config->n_autoboot_opts = 2; config->autoboot_opts = talloc_array(config, struct autoboot_option, |