From nobody Mon Feb 9 00:31:09 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 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