From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with UTF8SMTPS id 071427483C for ; Tue, 22 Jun 2021 09:07:24 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with UTF8SMTP id EF91B22EE9 for ; Tue, 22 Jun 2021 09:07:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with UTF8SMTPS id 6CFE122EDB for ; Tue, 22 Jun 2021 09:07:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with UTF8SMTP id 3A5F24301D for ; Tue, 22 Jun 2021 09:07:17 +0200 (CEST) Message-ID: <5bfe8d10-e580-754a-324f-4388115bcf2b@proxmox.com> Date: Tue, 22 Jun 2021 09:07:16 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:90.0) Gecko/20100101 Thunderbird/90.0 Content-Language: en-US From: Dominik Csapak To: pve-devel@lists.proxmox.com Reply-To: Proxmox VE development discussion References: <20210621135534.14807-1-d.csapak@proxmox.com> In-Reply-To: <20210621135534.14807-1-d.csapak@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.787 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemuserver.pm, qemu.pm] Subject: Re: [pve-devel] [PATCH/RFC cluster/common/... many] add cluster-wide hardware device mapping 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: , X-List-Received-Date: Tue, 22 Jun 2021 07:07:24 -0000 i just noticed, it seems i forgot to add some hunks/stashes? usb does not work properly there is one qemu patch missing and two would have to be adapted i can send a v2 for the whole series, only for qemu-server or only for the patches, depending on what is preferred the whole diff is rather small: ----8<---- diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 063b356..bb911b9 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -1346,7 +1346,7 @@ my $update_vm_api = sub { PVE::QemuConfig->add_to_pending_delete($conf, $opt, $force); PVE::QemuConfig->write_config($vmid, $conf); } elsif ($opt =~ m/^usb\d+$/) { - my $device = PVE::JSONSchema::parse_property_string('pve-qm-usb-device', $val); + my $device = PVE::JSONSchema::parse_property_string('pve-qm-usb', $val); my $host = parse_usb_device($device->{host}); if ($host->{spice}) { $rpcenv->check_vm_perm($authuser, $vmid, undef, ['VM.Config.HWType']); @@ -1404,7 +1404,7 @@ my $update_vm_api = sub { my $olddevice; my $oldhost; if (defined($conf->{$opt})) { - $olddevice = PVE::JSONSchema::parse_property_string('pve-qm-usb-device', $conf->{$opt}); + $olddevice = PVE::JSONSchema::parse_property_string('pve-qm-usb', $conf->{$opt}); $oldhost = parse_usb_device($olddevice->{host}); } if (defined($oldhost)) { @@ -1418,7 +1418,7 @@ my $update_vm_api = sub { } } - my $newdevice = PVE::JSONSchema::parse_property_string('pve-qm-usb-device', $param->{$opt}); + my $newdevice = PVE::JSONSchema::parse_property_string('pve-qm-usb', $param->{$opt}); my $newhost = parse_usb_device($newdevice->{host}); if ($newhost->{spice}) { diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 5edcb6a..ea824a1 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -1030,6 +1030,8 @@ EODESCR }, }; +PVE::JSONSchema::register_format('pve-qm-usb', $usb_fmt); + my $usbdesc = { optional => 1, type => 'string', format => $usb_fmt, @@ -2438,9 +2440,10 @@ sub check_local_resources { foreach my $k (keys %$conf) { if ($k =~ m/^usb/) { my $entry = parse_property_string($usb_fmt, $conf->{$k}); - next if $entry->{spice}; - if (my $id = $entry->{mapped}) { - $add_not_allowed_nodes->($k, $id); + my $host = parse_usb_device($entry->{host}); + next if $host->{spice}; + if ($host->{mapped}) { + $add_not_allowed_nodes->($k, $entry->{host}); push @$mapped_res, $k; next; } ---->8----