From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id B37E41FF38C for ; Fri, 31 May 2024 15:05:13 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0F51635986; Fri, 31 May 2024 15:05:37 +0200 (CEST) Message-ID: <40b2cdde-6ef9-490d-92a5-2b7b97c97585@proxmox.com> Date: Fri, 31 May 2024 15:05:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox VE development discussion , Dominik Csapak References: <20240419124556.3334691-1-d.csapak@proxmox.com> <20240419124556.3334691-13-d.csapak@proxmox.com> Content-Language: en-US From: Fiona Ebner In-Reply-To: <20240419124556.3334691-13-d.csapak@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL -0.059 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 T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [qemumigrate.pm, qemu.pm, qemuserver.pm] Subject: Re: [pve-devel] [PATCH qemu-server v3 08/10] check_local_resources: add more info per mapped device and return as hash 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Am 19.04.24 um 14:45 schrieb Dominik Csapak: > such as the mapping name and if it's marked for live-migration (pci only) > > Signed-off-by: Dominik Csapak > --- > PVE/API2/Qemu.pm | 2 +- > PVE/QemuMigrate.pm | 7 ++++--- > PVE/QemuServer.pm | 17 ++++++++++------- > 3 files changed, 15 insertions(+), 11 deletions(-) > > diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm > index 2a349c8c..f2fa345d 100644 > --- a/PVE/API2/Qemu.pm > +++ b/PVE/API2/Qemu.pm > @@ -4538,7 +4538,7 @@ __PACKAGE__->register_method({ > $res->{local_disks} = [ values %$local_disks ];; > > $res->{local_resources} = $local_resources; > - $res->{'mapped-resources'} = $mapped_resources; > + $res->{'mapped-resources'} = [ keys $mapped_resources->%* ]; Sorting the keys leads to a nicer API result IMHO. > > return $res; > > diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm > index 381022f5..a46eb2a3 100644 > --- a/PVE/QemuMigrate.pm > +++ b/PVE/QemuMigrate.pm > @@ -233,7 +233,7 @@ sub prepare { > my ($loc_res, $mapped_res, $missing_mappings_by_node) = PVE::QemuServer::check_local_resources($conf, 1); > my $blocking_resources = []; > for my $res ($loc_res->@*) { > - if (!grep($res, $mapped_res->@*)) { > + if (!defined($mapped_res->{$res})) { > push $blocking_resources->@*, $res; > } > } > @@ -245,10 +245,11 @@ sub prepare { > } > } > > - if (scalar($mapped_res->@*)) { > + if (scalar(keys $mapped_res->%*)) { > my $missing_mappings = $missing_mappings_by_node->{$self->{node}}; > + my $mapped_text = join(", ", keys $mapped_res->%*); Nit: Can be moved into the if, keys can be sorted. > if ($running) { > - die "can't migrate running VM which uses mapped devices: " . join(", ", $mapped_res->@*) . "\n"; > + die "can't migrate running VM which uses mapped devices: $mapped_text\n"; > } elsif (scalar($missing_mappings->@*)) { > die "can't migrate to '$self->{node}': missing mapped devices " . join(", ", $missing_mappings->@*) . "\n"; > } else { _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel