From nobody Wed Feb 11 07:34:11 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.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 1491109463172189.66741107930284; Sat, 1 Apr 2017 22:04:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 57FA931F3E2; Sun, 2 Apr 2017 05:04:21 +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 274BA60319; Sun, 2 Apr 2017 05:04:21 +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 1742618521C8; Sun, 2 Apr 2017 05:04:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v324pO5p019097 for ; Sun, 2 Apr 2017 00:51:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id A87BA17105; Sun, 2 Apr 2017 04:51:24 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A204762922 for ; Sun, 2 Apr 2017 04:51:23 +0000 (UTC) Received: from mail-qk0-f176.google.com (mail-qk0-f176.google.com [209.85.220.176]) (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 9B98CC049D5B for ; Sun, 2 Apr 2017 04:50:59 +0000 (UTC) Received: by mail-qk0-f176.google.com with SMTP id g195so21332020qke.2 for ; Sat, 01 Apr 2017 21:50:58 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id c10sm6934829qka.1.2017.04.01.21.50.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Apr 2017 21:50:53 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 57FA931F3E2 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=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 57FA931F3E2 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="vFp+Dep6" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 9B98CC049D5B Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 9B98CC049D5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datto-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1iMorNzfKbj3G4NQotAA7Yg4pR2O2tQsFTYgdNDnbAA=; b=vFp+Dep66NSPTJkdlg5Skf4E8gylfhp4HkbmdCy+HTjRvrYioTbFVLbF0FdwI6F17b Uw6ywu+1AnK6QD+I4jdoVYvLSHcNxLrsyPnQQw/jyRR99R7YZW01KUQEb3nDDGGAm/bN E6wnvjqgpeSZBNs+zH6LxBSTrh3wy+a/IlImkwajs19spqVAC8QfSt9XuZ4jWH5mXowX NC2+p7R4dqCaauIp+z40AEw3HiCd1MtzmBckKCkwSnZtoBTWUB7cTeGPsG7jqTOGvxn2 n0bxy0xd5fA7yzwoI3zyPCss4TuMUFkBhOxd+0TLh73IIQgRDABnGJf6OPug91TvnzP6 hdYQ== 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=1iMorNzfKbj3G4NQotAA7Yg4pR2O2tQsFTYgdNDnbAA=; b=QnDh9ee+7LuAZDoOSIGtQlfuUx3hRPHGTe5umjr3o7Y+7AAHc+CfWgGurz7GvVDoeU DpCHyr61/uXH4IQInl/ljLjOCm3OrauW1v/IC8VLkhuz13Phbj9txPWt7yUog1vOOdmN 3u+1uu1JnCG3yH5PZq51ZAR1UuZABbDejBtegnvM/JG91apgu383UeTrNm0qy+8dEQKz Aw+Gwjij5q9W7dT4FKYvUyzhfv2oCwwjoUfx1IR9yPhsxh08qSzxxBHviOo+/73kAZzn vk1zYDNVc+sn73QrtyQrvjPCTOGkj7aRezmQ0EtDf3SpNRcK+UcRJF44nu/KYQ7RaMqC Egow== X-Gm-Message-State: AFeK/H1DUCYQM4B44tx8q+WMlpUiwFzqpF4xceDS9teEubRLsA0AV9elnRDIAgaXGlTvlhOH X-Received: by 10.55.169.9 with SMTP id s9mr10445908qke.91.1491108653746; Sat, 01 Apr 2017 21:50:53 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Sun, 2 Apr 2017 00:50:43 -0400 Message-Id: <20170402045049.19631-5-dzamirski@datto.com> In-Reply-To: <20170402045049.19631-1-dzamirski@datto.com> References: <20170402045049.19631-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 02 Apr 2017 04:51:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sun, 02 Apr 2017 04:51:02 +0000 (UTC) for IP:'209.85.220.176' DOMAIN:'mail-qk0-f176.google.com' HELO:'mail-qk0-f176.google.com' FROM:'dzamirski@datto.com' RCPT:'' X-RedHat-Spam-Score: -1.901 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.220.176 mail-qk0-f176.google.com 209.85.220.176 mail-qk0-f176.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH v2 04/10] hyperv: add hypervWqlQuery struct. 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Sun, 02 Apr 2017 05:04:22 +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" Since this is the last commit that will compile in the series, the remaining patches should be squashed into this one - they are kept separate only for code review purposes. This struct is to be passed to enumerate-and-pull wsman request (to run "Select" queries) and provides the hypervWmiClassInfoListPtr instance from which we can extract the version specific info using the new hypervGetWmiClassInfo function (currently unused) --- src/hyperv/hyperv_wmi.c | 35 +++++++++++++++++++++++++++++++++++ src/hyperv/hyperv_wmi.h | 8 ++++++++ 2 files changed, 43 insertions(+) diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 947101f..bc391e3 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -45,6 +45,41 @@ #define VIR_FROM_THIS VIR_FROM_HYPERV =20 =20 +static int ATTRIBUTE_UNUSED +hypervGetWmiClassInfo(hypervPrivate *priv, hypervWmiClassInfoListPtr list, + hypervWmiClassInfoPtr *info) +{ + const char *version =3D "v2"; + size_t i; + + if (list->count =3D=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("The WMI class info list is empty")); + return -1; + } + + /* if there's just one WMI class and isn't versioned, assume "shared" = */ + if (list->count =3D=3D 1 && list->objs[0]->version =3D=3D NULL) { + *info =3D list->objs[0]; + return 0; + } + + if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V1) + version =3D "v1"; + + for (i =3D 0; i < list->count; i++) { + if (STRCASEEQ(list->objs[i]->version, version)) { + *info =3D list->objs[i]; + return 0; + } + } + + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Could not match WMI class info for version %s"), + version); + + return -1; +} =20 int hypervVerifyResponse(WsManClient *client, WsXmlDocH response, diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index 5fc36e8..12b94af 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -30,6 +30,7 @@ # include "openwsman.h" =20 =20 +# define HYPERV_WQL_QUERY_INITIALIZER {NULL, NULL} =20 typedef struct _hypervObject hypervObject; =20 @@ -61,6 +62,13 @@ struct _hypervObjectUnified { hypervObjectUnified *next; }; =20 +typedef struct _hypervWqlQuery hypervWqlQuery; +typedef hypervWqlQuery *hypervWqlQueryPtr; +struct _hypervWqlQuery { + const char *query; + hypervWmiClassInfoListPtr info; +}; + struct _hypervObject { XmlSerializerInfo *serializerInfo; XML_TYPE_PTR data; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list