From 459c7533cce3bf8ec24f990cf693481a50eb57f5 Mon Sep 17 00:00:00 2001 From: Shmuel Melamud Date: Thu, 3 Nov 2022 04:47:02 +0200 Subject: [PATCH] virt: Accept None returned by guest agent for vCPU count If guest agent returns None for vCPU count, TypeError is raised. This patch adds correct handling of this situation. Bug-Url: https://bugzilla.redhat.com/2120381 Signed-off-by: Shmuel Melamud --- lib/vdsm/virt/qemuguestagent.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/vdsm/virt/qemuguestagent.py b/lib/vdsm/virt/qemuguestagent.py index 90da7f83e4..f96aca98f2 100644 --- a/lib/vdsm/virt/qemuguestagent.py +++ b/lib/vdsm/virt/qemuguestagent.py @@ -794,6 +794,9 @@ def _qga_call_get_vcpus(self, vm): 'Not querying QEMU-GA for guest CPU info because domain' 'is not running for vm-id=%s', vm.id) return {} + if vcpus is None: + self.log.info('Guest CPU count was not returned for vm=%s', vm.id) + return {} if 'online' in vcpus: count = len(taskset.cpulist_parse(vcpus['online'])) else: