public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Daniel Kral <d.kral@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH esxi-import-tools 1/2] listvms: add check for vCLS test whether vm configuration is present
Date: Fri, 11 Apr 2025 17:06:33 +0200	[thread overview]
Message-ID: <20250411150634.253684-1-d.kral@proxmox.com> (raw)

It seems that on older ESXi installations, e.g. ESXi 6.7 [0], there are
virtual machines, which do not expose a config property for some VMs.
Therefore, test whether the config is available before checking if the
current entry is a vCLS VM.

[0] https://forum.proxmox.com/threads/164900/

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
 listvms.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/listvms.py b/listvms.py
index 89ddfb2..bd0adcf 100755
--- a/listvms.py
+++ b/listvms.py
@@ -266,9 +266,11 @@ def main():
         data = {}
         for vm in list_vms(connection):
             # drop vCLS machines
-            vCLS = any(cfg.key == "HDCS.agent"
-                       and cfg.value.lower() == "true"
-                       for cfg in vm.config.extraConfig)
+            vCLS = vm.config is not None and any(
+                cfg.key == "HDCS.agent"
+                and cfg.value.lower() == "true"
+                for cfg in vm.config.extraConfig
+            )
             if vCLS:
                 continue
             # drop vms with empty datastore

base-commit: e6f497ea7668e6956ec4461837cf613a0736e684
-- 
2.39.5



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


             reply	other threads:[~2025-04-11 15:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-11 15:06 Daniel Kral [this message]
2025-04-11 15:06 ` [pve-devel] [RFC esxi-import-tools 2/2] listvms: add message when skipping vCLS agent VMs Daniel Kral
2025-04-11 15:45   ` Max Carrara
2025-04-24 17:33 ` [pve-devel] applied: [PATCH esxi-import-tools 1/2] listvms: add check for vCLS test whether vm configuration is present Thomas Lamprecht
2025-04-25  7:38   ` Daniel Kral

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250411150634.253684-1-d.kral@proxmox.com \
    --to=d.kral@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal