From 44da74c5ce58bee335573d4c0f768d2785fb6c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 15 May 2024 12:10:09 +0200 Subject: [PATCH] remote migration: enable schema validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit by wrapping the properties from the command definition to get an actual schema definition. Signed-off-by: Fabian Grünbichler --- PVE/API2/Qemu.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 2a349c8c..2a1d4d79 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -6006,8 +6006,12 @@ __PACKAGE__->register_method({ } elsif (my $handler = $cmd_handlers->{$cmd}) { print "received command '$cmd'\n"; eval { - if ($cmd_desc->{$cmd}) { - PVE::JSONSchema::validate($parsed, $cmd_desc->{$cmd}); + if (my $props = $cmd_desc->{$cmd}) { + my $schema = { + type => 'object', + properties => $props, + }; + PVE::JSONSchema::validate($parsed, $schema); } else { $parsed = {}; }