qmeventd: add block write threshold event handling
This commit is contained in:
parent
14823177f5
commit
7f7776c18e
1 changed files with 20 additions and 1 deletions
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
#define DEFAULT_KILL_TIMEOUT 60
|
||||
|
||||
static int verbose = 0;
|
||||
static int verbose = 1;
|
||||
static int kill_timeout = DEFAULT_KILL_TIMEOUT;
|
||||
static int epoll_fd = 0;
|
||||
static const char *progname;
|
||||
|
|
@ -209,6 +209,25 @@ void handle_qmp_event(struct Client *client, struct json_object *obj) {
|
|||
|
||||
// check if a backup is running and kill QEMU process if not
|
||||
terminate_check(client);
|
||||
} else if (!strcmp(json_object_get_string(event), "BLOCK_WRITE_THRESHOLD")) {
|
||||
struct json_object *data;
|
||||
struct json_object *nodename;
|
||||
if (json_object_object_get_ex(obj, "data", &data) &&
|
||||
json_object_object_get_ex(data, "node-name", &nodename)) {
|
||||
|
||||
// needs concurrency control
|
||||
char extend_queue_path[] = "/etc/pve/extend-queue";
|
||||
FILE *p_extend_queue = fopen(extend_queue_path, "a");
|
||||
if (p_extend_queue == NULL) {
|
||||
VERBOSE_PRINT(
|
||||
"%s: Couldn't open extend queue file %s", client->qemu.vmid, extend_queue_path
|
||||
);
|
||||
} else {
|
||||
const char *nodename_string = json_object_get_string(nodename);
|
||||
fprintf(p_extend_queue, "%s: %s\n", client->qemu.vmid, nodename_string);
|
||||
}
|
||||
fclose(p_extend_queue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue