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 D3E841FF172
	for <inbox@lore.proxmox.com>; Wed, 23 Apr 2025 16:46:16 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
	by firstgate.proxmox.com (Proxmox) with ESMTP id 4EC1D1D9C1;
	Wed, 23 Apr 2025 16:46:12 +0200 (CEST)
Message-ID: <cb8be5b8-a469-4a12-9a61-851608060dbf@proxmox.com>
Date: Wed, 23 Apr 2025 16:45:37 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Daniel Herzig <d.herzig@proxmox.com>
References: <20250423130315.360403-1-d.herzig@proxmox.com>
 <ed50bdc3-d508-42e4-b3ed-47848eab4e5a@proxmox.com>
 <87wmbbrn2k.fsf@proxmox.com>
Content-Language: en-US
From: Daniel Kral <d.kral@proxmox.com>
In-Reply-To: <87wmbbrn2k.fsf@proxmox.com>
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.013 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
 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to
 Validity was blocked. See
 https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more
 information.
 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. [proxmox.com, listvms.py]
Subject: Re: [pve-devel] [PATCH pve-esxi-import-tools] fix #6347: do not
 break vm listing on invalid configs
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>
Cc: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: pve-devel-bounces@lists.proxmox.com
Sender: "pve-devel" <pve-devel-bounces@lists.proxmox.com>

On 4/23/25 16:04, Daniel Herzig wrote:
> Daniel Kral <d.kral@proxmox.com> writes:
> 
>> On 4/23/25 15:03, Daniel Herzig wrote:
>>> Move the queries for vCLS machines and empty datastore strings into
>>> the already existing try-except routine to save `listvms.py` from
>>> breaking when `vm.config` is `None`.
>>> Do not store the result of the `any` function in a variable anymore,
>>> do the same for the datastore query to shorten code.
>>> Prepare more verbose logging.
>>> Signed-off-by: Daniel Herzig <d.herzig@proxmox.com>
>>
>> Oops, I should have prefixed my patch with a "fix" at least, but I've
>> sent two patches some days ago for this ;):
>>
>> https://lore.proxmox.com/pve-devel/20250411150634.253684-1-d.kral@proxmox.com/T/#u
>>
> Ha, I missed that one, you were too quick ;)
> 
> It turned out that the problem was on the specific ESXI-side config
> (`vm.config` is there on ESXI-6.7.x as well, without it we could not do
> anything anyway -- `fetch_and_update_vm_data` calls it more than
> once inherently). But it's `None` for sure if there's an invalid vm config on the ESXI side.

Thanks for the info!

I was wondering why it didn't work for them (in the forum) and have only 
figured that there was something undocumented in the PyVim API about 
when the OptionType is None, but with either patch it should be fine now :).

> 
> OP on bugzilla reported that once these invalid VMs were removed from
> ESXI, 'standard 0.7.3' started working as expected.
> 
> But for the earlier vCLS commit I totally missed that
> possibility (shame on me) and placed the queries 'unprotected' (unlike
> `fetch_and_update_vm_data`).
> 
>> But it's also good to just extend the scope of the try-catch here
>> without the additional check for whether the vm.config has a value or
>> not.



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel