INSTANCE_ATTR_NICE,
INSTANCE_ATTR_LIMITS,
INSTANCE_ATTR_WATCH,
+ INSTANCE_ATTR_ERROR,
__INSTANCE_ATTR_MAX
};
[INSTANCE_ATTR_NICE] = { "nice", BLOBMSG_TYPE_INT32 },
[INSTANCE_ATTR_LIMITS] = { "limits", BLOBMSG_TYPE_TABLE },
[INSTANCE_ATTR_WATCH] = { "watch", BLOBMSG_TYPE_ARRAY },
+ [INSTANCE_ATTR_ERROR] = { "error", BLOBMSG_TYPE_ARRAY },
};
struct instance_netdev {
{
int pid;
+ if (!avl_is_empty(&in->errors.avl)) {
+ LOG("Not starting instance %s::%s, an error was indicated\n", in->srv->name, in->name);
+ return;
+ }
+
if (in->proc.pending)
return;
if (!blobmsg_list_equal(&in->limits, &in_new->limits))
return true;
+ if (!blobmsg_list_equal(&in->errors, &in_new->errors))
+ return true;
+
return false;
}
if (!instance_fill_array(&in->limits, tb[INSTANCE_ATTR_LIMITS], NULL, false))
return false;
+ if (!instance_fill_array(&in->errors, tb[INSTANCE_ATTR_ERROR], NULL, true))
+ return false;
+
return true;
}
blobmsg_list_free(&in->netdev);
blobmsg_list_free(&in->file);
blobmsg_list_free(&in->limits);
+ blobmsg_list_free(&in->errors);
}
static void
blobmsg_list_move(&in->netdev, &in_src->netdev);
blobmsg_list_move(&in->file, &in_src->file);
blobmsg_list_move(&in->limits, &in_src->limits);
+ blobmsg_list_move(&in->errors, &in_src->errors);
in->trigger = in_src->trigger;
in->command = in_src->command;
in->name = in_src->name;
blobmsg_list_simple_init(&in->env);
blobmsg_list_simple_init(&in->data);
blobmsg_list_simple_init(&in->limits);
+ blobmsg_list_simple_init(&in->errors);
in->valid = instance_config_parse(in);
}
blobmsg_add_u32(b, "pid", in->proc.pid);
blobmsg_add_blob(b, in->command);
+ if (!avl_is_empty(&in->errors.avl)) {
+ struct blobmsg_list_node *var;
+ void *e = blobmsg_open_array(b, "errors");
+ blobmsg_list_for_each(&in->errors, var)
+ blobmsg_add_string(b, NULL, blobmsg_data(var->data));
+ blobmsg_close_table(b, e);
+ }
+
if (!avl_is_empty(&in->env.avl)) {
struct blobmsg_list_node *var;
void *e = blobmsg_open_table(b, "env");