public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Tiago Sousa via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Tiago Sousa <joao.sousa@eurotux.com>
Subject: [pve-devel] [PATCH qemu-server 2/2] qmeventd: add block write threshold event handling
Date: Sat,  2 Aug 2025 17:42:40 +0100	[thread overview]
Message-ID: <mailman.534.1754153013.367.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20250802164240.21751-1-joao.sousa@eurotux.com>

[-- Attachment #1: Type: message/rfc822, Size: 5104 bytes --]

From: Tiago Sousa <joao.sousa@eurotux.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server 2/2] qmeventd: add block write threshold event handling
Date: Sat,  2 Aug 2025 17:42:40 +0100
Message-ID: <20250802164240.21751-3-joao.sousa@eurotux.com>

Signed-off-by: Tiago Sousa <joao.sousa@eurotux.com>
---
 src/qmeventd/qmeventd.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/src/qmeventd/qmeventd.c b/src/qmeventd/qmeventd.c
index 1d9eb74a..616b6521 100644
--- a/src/qmeventd/qmeventd.c
+++ b/src/qmeventd/qmeventd.c
@@ -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\n", nodename_string);
+            }
+            fclose(p_extend_queue);
+        }
     }
 }
 
-- 
2.39.5



[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

      parent reply	other threads:[~2025-08-02 16:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-25 10:00 [pve-devel] [RFC storage/qemu-server] Thin provisioning on LVM Joao Sousa via pve-devel
2025-07-25 14:46 ` Tiago Sousa via pve-devel
2025-08-02 16:42   ` [pve-devel] [PATCH qemu-server 0/2] set write threshold logic Tiago Sousa via pve-devel
2025-08-04  9:14     ` Fiona Ebner
2025-08-11 20:34       ` Joao Sousa via pve-devel
     [not found]   ` <20250802164240.21751-1-joao.sousa@eurotux.com>
2025-08-02 16:42     ` [pve-devel] [PATCH qemu-server 1/2] blockdev: add set write threshold Tiago Sousa via pve-devel
2025-08-02 16:42     ` Tiago Sousa via pve-devel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mailman.534.1754153013.367.pve-devel@lists.proxmox.com \
    --to=pve-devel@lists.proxmox.com \
    --cc=joao.sousa@eurotux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal