From nobody Wed May 1 13:42:14 2024 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 From nobody Wed May 1 13:42:14 2024 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 1533873471904307.7263003244958; Thu, 9 Aug 2018 20:57:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BD22330832F1; Fri, 10 Aug 2018 03:57:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 85DD23001A49; Fri, 10 Aug 2018 03:57:49 +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 3DB7B18037F1; Fri, 10 Aug 2018 03:57:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w7A3vXjo014362 for ; Thu, 9 Aug 2018 23:57:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 07CFA89594; Fri, 10 Aug 2018 03:57:33 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 011F089597 for ; Fri, 10 Aug 2018 03:57:30 +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 2A6383082149 for ; Fri, 10 Aug 2018 03:57:30 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id r21-v6so9020775qtm.2 for ; Thu, 09 Aug 2018 20:57:30 -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.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 20:57:27 -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=d9Cl3qWIRZuFyRhnTvjJr0wT1LF58LVEhWwVFno81GU=; b=ZaLXb3G+kQ+xGQhHLmGUBI7rpjDySFRS4aIYpRPWDUl+c0fyEzmHflD7GaM0HtNWi0 FyEtGGl6X5DoJ2uXuJJJM6fFxqqfeuexLdWdMteMBTYgAg7VQ3RKL0VbS3cnPIV9Bk0v ZSGjB9zJ2GGA3obRLRQS5R2f6YJnxhqmkjQOLjMYVr33JKZT27yeprTbXr3bQzNFiP/v drZ818MFSBy58gbrKAj6GDnfya4Jy3jCutEanQd5aBlMOebBdgKbbgK9lPQ91gsQSM7h EzRGZ/pfciJyW8520BwHRdx1LNfruAm35yMVciNd+JJdHIlZHUb5+gMprstKUcnp//ZB J6XA== 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=d9Cl3qWIRZuFyRhnTvjJr0wT1LF58LVEhWwVFno81GU=; b=fJewN/FH+JVilQqpzP/V9aYIEeL17tfDEBZkDKsVn2kzwuso/je2XKKZodfVP4O6Jn KFo97+Oj4z+GgqTpOIrc8UDV+LBhNTIhARFFj/bgwqyXWAXMOxaVH9MtWs/+zzaYRg1m 9yL1vMdGErZgWbNTCx0lgI7tf0TMnb3wBIacKBQ6rG4JD0k/JvC+0FCLnbhiHE9iJtZV pAubiwgIvLENqwa35zxKhkKiyRRI9ZAz6WO2KcmLm61TfKRLVjXicfSyAPpkTnYpEV/9 LszC6bxcENlj5DtnhHmKoAAlus6hUX2n/JQsDBpi5pFRccZGOLISyMzI6c9n8vz7LVUr m4VQ== X-Gm-Message-State: AOUpUlFU88hBFadYA8p1b/Ey4VOJGT/FuObUPYZZP+IZG8SG4VdtnfR8 aNPuy2sklv4Xv1j75XieDxX9giOm X-Google-Smtp-Source: AA+uWPzjpFOGSiLJl3C/XsX7FjmxRr2suRg5bTlfyYe+5V+9JyPb1jsDkUxfcD6sAd6y3071pbf1ig== X-Received: by 2002:ac8:1970:: with SMTP id g45-v6mr4801627qtk.188.1533873448771; Thu, 09 Aug 2018 20:57:28 -0700 (PDT) From: Marcos Paulo de Souza To: libvir-list@redhat.com Date: Fri, 10 Aug 2018 00:56:58 -0300 Message-Id: <20180810035658.13555-3-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.42]); Fri, 10 Aug 2018 03:57:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 10 Aug 2018 03:57:30 +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.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Marcos Paulo de Souza Subject: [libvirt] [PATCH 2/2] esx:Fix esxDomainGetMaxVcpus to return correct vcpus 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.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 10 Aug 2018 03:57:50 +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 change, esxDomainGetMaxVcpus returned -1, which in turn fails in libvirt. This commit reimplements esxDomainGetMaxVcpus instead of calling esxDomainGetVcpusFlags. The implementation checks for capability.maxSupportedVcpus, but as this one can be ommited in ESXi, we also check for capability.maxHostSupportedVcpus. With this change, virDomainSetVcpus, virDomainGetMaxVcpus and virDomainGetVcpusFlags and returning correct values. Signed-off-by: Marcos Paulo de Souza --- src/esx/esx_driver.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index d5e8a7b4eb..3169314fa4 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2581,8 +2581,40 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned= int flags) static int esxDomainGetMaxVcpus(virDomainPtr domain) { - return esxDomainGetVcpusFlags(domain, (VIR_DOMAIN_AFFECT_LIVE | - VIR_DOMAIN_VCPU_MAXIMUM)); + esxPrivate *priv =3D domain->conn->privateData; + esxVI_String *propertyNameList =3D NULL; + esxVI_ObjectContent *hostSystem =3D NULL; + esxVI_Int *supportedVcpus =3D NULL; + esxVI_Int *hostVcpus =3D NULL; + + if (esxVI_EnsureSession(priv->primary) < 0) + return -1; + + priv->maxVcpus =3D -1; + + if (esxVI_String_AppendValueToList(&propertyNameList, + "capability.maxHostSupportedVcp= us\0" + "capability.maxSupportedVcpus" + ) < 0 || + esxVI_LookupHostSystemProperties(priv->primary, propertyNameList, + &hostSystem) < 0 || + esxVI_GetInt(hostSystem, "capability.maxHostSupportedVcpus", + &hostVcpus, esxVI_Occurrence_RequiredItem) < 0 || + esxVI_GetInt(hostSystem, "capability.maxSupportedVcpus", + &supportedVcpus, esxVI_Occurrence_OptionalItem) < 0) + + goto cleanup; + + /* as maxSupportedVcpus is optional, check also for maxHostSupportedVc= pus */ + priv->maxVcpus =3D supportedVcpus ? supportedVcpus->value : hostVcpus-= >value; + + cleanup: + esxVI_String_Free(&propertyNameList); + esxVI_ObjectContent_Free(&hostSystem); + esxVI_Int_Free(&supportedVcpus); + esxVI_Int_Free(&hostVcpus); + + return priv->maxVcpus; } =20 =20 --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list