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 ESMTPS id F1033BB121 for ; Fri, 22 Mar 2024 15:54:16 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D856083AF for ; Fri, 22 Mar 2024 15:53:46 +0100 (CET) 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 ESMTPS for ; Fri, 22 Mar 2024 15:53:46 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id E1A6141A52 for ; Fri, 22 Mar 2024 15:53:45 +0100 (CET) Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 22 Mar 2024 15:53:45 +0100 Message-Id: To: "Proxmox VE development discussion" From: "Stefan Sterz" X-Mailer: aerc 0.17.0-69-g65571b67d7d3-dirty References: <20240320125158.2094900-1-d.csapak@proxmox.com> <20240320125158.2094900-4-d.csapak@proxmox.com> In-Reply-To: <20240320125158.2094900-4-d.csapak@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.076 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemu.pm] Subject: Re: [pve-devel] [PATCH qemu-server 3/3] api: include not mapped resources for running vms in migrate preconditions 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: Fri, 22 Mar 2024 14:54:17 -0000 On Wed Mar 20, 2024 at 1:51 PM CET, Dominik Csapak wrote: > so that we can show a proper warning in the migrate dialog and check it > in the bulk migrate precondition check > > the unavailable_storages and allowed_nodes should be the same as before > > Signed-off-by: Dominik Csapak > --- > not super happy with this partial approach, we probably should just > always return the 'allowed_nodes' and 'not_allowed_nodes' and change > the gui to handle the running vs not running state? > > PVE/API2/Qemu.pm | 27 +++++++++++++++------------ > 1 file changed, 15 insertions(+), 12 deletions(-) > > diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm > index 8581a529..b0f155f7 100644 > --- a/PVE/API2/Qemu.pm > +++ b/PVE/API2/Qemu.pm > @@ -4439,7 +4439,7 @@ __PACKAGE__->register_method({ > not_allowed_nodes =3D> { > type =3D> 'object', > optional =3D> 1, > - description =3D> "List not allowed nodes with additional informations,= only passed if VM is offline" > + description =3D> "List not allowed nodes with additional informations"= , "information" has no plural, this should just be "additional information". > }, > local_disks =3D> { > type =3D> 'array', > @@ -4496,25 +4496,28 @@ __PACKAGE__->register_method({ > > # if vm is not running, return target nodes where local storage/mapped = devices are available > # for offline migration > + my $checked_nodes =3D {}; > + my $allowed_nodes =3D []; > if (!$res->{running}) { > - $res->{allowed_nodes} =3D []; > - my $checked_nodes =3D PVE::QemuServer::check_local_storage_availabi= lity($vmconf, $storecfg); > + $checked_nodes =3D PVE::QemuServer::check_local_storage_availabilit= y($vmconf, $storecfg); > delete $checked_nodes->{$localnode}; > + } > > - foreach my $node (keys %$checked_nodes) { > - my $missing_mappings =3D $missing_mappings_by_node->{$node}; > - if (scalar($missing_mappings->@*)) { > - $checked_nodes->{$node}->{'unavailable-resources'} =3D $missing_ma= ppings; > - next; > - } > + foreach my $node ((keys $checked_nodes->%*, keys $missing_mappings_by_n= ode->%*)) { > + my $missing_mappings =3D $missing_mappings_by_node->{$node}; > + if (scalar($missing_mappings->@*)) { > + $checked_nodes->{$node}->{'unavailable-resources'} =3D $missing_mappin= gs; > + next; > + } > > + if (!$res->{running}) { > if (!defined($checked_nodes->{$node}->{unavailable_storages})) { > - push @{$res->{allowed_nodes}}, $node; > + push $allowed_nodes->@*, $node; > } > - > } > - $res->{not_allowed_nodes} =3D $checked_nodes; > } > + $res->{not_allowed_nodes} =3D $checked_nodes if scalar(keys($checked_no= des->%*)) || !$res->{running}; > + $res->{allowed_nodes} =3D $allowed_nodes if scalar($allowed_nodes->@*) = || !$res->{running}; > > my $local_disks =3D &$check_vm_disks_local($storecfg, $vmconf, $vmid); > $res->{local_disks} =3D [ values %$local_disks ];;