From nobody Fri May 16 23:49:41 2025 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 1495227518866179.8990122476249; Fri, 19 May 2017 13:58:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F99AC059730; Fri, 19 May 2017 20:58:37 +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 1D30617C54; Fri, 19 May 2017 20:58:37 +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 C56E0180BAF5; Fri, 19 May 2017 20:58:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v4JKwEps012466 for ; Fri, 19 May 2017 16:58:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 119A8189D9; Fri, 19 May 2017 20:58:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C38C60467 for ; Fri, 19 May 2017 20:58:12 +0000 (UTC) Received: from mail-qk0-f171.google.com (mail-qk0-f171.google.com [209.85.220.171]) (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 43D173D941 for ; Fri, 19 May 2017 20:58:11 +0000 (UTC) Received: by mail-qk0-f171.google.com with SMTP id y201so70872902qka.0 for ; Fri, 19 May 2017 13:58:11 -0700 (PDT) Received: from silas.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id t66sm2685740qkt.42.2017.05.19.13.58.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 May 2017 13:58:09 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F99AC059730 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx08.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 3F99AC059730 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="QZFSjG/C" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 43D173D941 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=sramanujam@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 43D173D941 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:in-reply-to:references; bh=qhA1Hr+npMd3f3nUn2qa2+WtR08MPmAaFvExmWjDrig=; b=QZFSjG/C8/sARGgqWRvNydIuCHwRa/C8YVnGQabTXLhRvza8g8alo2PoKC7zUsSH3U vmkciGzcmYmc4blXK4Fj9FxYqI994VG93jyo2rJaoe31/J5sZoY850Knyow1Cw0WykMs spN4zs6jUkqossg6vTCMkTLE+1cn1dijVLVZ/2760PWYXQUkS9XmTRXKUV6u/QF86b7V zU9+GsavlScjqST176HVBNIB8400Uf6T9qRA4enp4/93CeOoLmuIZDyw/oe39dr4JCwS ntyJDui0wWO35cx1cNdVf1sNTbbm+KQww8juCmnzjQBWieYBQq1ce1u0bOOXOhgauQGW qBdw== 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:in-reply-to :references; bh=qhA1Hr+npMd3f3nUn2qa2+WtR08MPmAaFvExmWjDrig=; b=HUsi54tM9nV3K9AKGB0ND5QR2zdPQ2pw0sTSfIyuxQtSqjSryeyJIHT0ngrHKC/HvD MWlYMQEenDl6pIBbkxEgUdwfMqqUPPESNJQ9Kg41kxXUIe2I6t0bNg26O56eY7zm3pIA vWNyNVRHLLYtDUk6mB64PJkWJQA+8F3+U7Nh3rwmYK1uhxTHYl9ydPLiz64eFuLiWXB1 xIx2Mkb9vglUtzlqRLq1tXMnNFjZe6S4wQMzWX1Zy+cYQnUd/haetXHnERkAvzUtIw0H VxdzbebPmpXtqROYa7ab3/YZ5uJEJ7pQQcwkS6FmhlyR2uQiVkIzM11A2O352OgLO0n/ H+6Q== X-Gm-Message-State: AODbwcAIxOZVvJRURofzdsl7gAD5CLyhMRhQVr1NI0baCKZc2rsr4PsJ MmahimowQb3yM4qkpZw= X-Received: by 10.55.98.147 with SMTP id w141mr10474046qkb.90.1495227490397; Fri, 19 May 2017 13:58:10 -0700 (PDT) From: Sri Ramanujam To: libvir-list@redhat.com Date: Fri, 19 May 2017 16:57:59 -0400 Message-Id: <20170519205802.27094-3-sramanujam@datto.com> In-Reply-To: <20170519205802.27094-1-sramanujam@datto.com> References: <20170519205802.27094-1-sramanujam@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 19 May 2017 20:58:11 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 19 May 2017 20:58:11 +0000 (UTC) for IP:'209.85.220.171' DOMAIN:'mail-qk0-f171.google.com' HELO:'mail-qk0-f171.google.com' FROM:'sramanujam@datto.com' RCPT:'' X-RedHat-Spam-Score: -1.911 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.220.171 mail-qk0-f171.google.com 209.85.220.171 mail-qk0-f171.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 2/5] hyperv: Generate object property type information. 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 19 May 2017 20:58:37 +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" Update the generator to generate basic property type information for each CIM object representation. Right now, it generates arrays of hypervCimType structs: struct _hypervCimType { const char *name; const char *type; bool isArray; }; --- src/hyperv/hyperv_wmi_classes.h | 19 +++++++++++++++++++ src/hyperv/hyperv_wmi_generator.py | 15 ++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classe= s.h index f7d596f..ce4643e 100644 --- a/src/hyperv/hyperv_wmi_classes.h +++ b/src/hyperv/hyperv_wmi_classes.h @@ -1,6 +1,7 @@ /* * hyperv_wmi_classes.h: WMI classes for managing Microsoft Hyper-V hosts * + * Copyright (C) 2017 Datto Inc * Copyright (C) 2011 Matthias Bolte * Copyright (C) 2009 Michael Sievers * @@ -23,6 +24,7 @@ #ifndef __HYPERV_WMI_CLASSES_H__ # define __HYPERV_WMI_CLASSES_H__ =20 +# include "internal.h" # include "openwsman.h" =20 # include "hyperv_wmi_classes.generated.typedef" @@ -96,6 +98,21 @@ enum _Msvm_ConcreteJob_JobState { }; =20 =20 +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *= * * + * WMI + */ + +typedef struct _hypervCimType hypervCimType; +typedef hypervCimType *hypervCimTypePtr; +struct _hypervCimType { + /* Parameter name */ + const char *name; + /* Parameter type */ + const char *type; + /* whether parameter is an array type */ + bool isArray; +}; + typedef struct _hypervWmiClassInfo hypervWmiClassInfo; typedef hypervWmiClassInfo *hypervWmiClassInfoPtr; struct _hypervWmiClassInfo { @@ -109,6 +126,8 @@ struct _hypervWmiClassInfo { const char *resourceUri; /* The wsman serializer info - one of the *_TypeInfo structs */ XmlSerializerInfo *serializerInfo; + /* Property type information */ + hypervCimTypePtr propertyInfo; }; =20 =20 diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py index 9aee0b9..9c0acce 100755 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -122,6 +122,14 @@ class WmiClass: =20 source +=3D "SER_END_ITEMS(%s_Data);\n\n" % cls.name =20 + # also generate typemap data while we're here + source +=3D "hypervCimType %s_Typemap[] =3D {\n" % cls.name + + for property in cls.properties: + source +=3D property.generate_typemap() + source +=3D ' { "", "", 0 },\n' # null terminated + source +=3D '};\n\n' + =20 source +=3D self._define_WmiInfo_struct() source +=3D "\n\n" @@ -222,7 +230,8 @@ class WmiClass: source +=3D " .version =3D NULL,\n" source +=3D " .rootUri =3D %s,\n" % cls.uri_info.ro= otUri source +=3D " .resourceUri =3D %s_RESOURCE_URI,\n" = % cls.name.upper() - source +=3D " .serializerInfo =3D %s_Data_TypeInfo\= n" % cls.name + source +=3D " .serializerInfo =3D %s_Data_TypeInfo,= \n" % cls.name + source +=3D " .propertyInfo =3D %s_Typemap\n" % cls= .name source +=3D " },\n" =20 source +=3D " }\n" @@ -374,6 +383,10 @@ class Property: % (Property.typemap[self.type], class_name.upper(), sel= f.name) =20 =20 + def generate_typemap(self): + return ' { "%s", "%s", %s },\n' % (self.name, self.type.lower()= , str(self.is_array).lower()) + + =20 def open_and_print(filename): if filename.startswith("./"): --=20 2.9.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list