From nobody Tue Feb 10 00:58:44 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 1491263570665258.05342237435787; Mon, 3 Apr 2017 16:52:50 -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 4413864D97; Mon, 3 Apr 2017 23:52:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 130005C6D8; Mon, 3 Apr 2017 23:52: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 BAA954ED26; Mon, 3 Apr 2017 23:52:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v33NqRSo015707 for ; Mon, 3 Apr 2017 19:52:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id 34DB378F0C; Mon, 3 Apr 2017 23:52:27 +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 2D57C78F2C for ; Mon, 3 Apr 2017 23:52:25 +0000 (UTC) Received: from mail-qt0-f180.google.com (mail-qt0-f180.google.com [209.85.216.180]) (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 442A720264 for ; Mon, 3 Apr 2017 23:52:24 +0000 (UTC) Received: by mail-qt0-f180.google.com with SMTP id x35so126131596qtc.2 for ; Mon, 03 Apr 2017 16:52:24 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id f28sm10658242qtf.44.2017.04.03.16.52.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 16:52:22 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4413864D97 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx09.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 4413864D97 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="H6ILascJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 442A720264 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 442A720264 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=0Sc8LBGZVkb1svUqAzg8aanWrzL+ik5/juiK6tzBq1U=; b=H6ILascJjhWHPpiSUP6S+mT3C3kJDj0vTxHRkyMPCKRklGIpW8py+1KkLaRoksPf4I QWnnJj5ItvtUuty9AMYXOAik8zmIZIAZN/1JqxB6FuIjA2tKW3t9YUjFt/8xB/2wzVf3 tMYD01Ra2xbCFFW1c0uRffgysmoxA1n7vUmOiSJtpnxJtxr/Mt0sJDeNxijw4V5fCjKC eIVb6776CBpv9EieN1ZVx/oslAlURShNRZM/ZSqNag9bykcd1MV692coMBhBuZKTnZ6M EiHXSWb4VwzGNPI5YtWH1nWBsJFO5iKFbujkzpvpG8XLK+jgQt4uqIU1/FoON/x1YWoS rVvg== 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=0Sc8LBGZVkb1svUqAzg8aanWrzL+ik5/juiK6tzBq1U=; b=o6cb0QIUGnA8Vkwfu73uPqxBRIsg/LM66WGV+9US8IRQkE1yAIXUnkHPe4XHb3kR9y BedswPbpN/dpDsb5MMBgD0C9ZC2tWkYajflo1ahCVWZ1Yt9cjAubHLyYEK9wWfZue1p5 88MU3E9UU9GoTG37yB9INUeX4jv9uZKFJe0+yeqzpuS9WomdXf/UoNCO7bN1ifvsyVY8 ehWZt5hjchNGjp3FL7Ao2dPUa5XugsOSBTL58c/vyN1/Mj/I8qzNRBEydCV2ta5bzPwu Kw9LBwbXVw9hspS1GpQ5ly6cOl851EV+JyNFBrnPx8ccLpUzk+MBDWTJkhLlJkpEpJ5i vOpA== X-Gm-Message-State: AFeK/H3LZO82TXPHJeZBZALY30gwD0vrDccscb2uY+iFaAK/iW8GDsF5Vay7TJutCHC4YOlJ X-Received: by 10.200.56.48 with SMTP id q45mr20406016qtb.220.1491263543247; Mon, 03 Apr 2017 16:52:23 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Mon, 3 Apr 2017 19:52:11 -0400 Message-Id: <20170403235219.19721-5-dzamirski@datto.com> In-Reply-To: <20170403235219.19721-1-dzamirski@datto.com> References: <20170403235219.19721-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 03 Apr 2017 23:52:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 03 Apr 2017 23:52:24 +0000 (UTC) for IP:'209.85.216.180' DOMAIN:'mail-qt0-f180.google.com' HELO:'mail-qt0-f180.google.com' FROM:'dzamirski@datto.com' RCPT:'' X-RedHat-Spam-Score: -0.321 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 209.85.216.180 mail-qt0-f180.google.com 209.85.216.180 mail-qt0-f180.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 04/12] 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.38]); Mon, 03 Apr 2017 23:52:49 +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 b2b5243..069bcc9 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