public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Alexandre Derumier via pve-devel <pve-devel@lists.proxmox.com>
To: pve-devel@lists.proxmox.com
Cc: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
Subject: [pve-devel] [PATCH v2 qemu-server 07/10] convert iothread to json
Date: Wed, 16 Jul 2025 18:34:12 +0200	[thread overview]
Message-ID: <mailman.81.1752683695.354.pve-devel@lists.proxmox.com> (raw)
In-Reply-To: <20250716163415.1837210-1-alexandre.derumier@groupe-cyllene.com>

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

From: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH v2 qemu-server 07/10] convert iothread to json
Date: Wed, 16 Jul 2025 18:34:12 +0200
Message-ID: <20250716163415.1837210-8-alexandre.derumier@groupe-cyllene.com>

Signed-off-by: Alexandre Derumier <alexandre.derumier@groupe-cyllene.com>
---
 src/PVE/QemuServer.pm             | 8 ++++----
 src/PVE/QemuServer/DriveDevice.pm | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/PVE/QemuServer.pm b/src/PVE/QemuServer.pm
index f9c195a0..5590bfbe 100644
--- a/src/PVE/QemuServer.pm
+++ b/src/PVE/QemuServer.pm
@@ -73,7 +73,7 @@ use PVE::QemuServer::Drive qw(
     storage_allows_io_uring_default
 );
 use PVE::QemuServer::DriveDevice
-    qw(print_drivedevice_controller get_drivedevice print_drivedevice_iothread scsihw_infos);
+    qw(print_drivedevice_controller get_drivedevice get_drivedevice_iothread scsihw_infos);
 use PVE::QemuServer::Machine;
 use PVE::QemuServer::Memory qw(get_current_memory);
 use PVE::QemuServer::MetaInfo;
@@ -3467,8 +3467,8 @@ sub config_to_command {
 
             $drive->{bootindex} = $bootorder->{$ds} if $bootorder->{$ds};
 
-            my $iothread = print_drivedevice_iothread($conf, $drive);
-            push @$cmd, '-object', $iothread if $iothread;
+            my $iothread = get_drivedevice_iothread($conf, $drive);
+            push @$cmd, '-object', to_json($iothread, { canonical => 1 }) if $iothread;
 
             my $controller = print_drivedevice_controller(
                 $conf, $drive, $scsihw, $arch, $bridges, $used_controller,
@@ -3747,7 +3747,7 @@ sub vm_deviceplug {
         }
     } elsif ($deviceid =~ m/^(virtioscsi|scsihw)(\d+)$/) {
         my $scsihw = defined($conf->{scsihw}) ? $conf->{scsihw} : "lsi";
-        my $iothread = print_drivedevice_iothread($conf, $device);
+        my $iothread = get_drivedevice_iothread($conf, $device);
         my $controller = print_drivedevice_controller($conf, $device, $scsihw, $arch);
 
         qemu_iothread_add($vmid, $deviceid, $device) if $iothread;
diff --git a/src/PVE/QemuServer/DriveDevice.pm b/src/PVE/QemuServer/DriveDevice.pm
index 34ebb335..c19f80d4 100644
--- a/src/PVE/QemuServer/DriveDevice.pm
+++ b/src/PVE/QemuServer/DriveDevice.pm
@@ -15,7 +15,7 @@ use base qw(Exporter);
 our @EXPORT_OK = qw(
     get_drivedevice
     print_drivedevice_controller
-    print_drivedevice_iothread
+    get_drivedevice_iothread
     scsihw_infos
 );
 
@@ -216,13 +216,13 @@ sub print_drivedevice_controller {
     }
 }
 
-sub print_drivedevice_iothread {
+sub get_drivedevice_iothread {
     my ($conf, $drive) = @_;
 
     my $drive_id = PVE::QemuServer::Drive::get_drive_id($drive);
 
     if ($drive->{interface} eq 'virtio') {
-        return "iothread,id=iothread-$drive_id" if $drive->{iothread};
+        return { 'qom-type' => 'iothread', id => "iothread-$drive_id" } if $drive->{iothread};
     }
 
     if ($drive->{interface} eq 'scsi') {
@@ -234,7 +234,7 @@ sub print_drivedevice_iothread {
             && $conf->{scsihw} eq "virtio-scsi-single"
             && $drive->{iothread}
         ) {
-            return "iothread,id=iothread-$controller_prefix$controller";
+            return { 'qom-type' => 'iothread', id => "iothread-$controller_prefix$controller" };
         } elsif ($drive->{iothread}) {
             log_warn(
                 "iothread is only valid with virtio disk or virtio-scsi-single controller, ignoring\n"
-- 
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-07-16 16:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250716163415.1837210-1-alexandre.derumier@groupe-cyllene.com>
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 01/10] introduce DriveDevice module Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 02/10] add print_drivedevice_controller && print_drivedevice_iothread Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 03/10] hotplug: drive controller : use print_drivedevice_iothread && print_drivedevice_controller Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 04/10] pci: add get_pci_addr Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 05/10] qmphelpers: add qmp_deviceadd && qmp_devicedel Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 06/10] convert drive device to json format Alexandre Derumier via pve-devel
2025-07-16 16:34 ` Alexandre Derumier via pve-devel [this message]
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 08/10] convert disk controller " Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 09/10] tests: cfg2cmd: convert drive devices " Alexandre Derumier via pve-devel
2025-07-16 16:34 ` [pve-devel] [PATCH v2 qemu-server 10/10] RFC: add multiple iothreads support Alexandre Derumier via pve-devel

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.81.1752683695.354.pve-devel@lists.proxmox.com \
    --to=pve-devel@lists.proxmox.com \
    --cc=alexandre.derumier@groupe-cyllene.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