From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <pve-devel-bounces@lists.proxmox.com> Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id B5D601FF16B for <inbox@lore.proxmox.com>; Thu, 3 Apr 2025 16:20:02 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 695B63F48; Thu, 3 Apr 2025 16:19:51 +0200 (CEST) From: Dominik Csapak <d.csapak@proxmox.com> To: pve-devel@lists.proxmox.com Date: Thu, 3 Apr 2025 16:19:48 +0200 Message-Id: <20250403141948.4149551-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250311132055.2826686-9-d.csapak@proxmox.com> References: <20250311132055.2826686-9-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.022 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 follow-up qemu-server] api: migrate preconditions: add schema description for 'mapped-resource-info' X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com> List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe> List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/> List-Post: <mailto:pve-devel@lists.proxmox.com> List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help> List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe> Reply-To: Proxmox VE development discussion <pve-devel@lists.proxmox.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com> Since it's an object that has the config-properties as keys (e.g. hostpci0), we have to add all possible values (hostpciX/usbX) to it as optional, like we do for e.g. config GET api calls. The actual info per property is not much currently, just the name of the mapping and for PCI devices if they're marked as live-migratable. Signed-off-by: Dominik Csapak <d.csapak@proxmox.com> --- this is a follow-up for: [PATCH qemu-server v7 6/9] api: enable live migration for marked mapped pci devices https://lore.proxmox.com/pve-devel/20250311132055.2826686-9-d.csapak@proxmox.com/ could also be squashed in on applying if wanted PVE/API2/Qemu.pm | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 459c7e29..a2e200c7 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -4580,6 +4580,46 @@ my $check_vm_disks_local = sub { return $local_disks; }; +sub mapped_resource_info_properties { + my $properties= {}; + + for (my $i = 0; $i < $PVE::QemuServer::PCI::MAX_HOSTPCI_DEVICES; $i++) { + $properties->{"hostpci$i"} = { + type => 'object', + description => "Information about hostpci$i", + optional => 1, + properties => { + name => { + type => 'string', + description => 'The name of the mapping.', + }, + 'live-migration' => { + type => 'boolean', + optional => 1, + default => 0, + description => "True if the mapping is marked as live-migration capable.", + }, + }, + }; + } + + for (my $i = 0; $i < $PVE::QemuServer::USB::MAX_USB_DEVICES; $i++) { + $properties->{"usb$i"} = { + type => 'object', + description => "Information about usb$i", + optional => 1, + properties => { + name => { + type => 'string', + description => 'The name of the mapping.', + }, + }, + }; + } + + return $properties; +} + __PACKAGE__->register_method({ name => 'migrate_vm_precondition', path => '{vmid}/migrate', @@ -4681,6 +4721,7 @@ __PACKAGE__->register_method({ 'mapped-resource-info' => { type => 'object', description => "Object of mapped resources with additional information such if they're live migratable.", + properties => mapped_resource_info_properties(), }, }, }, -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel