diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/json.h | 1 | ||||
-rw-r--r-- | src/rest.c | 8 |
2 files changed, 9 insertions, 0 deletions
@@ -91,6 +91,7 @@ struct og_msg_params { struct og_image image; const char *task_id; uint64_t flags; + bool backup; }; int og_json_parse_partition_setup(json_t *element, struct og_msg_params *params); @@ -79,6 +79,7 @@ struct ev_loop *og_loop; #define OG_REST_PARAM_SCOPE (1UL << 41) #define OG_REST_PARAM_MODE (1UL << 42) #define OG_REST_PARAM_CENTER (1UL << 43) +#define OG_REST_PARAM_BACKUP (1UL << 44) static LIST_HEAD(client_list); static LIST_HEAD(client_wol_list); @@ -2187,12 +2188,18 @@ int og_json_parse_create_image(json_t *element, err = og_json_parse_uint64(value, ¶ms->image.group_id); } else if (!strcmp(key, "center_id")) { err = og_json_parse_uint64(value, ¶ms->image.center_id); + } else if (!strcmp(key, "backup")) { + err = og_json_parse_bool(value, ¶ms->backup); + params->flags |= OG_REST_PARAM_BACKUP; } if (err < 0) return err; } + if (!og_msg_params_validate(params, OG_REST_PARAM_BACKUP)) + params->backup = true; + return 0; } @@ -2252,6 +2259,7 @@ static int og_cmd_create_image(json_t *element, struct og_msg_params *params) return err; json_object_set_new(clients ,"repository", json_string(repository_ip)); + json_object_set_new(clients ,"backup", json_boolean(params->backup)); return og_send_request(OG_METHOD_POST, OG_CMD_IMAGE_CREATE, params, clients); |