From nobody Mon Feb 9 00:20:33 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1533873454162226.0716887356092; Thu, 9 Aug 2018 20:57:34 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6100C3082A42; Fri, 10 Aug 2018 03:57:31 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2CA7B2010CFC; Fri, 10 Aug 2018 03:57:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C856B4A460; Fri, 10 Aug 2018 03:57:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7A3vTZp014349 for ; Thu, 9 Aug 2018 23:57:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id AD36D6EE24; Fri, 10 Aug 2018 03:57:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A396660BE4 for ; Fri, 10 Aug 2018 03:57:27 +0000 (UTC) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 50E9A3086247 for ; Fri, 10 Aug 2018 03:57:26 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id m13-v6so9016248qth.1 for ; Thu, 09 Aug 2018 20:57:26 -0700 (PDT) Received: from bebop.8.8.8.8 ([2804:7f5:d180:ef89:14c6:9c2a:98f0:1dbe]) by smtp.gmail.com with ESMTPSA id r67-v6sm4951300qkd.10.2018.08.09.20.57.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 20:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gZd558uRdCv4jwrO6rigWch3e+AUU6CLit62skV4o7E=; b=uB7II8vA6CEWLucB4IHBCGSkfXbnsw7dzxWRShwyxh0CzOipJPH92LOcnY1umwyPRU 1Xmb5f+C7mHcIui1JGhzWdXCPR6YYhTj3rS8X/klAOV/0rr5MbsRN3FdXxgux8+Gz0nA /u9QNIMKFXVIETH4T+nGBYd0C4EOfPw62PvWPRXD9Pt4t4/PpKDcni+py1qRh7ekAIjL pfjuuHCyky+naTT2GwbWvRVOEgAEtp4qqCtLgNSADUxSj+F+o7gOLiS1iFHLbKS0Ev8b eKIEae8+JqRN+e85AkhZJ5slr23KbMvDchf9+QSClQyFnT2krIcvK3nZw3ooO8Gj7ZKh Unqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gZd558uRdCv4jwrO6rigWch3e+AUU6CLit62skV4o7E=; b=JP6I05NNZHNicRHCCbpo+35FZIFVPoTUyRO5ohmVQ9D0+gVmzkS6YRIYqkHOMtpoGW Z0CeFmR3KHUl3Ig5BkJ6O5zKh2dDgSSFREpSHGkIMUG2KJuzXw0UCWm+K8MQDF6O/qio JQwO3aKRqpWPgvNACKx6kFpStpzAtkVInTtAUB50x9NPS32LGADepig9V73WOIRWhbqx ssKR2n0eOupUnwLZdtDzAJc6FKDou83uicwREc+TqlfA2MK/7ezpDYOY2xwORTKLsVm7 c930O7q1Nmu42PFiZ2XBu6Xp55y78ad7rUCb5lOXWpKB66eQ3tssyCHaMJoQ75hrhtV5 8Obg== X-Gm-Message-State: AOUpUlHp98j2WKERl/c++IWmp3ta0DOj9UhEmL63YHxUUz77Fame2iaF b17PyY0PT955UfBKkAYweqFn138x X-Google-Smtp-Source: AA+uWPxCXye247GoY9KciyBQgyJ5NHWNq4q5yFrrIGDbJDzqmrF6GkNGve9Rqc2ZKf7FhaOI3HuZqw== X-Received: by 2002:a0c:b458:: with SMTP id e24-v6mr4367090qvf.82.1533873444900; Thu, 09 Aug 2018 20:57:24 -0700 (PDT) From: Marcos Paulo de Souza To: libvir-list@redhat.com Date: Fri, 10 Aug 2018 00:56:57 -0300 Message-Id: <20180810035658.13555-2-marcos.souza.org@gmail.com> In-Reply-To: <20180810035658.13555-1-marcos.souza.org@gmail.com> References: <20180810035658.13555-1-marcos.souza.org@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 10 Aug 2018 03:57:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 10 Aug 2018 03:57:26 +0000 (UTC) for IP:'209.85.216.193' DOMAIN:'mail-qt0-f193.google.com' HELO:'mail-qt0-f193.google.com' FROM:'marcos.souza.org@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.13 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.193 mail-qt0-f193.google.com 209.85.216.193 mail-qt0-f193.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Marcos Paulo de Souza Subject: [libvirt] [PATCH 1/2] esx: Make esxDomainGetVcpusFlags return vcpus again X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 10 Aug 2018 03:57:32 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Before this patch, esxDomainGetVcpusFlags was returning -1 since "maxSupportedVcpus" can be NULL in ESXi[1]. In order to make it work, replicate the same behavior than esxDomainGetInfo that used config.hardware.numCPU to return the correct number of vcpus of a VM. This patch, together with the next one, makes the calls virDomainSetVcpus, virDomainGetMaxVcpus and virDomainGetVcpusFlags to return successfull again. [1]:https://pubs.vmware.com/vi-sdk/visdk250/ReferenceGuide/vim.host.Capabil= ity.html Signed-off-by: Marcos Paulo de Souza --- src/esx/esx_driver.c | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index c2154799fa..d5e8a7b4eb 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2547,45 +2547,31 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigne= d int flags) { esxPrivate *priv =3D domain->conn->privateData; esxVI_String *propertyNameList =3D NULL; - esxVI_ObjectContent *hostSystem =3D NULL; - esxVI_DynamicProperty *dynamicProperty =3D NULL; + esxVI_ObjectContent *virtualMachine =3D NULL; + esxVI_Int *vcpus =3D NULL; =20 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_VCPU_MAXIMUM, -1); =20 - if (priv->maxVcpus > 0) - return priv->maxVcpus; - priv->maxVcpus =3D -1; =20 if (esxVI_EnsureSession(priv->primary) < 0) return -1; =20 if (esxVI_String_AppendValueToList(&propertyNameList, - "capability.maxSupportedVcpus") < 0= || - esxVI_LookupHostSystemProperties(priv->primary, propertyNameList, - &hostSystem) < 0) { + "config.hardware.numCPU\0") < 0= || + esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid, + propertyNameList, &virtualMachine, + esxVI_Occurrence_RequiredItem) < = 0 || + esxVI_GetInt(virtualMachine, "config.hardware.numCPU", + &vcpus, esxVI_Occurrence_RequiredItem) < 0) goto cleanup; - } - - for (dynamicProperty =3D hostSystem->propSet; dynamicProperty; - dynamicProperty =3D dynamicProperty->_next) { - if (STREQ(dynamicProperty->name, "capability.maxSupportedVcpus")) { - if (esxVI_AnyType_ExpectType(dynamicProperty->val, - esxVI_Type_Int) < 0) { - goto cleanup; - } - - priv->maxVcpus =3D dynamicProperty->val->int32; - break; - } else { - VIR_WARN("Unexpected '%s' property", dynamicProperty->name); - } - } =20 + priv->maxVcpus =3D vcpus->value; cleanup: esxVI_String_Free(&propertyNameList); - esxVI_ObjectContent_Free(&hostSystem); + esxVI_ObjectContent_Free(&virtualMachine); + esxVI_Int_Free(&vcpus); =20 return priv->maxVcpus; } --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list