From nobody Sat Apr 27 23:02:10 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 153432577458466.15919880901401; Wed, 15 Aug 2018 02:36:14 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C4C23082A3A; Wed, 15 Aug 2018 09:36:12 +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 266995D6B4; Wed, 15 Aug 2018 09:36:12 +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 BEECE18037ED; Wed, 15 Aug 2018 09:36:11 +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 w7F9aAkW022238 for ; Wed, 15 Aug 2018 05:36:10 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7E23C5D9D1; Wed, 15 Aug 2018 09:36:10 +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 74E885D9C6 for ; Wed, 15 Aug 2018 09:36:08 +0000 (UTC) Received: from mail-qt0-f174.google.com (mail-qt0-f174.google.com [209.85.216.174]) (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 267A33086263 for ; Wed, 15 Aug 2018 09:36:07 +0000 (UTC) Received: by mail-qt0-f174.google.com with SMTP id c15-v6so541015qtp.0 for ; Wed, 15 Aug 2018 02:36:07 -0700 (PDT) Received: from bebop.8.8.8.8 ([2804:7f5:d180:f2dd:188a:ba78:3f19:7e35]) by smtp.gmail.com with ESMTPSA id z3-v6sm13261113qkc.55.2018.08.15.02.36.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 15 Aug 2018 02:36:04 -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=OU1HFSLsKmf5RIF21jvnEek4NajBA7aAv3B8sdqSCJc=; b=sXUw+YUBZTokWjLgYy/FoRLJMQw/Nz4cdY6+iTVwxHyPXPEH0VYNBVdVbW389eGNNj XDSvZR0byWV03HzP0ikbkY9oS8hc8iljwzbp59pG5z/Pj01aE4AnW/oWqVP3N+8Es0vk uJVF/uB47hoQbxWmZY/YTsGkmWhG/8/5iIXr56GsZ0loywfjg21iXfzxJIaFAqG1oGqO igWIuv7OoBaougSqCBeL1DMgDt33tXPPwHJ8zO1jidehlpeOBkGgsubwahfrM+3oIy+j JtUtQx7pkuDDRv8fxmXOZ+Liy7E08XnQA9gGQuSLTXluaGsox9bLefp9vmOAhFWTmCYn j0Kw== 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=OU1HFSLsKmf5RIF21jvnEek4NajBA7aAv3B8sdqSCJc=; b=oCIQabg08s2Np8VCvX6Ce4J3F20lN0EUHbbInF+btLgeUEbpyqfvoqZ8A75bcx27a/ fqL+gz/G3gJZm8VCvLkaGV+Lxsk3irJ54o81Zsy3gsW3X1ESQQ68gQsBaqBuhyJTu7zr R0w/IP4/0yb7qdA+R45GuW6D0EReOipBFkWfD7ARTFkUVxc2Vi/FAJd7mrqIU/nr0dD7 1tpNONy1DhXCWgHaxejVGOOZTwWREiCGzGqyeiNMBNSa2s281zGu6UPdNwSLfhOIxIKB S+dj3e9HkGkUd2YxYkgXY733gW5cZrjKKe1nzMi4am/HPcb1HF4TTROJboVZxVm3qMJ2 1Prw== X-Gm-Message-State: AOUpUlE0fSJOnzEiTNm7Yn8EcTcSPYscnNiVmXNf2QORuZ0PBh+vptn3 AEYKlxD+6CJqwnN1H9HcasFfInOY X-Google-Smtp-Source: AA+uWPySCKCOt/PAuFCWWxHfCgRNc8xH7rn+fMRCAMCRnTOX6JfjWCc4auJW/GyVPNxsGIV0WGShIw== X-Received: by 2002:a0c:f90e:: with SMTP id v14-v6mr21691976qvn.207.1534325765912; Wed, 15 Aug 2018 02:36:05 -0700 (PDT) From: Marcos Paulo de Souza To: libvir-list@redhat.com Date: Wed, 15 Aug 2018 06:35:48 -0300 Message-Id: <20180815093548.2126-2-marcos.souza.org@gmail.com> In-Reply-To: <20180815093548.2126-1-marcos.souza.org@gmail.com> References: <20180815093548.2126-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]); Wed, 15 Aug 2018 09:36:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 15 Aug 2018 09:36:07 +0000 (UTC) for IP:'209.85.216.174' DOMAIN:'mail-qt0-f174.google.com' HELO:'mail-qt0-f174.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.174 mail-qt0-f174.google.com 209.85.216.174 mail-qt0-f174.google.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 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 -v2 1/1] esx: Make esxDomainGetVcpusFlags check flags 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.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 15 Aug 2018 09:36:13 +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 not checking the flags argument. Current, get and set vcpus was failing in ESX since it was checking for "maxSupportedVcpus", and this configuration can be ommited by ESXi[1]. Now, if VIR_DOMAIN_VCPU_MAXIMUM is specified in flags argument esxDomainGetVcpusFlags the maximum number of vcpus allowed for that VM. Otherwise, the current number of vcpus is returned. With this patch calls to 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 --- Changes from v1: * Now we only have one patch instead of two * Change esxDomainGetVcpusFlags in order to check the flags argument, inst= ead * of changing esxDomainGetMaxVcpus. src/esx/esx_driver.c | 52 ++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index c2154799fa..a1ba889326 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -2547,45 +2547,49 @@ 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 *obj =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) { - goto cleanup; - } =20 - 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; - } + if (flags & VIR_DOMAIN_VCPU_MAXIMUM) { + if (esxVI_String_AppendValueToList(&propertyNameList, + "capability.maxHostSupportedVcp= us\0" + "capability.maxSupportedVcpus")= < 0 || + esxVI_LookupHostSystemProperties(priv->primary, + propertyNameList, &obj) < 0 || + esxVI_GetInt(obj, "capability.maxSupportedVcpus", &vcpus, + esxVI_Occurrence_OptionalItem) < 0) + goto cleanup; =20 - priv->maxVcpus =3D dynamicProperty->val->int32; - break; - } else { - VIR_WARN("Unexpected '%s' property", dynamicProperty->name); - } + if (!vcpus && esxVI_GetInt(obj, "capability.maxHostSupportedVcpus", + &vcpus, esxVI_Occurrence_RequiredItem) = < 0) + goto cleanup; + + } else { + if (esxVI_String_AppendValueToList(&propertyNameList, + "config.hardware.numCPU\0") < 0 = || + esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid, + propertyNameList, &obj, + esxVI_Occurrence_RequiredItem= ) < 0 || + esxVI_GetInt(obj, "config.hardware.numCPU", &vcpus, + esxVI_Occurrence_RequiredItem) < 0) + goto cleanup; } =20 + priv->maxVcpus =3D vcpus->value; + cleanup: esxVI_String_Free(&propertyNameList); - esxVI_ObjectContent_Free(&hostSystem); + esxVI_ObjectContent_Free(&obj); + 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