public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fiona Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v2 3/7] agent: parse: change signature to take property string rather than full VM config
Date: Thu, 23 Apr 2026 14:35:14 +0200	[thread overview]
Message-ID: <20260423124004.115303-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20260423124004.115303-1-f.ebner@proxmox.com>

Better encapsulation and in preparation to harmonize checks for freeze
while avoiding the need to pass the full config to block jobs.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---

Changes in v2:
* Also adapt new should_fs_freeze() caller.

 src/PVE/QemuServer.pm       |  6 +++---
 src/PVE/QemuServer/Agent.pm | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index 2a469fff..ec311160 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -3426,7 +3426,7 @@ sub config_to_command {
 
     push @$cmd, '-k', $conf->{keyboard} if defined($conf->{keyboard});
 
-    my $guest_agent = parse_guest_agent($conf);
+    my $guest_agent = parse_guest_agent($conf->{agent});
 
     if ($guest_agent->{enabled}) {
         my $qgasocket = PVE::QemuServer::Helpers::qmp_socket(
@@ -5163,8 +5163,8 @@ sub vmconfig_update_agent {
 
     my $hotplug_options = { fstrim_cloned_disks => 1 };
 
-    my $old_agent = parse_guest_agent($conf);
-    my $agent = parse_guest_agent({ $opt => $value });
+    my $old_agent = parse_guest_agent($conf->{agent});
+    my $agent = parse_guest_agent($value);
 
     for my $option (keys %$agent) { # added/changed options
         next if defined($hotplug_options->{$option});
diff --git a/src/PVE/QemuServer/Agent.pm b/src/PVE/QemuServer/Agent.pm
index a68dd8d7..8b814edd 100644
--- a/src/PVE/QemuServer/Agent.pm
+++ b/src/PVE/QemuServer/Agent.pm
@@ -61,10 +61,10 @@ our $agent_fmt = {
     },
 };
 
-sub parse_guest_agent($conf) {
-    return {} if !defined($conf->{agent});
+sub parse_guest_agent($value) {
+    return {} if !defined($value);
 
-    my $res = eval { PVE::JSONSchema::parse_property_string($agent_fmt, $conf->{agent}) };
+    my $res = eval { PVE::JSONSchema::parse_property_string($agent_fmt, $value) };
     warn $@ if $@;
 
     # if the agent is disabled ignore the other potentially set properties
@@ -75,7 +75,7 @@ sub parse_guest_agent($conf) {
 sub get_qga_key($conf, $key) {
     return undef if !defined($conf->{agent});
 
-    my $agent = parse_guest_agent($conf);
+    my $agent = parse_guest_agent($conf->{agent});
     return $agent->{$key};
 }
 
@@ -188,7 +188,7 @@ Does B<not> check whether the agent is actually running.
 =cut
 
 sub should_fs_freeze($conf) {
-    my $agent = parse_guest_agent($conf);
+    my $agent = parse_guest_agent($conf->{agent});
     return 0 if !$agent->{enabled};
     return $agent->{'freeze-fs'} // 1;
 }
-- 
2.47.3





  parent reply	other threads:[~2026-04-23 12:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-23 12:35 [PATCH-SERIES qemu-server v2 0/7] fix #7383: agent: fsfreeze: skip freeze if already frozen Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 1/7] agent: migrate to v5.36 and use subroutine signatures Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 2/7] agent: rename guest_fs{freeze,thaw} to guest_fs_{freeze,thaw} Fiona Ebner
2026-04-23 12:35 ` Fiona Ebner [this message]
2026-04-23 12:35 ` [PATCH qemu-server v2 4/7] agent: should fs freeze: change signature to take property string rather than full VM config Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 5/7] clone disk/block jobs: change signatures to take guest agent property string Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 6/7] agent: fs freeze: harmonize checks for guest fs freeze Fiona Ebner
2026-04-23 12:35 ` [PATCH qemu-server v2 7/7] fix #7383: agent: fsfreeze: skip freeze if already frozen Fiona Ebner

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=20260423124004.115303-4-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.proxmox.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