From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id DAA7D1FF16F for ; Tue, 14 Oct 2025 16:41:00 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 75E177B8E; Tue, 14 Oct 2025 16:40:28 +0200 (CEST) From: Fiona Ebner To: pve-devel@lists.proxmox.com Date: Tue, 14 Oct 2025 16:39:20 +0200 Message-ID: <20251014143946.160679-10-f.ebner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251014143946.160679-1-f.ebner@proxmox.com> References: <20251014143946.160679-1-f.ebner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1760452752977 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.021 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH qemu-server 09/16] monitor: qmp: allow 'qsd' peer type for qemu-storage-daemon X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Signed-off-by: Fiona Ebner --- src/PVE/QemuServer/Monitor.pm | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/PVE/QemuServer/Monitor.pm b/src/PVE/QemuServer/Monitor.pm index c8a72a64..efdee8e7 100644 --- a/src/PVE/QemuServer/Monitor.pm +++ b/src/PVE/QemuServer/Monitor.pm @@ -19,11 +19,12 @@ our @EXPORT_OK = qw( my $result = qmp_cmd($peer, $cmd); Execute the C<$qmp_command_name> with arguments C<%params> for the peer C<$peer>. The type C<$type> -of the peer can be C for the QEMU instance of the VM or C for the guest agent of the VM. -Dies if the VM is not running or the monitor socket cannot be reached, even if the C argument -is used. Returns the structured result from the QMP side converted from JSON to structured Perl -data. In case the C argument is used and the QMP command failed or timed out, the result is a -hash reference with an C key containing the error message. +of the peer can be C for the QEMU instance of the VM, C for the guest agent of the VM or +C for the QEMU storage daemon associated to the VM. Dies if the VM is not running or the +monitor socket cannot be reached, even if the C argument is used. Returns the structured +result from the QMP side converted from JSON to structured Perl data. In case the C argument +is used and the QMP command failed or timed out, the result is a hash reference with an C key +containing the error message. Parameters: @@ -35,8 +36,8 @@ Parameters: =item C<$vmid>: The ID of the virtual machine. -=item C<$type>: Type of the peer to communicate with. This can be C for the VM's QEMU instance -or C for the VM's guest agent. +=item C<$type>: Type of the peer to communicate with. This can be C for the VM's QEMU instance, +C for the VM's guest agent or C for the QEMU storage daemon assoicated to the VM. =back @@ -70,7 +71,16 @@ sub qmp_cmd { } eval { - die "VM $vmid not running\n" if !PVE::QemuServer::Helpers::vm_running_locally($vmid); + if ($peer->{type} eq 'qmp' || $peer->{type} eq 'qga') { + die "VM $vmid not running\n" + if !PVE::QemuServer::Helpers::vm_running_locally($vmid); + } elsif ($peer->{type} eq 'qsd') { + die "QEMU storage daemon for VM $vmid not running\n" + if !PVE::QemuServer::Helpers::qsd_running_locally($vmid); + } else { + die "qmp_cmd - unknown peer type $peer->{type}\n"; + } + my $sname = PVE::QemuServer::Helpers::qmp_socket($peer); if (-e $sname) { # test if VM is reasonably new and supports qmp/qga my $qmpclient = PVE::QMPClient->new(); @@ -88,6 +98,14 @@ sub qmp_cmd { return $res; } +sub qsd_cmd { + my ($vmid, $execute, %params) = @_; + + my $cmd = { execute => $execute, arguments => \%params }; + + return qmp_cmd({ vmid => $vmid, type => 'qsd' }, $cmd); +} + sub mon_cmd { my ($vmid, $execute, %params) = @_; -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel