From nobody Wed May 1 02:40:03 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.zoho.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; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1491922982203373.457857081052; Tue, 11 Apr 2017 08:03:02 -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 E0A727D0D6; Tue, 11 Apr 2017 15:02:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 156A952FC4; Tue, 11 Apr 2017 15:02:58 +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 A1E595EC66; Tue, 11 Apr 2017 15:02:54 +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 v3BF2rQV026275 for ; Tue, 11 Apr 2017 11:02:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 95C647ED9B; Tue, 11 Apr 2017 15:02:53 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8CA4A7EDAB for ; Tue, 11 Apr 2017 15:02:41 +0000 (UTC) Received: from mail-qt0-f175.google.com (mail-qt0-f175.google.com [209.85.216.175]) (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 5237519D05F for ; Tue, 11 Apr 2017 15:02:39 +0000 (UTC) Received: by mail-qt0-f175.google.com with SMTP id m36so30518173qtb.0 for ; Tue, 11 Apr 2017 08:02:39 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id r60sm11159717qtd.53.2017.04.11.08.02.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Apr 2017 08:02:37 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E0A727D0D6 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E0A727D0D6 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=datto-com.20150623.gappssmtp.com header.i=@datto-com.20150623.gappssmtp.com header.b="PLhUerov" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5237519D05F Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5237519D05F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datto-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=TPiW+1zULaeHGLf2pIjkiST/nSEYiT7knAKW/U3CuRE=; b=PLhUerov7n2EeL26V65In9Pj2IKE7yH2AGxOQ4STj1bvq8xmMCxOxhASfYQ86OcFMv L2KX0GkxHKjIzKyTNkuVgRMIB8TkFANBTEieIneofA68VHDL96GDFQDoto8ioeDvaU61 P2SHe12Eonudu60DoWb/BrCBBr++XZeyQ2WqOSaPlwA1ABpKoUFE05NFfYrdYdfJ92a9 Zm6OWisSbs4+rS+SyzhfrmB/r4V2818BBcPHV09hrMnLiq0rFjBmfhLMYaSkbRULS9mN dVB8rsMbtgp5/kttlOcs+bQeLKO27SZbhVQ3QDIiw+vLIJFBp2AmARI4RfCm2/uxLWNg W7YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=TPiW+1zULaeHGLf2pIjkiST/nSEYiT7knAKW/U3CuRE=; b=ZTiyPbPHAJoFQTPkB5PkouZmP8LRxvNrrzPpO1PfCkdUwEjwz3tv1wSa1T3bxc1Zza 1FOspKydtaCcvkaMf8sg+6NRg+fX3ljScU3miVrPXOQKTCLvTYlfqYFfCqb0FLJp8UN0 N0UJfiIYuQL/nkA38ZNWxb+RlnGJ5msjQqxcOve1ocSumSn431LrNsF2dkLWcZBY+ma0 3Gs5MlKhvbBCJG5D/kMyD/OT+PoUH+Wg+yQpnMd19p14u3CW9qXyrLIa2b8RlnxpHJJV /WWDJYcsEtTf/XqRVny7AsLPNfb9MUdgkPomwxxGhKgEzcvnRTM5dVfX6RVfaXzv4/bs Nomg== X-Gm-Message-State: AN3rC/5+pJFQlLTmxLLr8Fzf++YscurVuPMyCj+Aja6DzCmVDxHjmKFMpieGx0ZCH0sCt5ud X-Received: by 10.237.59.157 with SMTP id r29mr10569969qte.142.1491922958156; Tue, 11 Apr 2017 08:02:38 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Tue, 11 Apr 2017 11:02:36 -0400 Message-Id: <20170411150236.2746-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 11 Apr 2017 15:02:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 11 Apr 2017 15:02:39 +0000 (UTC) for IP:'209.85.216.175' DOMAIN:'mail-qt0-f175.google.com' HELO:'mail-qt0-f175.google.com' FROM:'dzamirski@datto.com' RCPT:'' X-RedHat-Spam-Score: 0.869 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.216.175 mail-qt0-f175.google.com 209.85.216.175 mail-qt0-f175.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] hyperv: recognize array property as distinct type. 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.26]); Tue, 11 Apr 2017 15:03:01 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When hyperv code generator for WMI classes identifies common properties, it needs to take into account array type as a distinct type, i.e string !=3D string[]. This is the case where v1 of the Msvm_VirtualSystemSettingData has Notes property as string whereas v2 uses Notes[], therefore they have to be treated as different fields and cannot be placed in the "common" struct. --- src/hyperv/hyperv_driver.c | 26 ++++++++++++++++++++++++-- src/hyperv/hyperv_wmi_generator.py | 2 +- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 090ea24..5a27908 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -894,8 +894,30 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned i= nt flags) if (VIR_STRDUP(def->name, computerSystem->data.common->ElementName) < = 0) goto cleanup; =20 - if (VIR_STRDUP(def->description, virtualSystemSettingData->data.common= ->Notes) < 0) - goto cleanup; + if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V1) { + if (VIR_STRDUP(def->description, + virtualSystemSettingData->data.v1->Notes) < 0) + goto cleanup; + } else if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V2 && + virtualSystemSettingData->data.v2->Notes.data !=3D NULL) { + char **notes =3D NULL; + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + size_t i =3D 0; + + /* in practice Notes has 1 element */ + for (i =3D 0; i < virtualSystemSettingData->data.v2->Notes.count; = i++) { + /* but if there's more than 1, separate by double new line */ + if (virBufferUse(&buf) > 0) + virBufferAddLit(&buf, "\n\n"); + + notes =3D (char **) virtualSystemSettingData->data.v2->Notes.d= ata; + virBufferAdd(&buf, *notes, -1); + notes++; + } + + def->description =3D virBufferContentAndReset(&buf); + } + =20 virDomainDefSetMemoryTotal(def, memorySettingData->data.common->Limit = * 1024); /* megabyte to kilobyte */ def->mem.cur_balloon =3D memorySettingData->data.common->VirtualQuanti= ty * 1024; /* megabyte to kilobyte */ diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py index c15d97a..9aee0b9 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -251,7 +251,7 @@ class WmiClass: for cls in self.versions: for prop in cls.properties: # consdered same if matches by name AND type - key =3D "%s_%s" % (prop.name, prop.type) + key =3D "%s_%s_%s" % (prop.name, prop.type, prop.is_array) =20 if key in property_info: property_info[key][1] +=3D 1 --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list