From nobody Thu Apr 18 22:39:59 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 1490892679833569.9375274305318; Thu, 30 Mar 2017 09:51:19 -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 717D5C04BD59; Thu, 30 Mar 2017 16:51:18 +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 4311E90ECB; Thu, 30 Mar 2017 16:51:18 +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 EFC6C18523CA; Thu, 30 Mar 2017 16:51:17 +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 v2UGlYTF016909 for ; Thu, 30 Mar 2017 12:47:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9CE8E84719; Thu, 30 Mar 2017 16:47:34 +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 952A783BFC for ; Thu, 30 Mar 2017 16:47:32 +0000 (UTC) Received: from mail-qk0-f179.google.com (mail-qk0-f179.google.com [209.85.220.179]) (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 0A6C341A24 for ; Thu, 30 Mar 2017 16:47:31 +0000 (UTC) Received: by mail-qk0-f179.google.com with SMTP id d201so15377551qkc.0 for ; Thu, 30 Mar 2017 09:47:31 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:29 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 717D5C04BD59 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=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 717D5C04BD59 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="LqVzVDP/" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0A6C341A24 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=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0A6C341A24 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=9HMEMopdoEHl2cYp0DhZiaKwA1ApWQMqe0h0izYnRCs=; b=LqVzVDP/RhA+USPROfv9AlqDGGpw6DCOntG09KexAQC9Hem8nV+ND32gGnYKuBVVp6 O3e4KjKb1AodA0wwOankceoyuv3bMh5j51NUnbAkU4DdHgg2t8c6h4vDWW/+sAW0AMfi Rbw834gvQKonj8NAde7y3T8G+mGKmDINIi2Gl3CdqVPzommfNiL8oCrLVG2New3rHnxl iabmm25p1gv3dYMB28BjEwLOS49tUB83L+h1p1V2ud69CYPd6HDh2IH5Pjc8hm4VIvbn XwZ+q62ggSsrqWJv8s98lL7amgiTQZhAeigX48/KZMGQlPkiMFwj2qhqM09EgTgT3/9K 6Ygg== 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=9HMEMopdoEHl2cYp0DhZiaKwA1ApWQMqe0h0izYnRCs=; b=g/AB+/9Jv7oAvC60bbaniujWPvQXpkrW3QSH2IV0jkjAuAr7K+bEiJZWRvDzDVYnme GbXJy6nviqUMPN3irpnaUxO3h/MnLO0iMUpADx7s0jVXoiV39rdQqhl5zJ8L2oN7SytV 0ZKNOdlmGC/ob+yLi8Ll3k4fEc0W8NstiyvjX/LmsVlpS1YY9QEPCOixkeemgOytvUAo J4BLZQfxq/6V/gJpv6A9r4YYhl+dm06W0FftMXo+DnEweyeQaFsU3cJ/PZhBXl0DVcMI TmvxoOyjG+g7yV8MixFFtuKrTJ83Ja0xsvwn8j2ESAhKbgKsrP+6UKR1D6jPsEH556lL pfdA== X-Gm-Message-State: AFeK/H0XCwrgkNVYUwstMPU/tBiUtQmWGqG6JUpzVsAGMR1WYAsRen3/J1Cw4Uj+s8HaAsZj X-Received: by 10.55.203.14 with SMTP id d14mr703480qkj.0.1490892450171; Thu, 30 Mar 2017 09:47:30 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:18 -0400 Message-Id: <20170330164728.32215-2-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 30 Mar 2017 16:47:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 30 Mar 2017 16:47:31 +0000 (UTC) for IP:'209.85.220.179' DOMAIN:'mail-qk0-f179.google.com' HELO:'mail-qk0-f179.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.220.179 mail-qk0-f179.google.com 209.85.220.179 mail-qk0-f179.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 01/11] hyperv: fixed typo in function name. 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.31]); Thu, 30 Mar 2017 16:51:19 +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" that is: s/hyperyVerifyresponse/hypervVerifyResponse/ --- src/hyperv/hyperv_wmi.c | 8 ++++---- src/hyperv/hyperv_wmi.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 13acd09..947101f 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -47,7 +47,7 @@ =20 =20 int -hyperyVerifyResponse(WsManClient *client, WsXmlDocH response, +hypervVerifyResponse(WsManClient *client, WsXmlDocH response, const char *detail) { int lastError =3D wsmc_get_last_error(client); @@ -157,7 +157,7 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr que= ry, const char *root, =20 response =3D wsmc_action_enumerate(priv->client, root, options, filter= ); =20 - if (hyperyVerifyResponse(priv->client, response, "enumeration") < 0) + if (hypervVerifyResponse(priv->client, response, "enumeration") < 0) goto cleanup; =20 enumContext =3D wsmc_get_enum_context(response); @@ -169,7 +169,7 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr que= ry, const char *root, response =3D wsmc_action_pull(priv->client, resourceUri, options, filter, enumContext); =20 - if (hyperyVerifyResponse(priv->client, response, "pull") < 0) + if (hypervVerifyResponse(priv->client, response, "pull") < 0) goto cleanup; =20 node =3D ws_xml_get_soap_body(response); @@ -425,7 +425,7 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDom= ainPtr domain, response =3D wsmc_action_invoke(priv->client, MSVM_COMPUTERSYSTEM_RESO= URCE_URI, options, "RequestStateChange", NULL); =20 - if (hyperyVerifyResponse(priv->client, response, "invocation") < 0) + if (hypervVerifyResponse(priv->client, response, "invocation") < 0) goto cleanup; =20 /* Check return value */ diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index 5fbbbac..ce1fe05 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -33,7 +33,7 @@ =20 typedef struct _hypervObject hypervObject; =20 -int hyperyVerifyResponse(WsManClient *client, WsXmlDocH response, +int hypervVerifyResponse(WsManClient *client, WsXmlDocH response, const char *detail); =20 =20 --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892459982208.00536982942992; Thu, 30 Mar 2017 09:47:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 919C289C2F; Thu, 30 Mar 2017 16:47:38 +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 694D5783FE; Thu, 30 Mar 2017 16:47:38 +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 675E518523CA; Thu, 30 Mar 2017 16:47:35 +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 v2UGlYFM016900 for ; Thu, 30 Mar 2017 12:47:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3867B17ADA; Thu, 30 Mar 2017 16:47:34 +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 30DC37ADAC for ; Thu, 30 Mar 2017 16:47:32 +0000 (UTC) Received: from mail-qk0-f172.google.com (mail-qk0-f172.google.com [209.85.220.172]) (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 8B61141A2D for ; Thu, 30 Mar 2017 16:47:31 +0000 (UTC) Received: by mail-qk0-f172.google.com with SMTP id d10so45342241qke.1 for ; Thu, 30 Mar 2017 09:47:31 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:30 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 919C289C2F Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx03.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 919C289C2F 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="SADvprwJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8B61141A2D 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=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 8B61141A2D 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=ZnBGKfqBXblb18P0HCOeOCkcTPM840zzG60UQTXjD7k=; b=SADvprwJCqv9F0KDhZ324kNbvj/c21hhgldRnWoto+6qeTvq3mQLxe1b3jdmB+fNxr BhrzR+1t3U3wUoBSFZEQDGeZVIvUT+0hJsbTXfqQ1SSvcV5VmJ9+3zQ4Pq1QqFtAlbaA Q9uyyeRCMyZLQtB3B5KbrW55NYgrWLuApRnXhnTbFVqwliQp9iXt+qD4RVMyFTsyvRlM fukbHs8kRTVMg59aAcXsiHmjmpxWw8AjfHoZDN18PWLbGdN2AFmmJimDqpcZvUQbD7CG KkIJomdWV88bY7zkDCxgTvjbJ1SR2S3M+7O9MUep0bUxuWMtVm674mAj+7a48bQhSiOx dFrg== 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=ZnBGKfqBXblb18P0HCOeOCkcTPM840zzG60UQTXjD7k=; b=O72rmFenmxw87CeVLOqs2pLGQTx12EXSXsshPuAXGJAnMBOTrVnuOdm7OZyX5lEF78 9FOIDsYI+hQd7d0rDE0Qq6OFllqlQtMknhkZTwwvFejGdK0pqJ6ZbIO/90HFYYDiZOBe B1mNL4mZvmGrNGzph87haQ73kLeWm2jkbQxJREkhtkdq3DG4Ji53rO4ILJLpTfVBNKZp eT64QQgLcTtjSCjBxuNu3tX82Etllq8Nmu7fJsMft7NSjC2cZFmC0WMhSkYI4IuSo0F2 hu7UcsKUDIvImk0lCdncA1ztBI01vp5eQUi1frMRZpMqb78CbAi7JFbJhXvDoAnyvRG6 PBkA== X-Gm-Message-State: AFeK/H0PhGXst/aZTroJ47R/Ml2l13tOWHti14UP3+7dKoHOmi1J48N/b2con0dmkHd6tBY/ X-Received: by 10.55.177.193 with SMTP id a184mr721260qkf.210.1490892450703; Thu, 30 Mar 2017 09:47:30 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:19 -0400 Message-Id: <20170330164728.32215-3-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 30 Mar 2017 16:47:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 30 Mar 2017 16:47:31 +0000 (UTC) for IP:'209.85.220.172' DOMAIN:'mail-qk0-f172.google.com' HELO:'mail-qk0-f172.google.com' FROM:'dzamirski@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.172 mail-qk0-f172.google.com 209.85.220.172 mail-qk0-f172.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 02/11] hyperv: store WMI version in hypervPrivate. 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Mar 2017 16:47:39 +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" Hyper-V 2012+ uses a new "v2" version of Msvm_* WMI classes so we will store that info in hypervPrivate so that it is easily accessbile in the driver API callbacks and handled accordingly. --- src/hyperv/hyperv_private.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hyperv/hyperv_private.h b/src/hyperv/hyperv_private.h index 574bb5f..4e70699 100644 --- a/src/hyperv/hyperv_private.h +++ b/src/hyperv/hyperv_private.h @@ -28,11 +28,17 @@ # include "hyperv_util.h" # include "openwsman.h" =20 -typedef struct _hypervPrivate hypervPrivate; +typedef enum _hypervWmiVersion hypervWmiVersion; +enum _hypervWmiVersion { + HYPERV_WMI_VERSION_V1, + HYPERV_WMI_VERSION_V2, +}; =20 +typedef struct _hypervPrivate hypervPrivate; struct _hypervPrivate { hypervParsedUri *parsedUri; WsManClient *client; + hypervWmiVersion wmiVersion; }; =20 #endif /* __HYPERV_PRIVATE_H__ */ --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892481669875.7894887598776; Thu, 30 Mar 2017 09:48:01 -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 E178E7F7C5; Thu, 30 Mar 2017 16:47:59 +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 B141084438; Thu, 30 Mar 2017 16:47:59 +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 5EFF018523CA; Thu, 30 Mar 2017 16:47:59 +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 v2UGlZv4016920 for ; Thu, 30 Mar 2017 12:47:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3AABD78C16; Thu, 30 Mar 2017 16:47:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 174F577DDE for ; Thu, 30 Mar 2017 16:47:33 +0000 (UTC) Received: from mail-qt0-f181.google.com (mail-qt0-f181.google.com [209.85.216.181]) (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 63F588051A for ; Thu, 30 Mar 2017 16:47:32 +0000 (UTC) Received: by mail-qt0-f181.google.com with SMTP id x35so44262661qtc.2 for ; Thu, 30 Mar 2017 09:47:32 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:30 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E178E7F7C5 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx04.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 E178E7F7C5 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="ftmWAOHn" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 63F588051A Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 63F588051A 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=GsA20hEXx4SsEeOUpnG6sreFJE3UODn9tszyQRildSI=; b=ftmWAOHnF/kthoPqr4RLF/puLlV7c47XTLfzDHV9vlNQCHI9kk0ZTRAlhe7sA6HOw8 LwCPDEJbpI/7SVQFRsC+PUraLTlbnuXKlujTEypeLrs7nPiZeVi0+8rinjQex1a0x/fD HQqAflwjA8me+xfm7YUXVrkqXynWYtllPQeNSpTNlCi6w6qhJvqziK944UIUwTdmy5MH sJvcz5Nf9lwOFs0xOum7XsC2rJeeIujTyEjkEsiyj4jKnleSgNeaFZkXeH5UIskqUksT uggFuryEW6EXoNs9jwEWxztK2o6IiuOs8Alkt3fiUvGfadHLhMP2fY5zGVplIHYWbDiF cKhQ== 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=GsA20hEXx4SsEeOUpnG6sreFJE3UODn9tszyQRildSI=; b=dbj3kgAh57ffEUY1GsVy/2+cMfsFHExPg4Zqemw6cxFlpk9yKyge1Z/jOao01sC94R q+0k5mnpqJF5Z9XPS+pFZ1zUBSiV1NKiMJXJpfAFrnMZ7CdayAh0PtO+Dw9E9KIv6/vc e9f987IuDNH0Uw+y/Y/kAiFGKGMgzy3fTyfltnsYoDJp8WyG+AO0ZTu7QnhtmIjxb2CO chhM0JhbqWMOkWPkBw+7PlV6RaEqpQMicVWyDzcPYEnNfZtVvk187c5lXCoiLUZ6Yq4J eZMQ8rSvLuMP18UKCTOx15w21d9nbFni/8vrvSyp1hIS0XHQJ5tj2XAJnP0b32bolvMm Q/1A== X-Gm-Message-State: AFeK/H05uSQHKoTwth6nyKzSHaaduUFXXEQVIbyAahV2mwKqBZoa6/sN1qI1oQlfQxs0nV9C X-Received: by 10.200.46.77 with SMTP id s13mr716186qta.88.1490892451459; Thu, 30 Mar 2017 09:47:31 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:20 -0400 Message-Id: <20170330164728.32215-4-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Mar 2017 16:47:32 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Mar 2017 16:47:32 +0000 (UTC) for IP:'209.85.216.181' DOMAIN:'mail-qt0-f181.google.com' HELO:'mail-qt0-f181.google.com' FROM:'dzamirski@datto.com' RCPT:'' X-RedHat-Spam-Score: 0.179 (BAYES_50, DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.216.181 mail-qt0-f181.google.com 209.85.216.181 mail-qt0-f181.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 03/11] hyperv: introduce hypervWmiClassInfo 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.28]); Thu, 30 Mar 2017 16:48:00 +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" This struct is to be used to carry all the information necessary to issue wsman requests for given WMI class. Those will be defined by the generator code (as lists) so that they are handy for the driver code to "extract" needed info depending on which hyper-v we're connected to. For example: hypervWmiClassInfoListPtr Msvm_ComputerSystem_WmiInfo =3D { .count =3D 2 { { .name =3D "Msvm_ComputerSystem", .version =3D "v1", .rootUri =3D "http://asdf.com", ... }, { .name =3D "Msvm_ComputerSystem", .version =3D "v2", .rootUri =3D "http://asdf.com/v2", ... }, } }; Then the driver code will grab either "v1" or "v2" to pass info wsman API, depending on hypervPrivate->wmiVersion value. --- src/hyperv/hyperv_wmi.c | 6 ++---- src/hyperv/hyperv_wmi_classes.h | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 947101f..309edac 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -36,16 +36,14 @@ =20 #define WS_SERIALIZER_FREE_MEM_WORKS 0 =20 -#define ROOT_CIMV2 \ +# define ROOT_CIMV2 \ "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*" =20 -#define ROOT_VIRTUALIZATION \ +# define ROOT_VIRTUALIZATION \ "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/*" =20 #define VIR_FROM_THIS VIR_FROM_HYPERV =20 - - int hypervVerifyResponse(WsManClient *client, WsXmlDocH response, const char *detail) diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classe= s.h index ac7a3b8..b0f3e3c 100644 --- a/src/hyperv/hyperv_wmi_classes.h +++ b/src/hyperv/hyperv_wmi_classes.h @@ -87,6 +87,28 @@ enum _Msvm_ConcreteJob_JobState { }; =20 =20 +typedef struct _hypervWmiClassInfo hypervWmiClassInfo; +typedef hypervWmiClassInfo *hypervWmiClassInfoPtr; +struct _hypervWmiClassInfo { + /* The WMI class name */ + const char *name; + /* The version of the WMI class as in "v1" or "v2" */ + const char *version; + /* The URI for wsman enumerate request */ + const char *rootUri; + /* The namespace URI for XML serialization */ + const char *resourceUri; + /* The wsman serializer info - one of the *_TypeInfo structs */ + XmlSerializerInfo *serializerInfo; +}; + + +typedef struct _hypervWmiClassInfoList hypervWmiClassInfoList; +typedef hypervWmiClassInfoList *hypervWmiClassInfoListPtr; +struct _hypervWmiClassInfoList { + size_t count; + hypervWmiClassInfoPtr *objs; +}; =20 # include "hyperv_wmi_classes.generated.h" =20 --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892483654375.8040067261345; Thu, 30 Mar 2017 09:48:03 -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 136C22E606B; Thu, 30 Mar 2017 16:47:56 +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 DA2B017C27; Thu, 30 Mar 2017 16:47:55 +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 830AB18523CD; Thu, 30 Mar 2017 16:47:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2UGlYh3016905 for ; Thu, 30 Mar 2017 12:47:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9330A87647; Thu, 30 Mar 2017 16:47:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8740771CA7 for ; Thu, 30 Mar 2017 16:47:34 +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 E7F0AC0094C4 for ; Thu, 30 Mar 2017 16:47:32 +0000 (UTC) Received: by mail-qk0-f171.google.com with SMTP id d201so15378325qkc.0 for ; Thu, 30 Mar 2017 09:47:32 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:31 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 136C22E606B 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 136C22E606B 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="GejGr8Hw" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E7F0AC0094C4 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=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E7F0AC0094C4 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=vCXoBshs5+V6rrV2fC/fpAbeYUimvlX3Dv/smLn/T4Y=; b=GejGr8HwkJhRl4cfH49B5KK8QhPk28bZhyJMyNz2EYofPWykH4L+kNCw52kojp6JpM 93Ei1v0e2aGS0tI2FAe7W76nVegh9IDJlTDppIrlpd0jgfyThSwKf/4vXAp6GaARFtC/ kwvwIJxL7Vba2/cSnwkR3Hxi50vuIcH8ke5JYuVw00GcAsZdJtvjHyiF7/CftBw8rzgF ojsb/RGovTIwRwmvEByPjI9yHfBLA6Sk/5w06KqUpJRnZMZFV5pLDcZvNtn60/UE2JXJ oz+S9NXkz1t30rovXw4pAfKhkMroAZQt2V9AlWGi+nn/TxtRlXrENq/VxYFzoLZ45s6v QZRw== 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=vCXoBshs5+V6rrV2fC/fpAbeYUimvlX3Dv/smLn/T4Y=; b=kYcVOq8ZuXSfuX6uORBhc+pDmMG9wLL0a9DiVn3pAkrgsR0CKHwfnzRpRf+nPyKtrX COq8wehPO+Ct7NErenPMzO5caITSSLajyZ+oovZ3712BBlH2v646/AmZEFgP0aGRGYbK g94Z0jIDTFDCsju2CHo1hm+AIn4C8HDK880nFIOXkMc3UGtU4oWeZBD+/wC8Z673lF7n cvS++rQbzbwlDQIJTrvseKf27YXBXaE090X4CWT5SVmwvc9KJ1P0Qdob2Wp3W9Fo9+gq ZI6Ie/JXb9xH/WuJ4eSMZni9UoOYLYJ0ww492UFQEy8p9TgxlsBFRrObrUNxE3U6Z+aS WfGw== X-Gm-Message-State: AFeK/H2YjEPj6WAXiFO3x7tizidMiTiEmgTTSBFxkKk1z7X85xGyZJnLwnLO/VhURkQUqm84 X-Received: by 10.55.140.199 with SMTP id o190mr690260qkd.46.1490892451928; Thu, 30 Mar 2017 09:47:31 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:21 -0400 Message-Id: <20170330164728.32215-5-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 30 Mar 2017 16:47:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 30 Mar 2017 16:47:33 +0000 (UTC) for IP:'209.85.220.171' DOMAIN:'mail-qk0-f171.google.com' HELO:'mail-qk0-f171.google.com' FROM:'dzamirski@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.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 04/11] hyperv: update hypervObject 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 30 Mar 2017 16:48:02 +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" Currently named as hypervObjecUnified to keep code compilable/functional until all bits are in place. This struct is a result of unserializing WMI request response. Therefore, it needs to be able to deal with different "versions" of the same WMI class. To accomplish this, the "data" member was turned in to a union which: * has a "common" member that contains only WMI class fields that are safe to access and are present in all "versions". This is ensured by the code generator that takes care of proper struct memory alignment between "common", "v1", "v2" etc members. This memeber is to be used by the driver code wherever the API implementation can be shared for all supported hyper-v versions. * the "v1" and "v2" member can be used by the driver code to handle version specific cases. Example: Msvm_ComputerSystem *vm =3D NULL; ... hypervGetVirtualMachineList(priv, wqlQuery, *vm); ... /* safe for "v1" and "v2" */ char *vmName =3D vm->data.common->Name; /* or if one really needs special handling for "v2" */ if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V2) { char *foo =3D vm->data.v2->SomeV2OnlyField; } In other words, driver should not concern itself with existence of "v1" or "v2" of WMI class unless absolutely necessary. --- src/hyperv/hyperv_wmi.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index ce1fe05..5fc36e8 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -41,6 +41,25 @@ int hypervVerifyResponse(WsManClient *client, WsXmlDocH = response, /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *= * * * Object */ +typedef struct _hypervObjectUnified hypervObjectUnified; +struct _hypervObjectUnified { + /* Unserialized data from wsman response. The member called "common" h= as + * properties that are the same type and name for all "versions" of gi= ven + * WMI class. This means that calling code does not have to make any + * conditional checks based on which version was returned as long as it + * only needs to read common values. The alignment of structs is ensur= ed + * by the generator. + */ + union { + XML_TYPE_PTR common; + XML_TYPE_PTR v1; + XML_TYPE_PTR v2; + } data; + /* The info used to make wsman request */ + hypervWmiClassInfoPtr info; + + hypervObjectUnified *next; +}; =20 struct _hypervObject { XmlSerializerInfo *serializerInfo; --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892684297186.52658506689943; Thu, 30 Mar 2017 09:51:24 -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 B785A67EAE; Thu, 30 Mar 2017 16:51:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8D6CC84436; Thu, 30 Mar 2017 16:51:22 +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 494435EC64; Thu, 30 Mar 2017 16:51:22 +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 v2UGlZwJ016934 for ; Thu, 30 Mar 2017 12:47:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id D519990EC3; Thu, 30 Mar 2017 16:47:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE4AD173A4 for ; Thu, 30 Mar 2017 16:47:34 +0000 (UTC) Received: from mail-qk0-f178.google.com (mail-qk0-f178.google.com [209.85.220.178]) (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 4B6D080F9F for ; Thu, 30 Mar 2017 16:47:33 +0000 (UTC) Received: by mail-qk0-f178.google.com with SMTP id r142so45346061qke.2 for ; Thu, 30 Mar 2017 09:47:33 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:32 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B785A67EAE 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 B785A67EAE 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="DIB8MR5l" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4B6D080F9F Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4B6D080F9F 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=f5s4nC8lPiddvj+FolAZfXFakFe3WXxzDFGdL9NPAyU=; b=DIB8MR5lugeKzuz3dXyt1PAgaZLz39n8XVO78daPgyrlYIKMcuwpCIizSyuqV4hpiU 5oQbl/7mq0LpNx89WK+Ssz/WmNKftwuTSSSQXG5GviwvfrCayhEgFBf0oYFGnx0vm/Mo BmiE8CFg5BVE6xFpER7SEr4bdfafsXog/36GP9ZV0Y9C5tiY2UzfFIRDALXKwRHULEwS MjI8wTgKjoDbZriPydIMhj8FSrfeP2uA3ylusxfQyVG+S4SlavCHx9vw2vwUQTncCxqj KjZUEx22zUA/xZeN4rRxlA4gRV6jRbuvh8bvU5bYW38sLMy9TUxHkJCieqKPIc8M9lHN 6rWg== 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=f5s4nC8lPiddvj+FolAZfXFakFe3WXxzDFGdL9NPAyU=; b=L+Oz7ECD1nmJuIyGaDI1jTU8m9e0ktBdO+UH9P/NvvlyNs09VguZ+y7Q18akpLeY9r lAaRqBBok+Zd5MKqN5LiK2nVW/n7Bv0obFomtaK65ArZvYdJq8ooJc6QHk90pDIU7NA3 2a1ovY6xcgS4+6c6OZp0Jzxz3bHVNih+pP4fekLheTzYU+wuuXDFPldL+nbGKiGWEA/0 BmTUPpt6rZ8/MaOgcfVcOySdyKEBJehYmdJ2MgG5jQE431SZLC2YW5QX+OLttkC/a8UH OFeFdR0/wrfDRM6V38ZTWnktveaCR5bmW2gvf2hqxrMKqNZ2qxBVKawSfPTyfEkyerKj 3OrA== X-Gm-Message-State: AFeK/H26pnxyhuqZfjkVi+kSCho8OPpfcXevx+PtZe2Qskku1MeXY0HR42eUxsmJt/aCe7yY X-Received: by 10.55.31.156 with SMTP id n28mr643104qkh.131.1490892452402; Thu, 30 Mar 2017 09:47:32 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:22 -0400 Message-Id: <20170330164728.32215-6-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Mar 2017 16:47:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Mar 2017 16:47:33 +0000 (UTC) for IP:'209.85.220.178' DOMAIN:'mail-qk0-f178.google.com' HELO:'mail-qk0-f178.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.220.178 mail-qk0-f178.google.com 209.85.220.178 mail-qk0-f178.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 05/11] 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]); Thu, 30 Mar 2017 16:51:23 +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" 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 309edac..42ce507 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -44,6 +44,41 @@ =20 #define VIR_FROM_THIS VIR_FROM_HYPERV =20 +static int +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 (list->count =3D=3D 1) { + *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; +} + int hypervVerifyResponse(WsManClient *client, WsXmlDocH response, const char *detail) 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 From nobody Thu Apr 18 22:39:59 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 1490892485995101.64689372722307; Thu, 30 Mar 2017 09:48:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7378F7F36F; Thu, 30 Mar 2017 16:48:04 +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 3DD0560A9D; Thu, 30 Mar 2017 16:48:04 +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 1B18618523D7; Thu, 30 Mar 2017 16:48:03 +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 v2UGlZ6d016925 for ; Thu, 30 Mar 2017 12:47:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 750A218E27; Thu, 30 Mar 2017 16:47:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6CAAC17ADA for ; Thu, 30 Mar 2017 16:47:35 +0000 (UTC) Received: from mail-qt0-f172.google.com (mail-qt0-f172.google.com [209.85.216.172]) (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 EDFF861E4B for ; Thu, 30 Mar 2017 16:47:33 +0000 (UTC) Received: by mail-qt0-f172.google.com with SMTP id n21so44455766qta.1 for ; Thu, 30 Mar 2017 09:47:33 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:32 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7378F7F36F 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 7378F7F36F 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="VZ9MVZiL" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EDFF861E4B Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EDFF861E4B 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=kS9RmSSyUAhrawv2z+GkIRo/0bH9nTx16SJGDl51a2c=; b=VZ9MVZiL4Jp/98Ori0dA3hUyLb1LBpafEpbA2QX8B1rabrRSvcgBEeaaE7enG4GOps 6WK23RDjjqaj7iGIki5z8CsoKccGK12RAOJoBYjSuVXpv6B6f5CGAO06PgrMSES5YBm5 r6ZN7a2KZa+BTdzlbmsIoesZSBnqFbylYpakPdOvVmjwpWscEzJuyUbLibtqe/NZC3+M 4K3K1Jp2zce1bSmVC9UFAGowEcgS6FncPy4UEPViS/VmYfUlFHY8+6vs7GFW2QE76TC7 p8CFrpyEMhb/26u36yydxhtkTIYrBWyhWOVajpoEqkcgc9d449HdLRDdVAIYkf5UoOc1 uJIA== 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=kS9RmSSyUAhrawv2z+GkIRo/0bH9nTx16SJGDl51a2c=; b=pBu2xUrLYpQo9Bh7xiXykvXITzVT0yOVi1y5RbEGGUOV5qdSZk2s+iTYn/AYIuRnK1 RHkh4sWS1S5aljSPGKw2waavetHPE89CBOBsNTNT0UPjASyJ2pzBEz8DOcKmuD6GNRp3 LCA8ykqxywX2oo6GR6m8Od5KscR++0KUsTIkHrL5ter3rs3gT+VaMQpm1GmEXWk+yEZy y353IgzUAvxv/SmrZYdmny809cWediS33MxYazILQcz3X5MaBHp2Z1SacYZI1r5hcOck SCXKI7dP/VnG2SIEq6PV+O0A46ucjy2roWnzplQ68FHk93GNZqXqEq+aWpDX5d26gtcB 2bjQ== X-Gm-Message-State: AFeK/H1W4hKR5h/fEK0V1NtX1q3pl+4CeJuf+SSrvh6KJ96y+4xGl7WsfduZI3e0ZBL38xH7 X-Received: by 10.200.51.117 with SMTP id u50mr736011qta.133.1490892452927; Thu, 30 Mar 2017 09:47:32 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:23 -0400 Message-Id: <20170330164728.32215-7-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 30 Mar 2017 16:47:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 30 Mar 2017 16:47:34 +0000 (UTC) for IP:'209.85.216.172' DOMAIN:'mail-qt0-f172.google.com' HELO:'mail-qt0-f172.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.172 mail-qt0-f172.google.com 209.85.216.172 mail-qt0-f172.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 06/11] hyperv: make hypervEnumAndPull use hypervWqlQuery 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 30 Mar 2017 16:48:05 +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" This enables this function to handle "v1" and "v2" WMI requests. Since this commit is where complilation breakage starts: * commits that follow should be squashed into this one * rename hypervObjectUnified -> hypervObject as we've already broken compilation here so there's no point in keeping those in parallel anymore. --- src/hyperv/hyperv_wmi.c | 38 +++++++++++++++++--------------------- src/hyperv/hyperv_wmi.h | 17 ++++------------- 2 files changed, 21 insertions(+), 34 deletions(-) diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 42ce507..dcd4d7a 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -141,14 +141,13 @@ hypervVerifyResponse(WsManClient *client, WsXmlDocH r= esponse, =20 /* This function guarantees that query is freed, even on failure */ int -hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *roo= t, - XmlSerializerInfo *serializerInfo, const char *resourceU= ri, - const char *className, hypervObject **list) +hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery, + hypervObject **list) { int result =3D -1; WsSerializerContextH serializerContext; client_opt_t *options =3D NULL; - char *query_string =3D NULL; + hypervWmiClassInfoPtr wmiInfo =3D NULL; filter_t *filter =3D NULL; WsXmlDocH response =3D NULL; char *enumContext =3D NULL; @@ -158,18 +157,14 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr q= uery, const char *root, XML_TYPE_PTR data =3D NULL; hypervObject *object; =20 - if (virBufferCheckError(query) < 0) { - virBufferFreeAndReset(query); - return -1; - } - query_string =3D virBufferContentAndReset(query); - if (list =3D=3D NULL || *list !=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")= ); - VIR_FREE(query_string); return -1; } =20 + if (hypervGetWmiClassInfo(priv, wqlQuery->info, &wmiInfo) < 0) + return -1; + serializerContext =3D wsmc_get_serialization_context(priv->client); =20 options =3D wsmc_options_init(); @@ -180,7 +175,7 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr que= ry, const char *root, goto cleanup; } =20 - filter =3D filter_create_simple(WSM_WQL_FILTER_DIALECT, query_string); + filter =3D filter_create_simple(WSM_WQL_FILTER_DIALECT, wqlQuery->quer= y); =20 if (filter =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -188,7 +183,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr que= ry, const char *root, goto cleanup; } =20 - response =3D wsmc_action_enumerate(priv->client, root, options, filter= ); + response =3D wsmc_action_enumerate(priv->client, wmiInfo->rootUri, opt= ions, + filter); =20 if (hypervVerifyResponse(priv->client, response, "enumeration") < 0) goto cleanup; @@ -199,7 +195,7 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr que= ry, const char *root, response =3D NULL; =20 while (enumContext !=3D NULL && *enumContext !=3D '\0') { - response =3D wsmc_action_pull(priv->client, resourceUri, options, + response =3D wsmc_action_pull(priv->client, wmiInfo->resourceUri, = options, filter, enumContext); =20 if (hypervVerifyResponse(priv->client, response, "pull") < 0) @@ -229,11 +225,12 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr q= uery, const char *root, goto cleanup; } =20 - if (ws_xml_get_child(node, 0, resourceUri, className) =3D=3D NULL) + if (ws_xml_get_child(node, 0, wmiInfo->resourceUri, + wmiInfo->name) =3D=3D NULL) break; =20 - data =3D ws_deserialize(serializerContext, node, serializerInfo, - className, resourceUri, NULL, 0, 0); + data =3D ws_deserialize(serializerContext, node, wmiInfo->serializ= erInfo, + wmiInfo->name, wmiInfo->resourceUri, NULL, 0= , 0); =20 if (data =3D=3D NULL) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", @@ -244,8 +241,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr que= ry, const char *root, if (VIR_ALLOC(object) < 0) goto cleanup; =20 - object->serializerInfo =3D serializerInfo; - object->data =3D data; + object->info =3D wmiInfo; + object->data.common =3D data; =20 data =3D NULL; =20 @@ -281,13 +278,12 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr q= uery, const char *root, /* FIXME: ws_serializer_free_mem is broken in openwsman <=3D 2.2.6, * see hypervFreeObject for a detailed explanation. */ if (ws_serializer_free_mem(serializerContext, data, - serializerInfo) < 0) { + wmiInfo->serializerInfo) < 0) { VIR_ERROR(_("Could not free deserialized data")); } #endif } =20 - VIR_FREE(query_string); ws_xml_destroy_doc(response); VIR_FREE(enumContext); hypervFreeObject(priv, head); diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index 12b94af..8ce32a9 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -32,7 +32,6 @@ =20 # define HYPERV_WQL_QUERY_INITIALIZER {NULL, NULL} =20 -typedef struct _hypervObject hypervObject; =20 int hypervVerifyResponse(WsManClient *client, WsXmlDocH response, const char *detail); @@ -42,8 +41,8 @@ int hypervVerifyResponse(WsManClient *client, WsXmlDocH r= esponse, /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *= * * * Object */ -typedef struct _hypervObjectUnified hypervObjectUnified; -struct _hypervObjectUnified { +typedef struct _hypervObject hypervObject; +struct _hypervObject { /* Unserialized data from wsman response. The member called "common" h= as * properties that are the same type and name for all "versions" of gi= ven * WMI class. This means that calling code does not have to make any @@ -59,7 +58,7 @@ struct _hypervObjectUnified { /* The info used to make wsman request */ hypervWmiClassInfoPtr info; =20 - hypervObjectUnified *next; + hypervObject *next; }; =20 typedef struct _hypervWqlQuery hypervWqlQuery; @@ -69,15 +68,7 @@ struct _hypervWqlQuery { hypervWmiClassInfoListPtr info; }; =20 -struct _hypervObject { - XmlSerializerInfo *serializerInfo; - XML_TYPE_PTR data; - hypervObject *next; -}; - -int hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, - const char *root, XmlSerializerInfo *serializerInfo, - const char *resourceUri, const char *className, +int hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery, hypervObject **list); =20 void hypervFreeObject(hypervPrivate *priv, hypervObject *object); --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892464139922.5800443089367; Thu, 30 Mar 2017 09:47:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A02D61B91; Thu, 30 Mar 2017 16:47:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E570783FE; Thu, 30 Mar 2017 16:47:42 +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 0443A4EBDD; Thu, 30 Mar 2017 16:47:42 +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 v2UGlZIx016933 for ; Thu, 30 Mar 2017 12:47:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id D5C8190EC4; Thu, 30 Mar 2017 16:47:35 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CE4E8173AE for ; Thu, 30 Mar 2017 16:47:35 +0000 (UTC) Received: from mail-qt0-f172.google.com (mail-qt0-f172.google.com [209.85.216.172]) (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 7FDD881233 for ; Thu, 30 Mar 2017 16:47:34 +0000 (UTC) Received: by mail-qt0-f172.google.com with SMTP id r45so44331620qte.3 for ; Thu, 30 Mar 2017 09:47:34 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:33 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7A02D61B91 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx10.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 7A02D61B91 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="gMBpcFQQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7FDD881233 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7FDD881233 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=Jg5FWIUkufpoIVg9cEdzlRTCwvVEZNCDqii3I69my/U=; b=gMBpcFQQH73nX3XXzkmVd+LIxx9g/KrbZvdF5TQJ33fKyfzHndISU+Cw690W5CSz5E Ih9qAayz7xt15mrhuKJ+QVZ0VBufYGqLlG+O/O42PX9AQmjKTUl0uHdwVETyUOZWRElL IEkckLLLTeocVkbiYYZ9zufMerHpqcI5FNxnT51TiRdjtP92XLFCLEX7VCdXaOULSL6t qPIkxOSeRyJCDD7G0zXMfntbOfmUvnwuBmxJMO2VflwdfPynikJ+YX1oxHy/wvJuNCpn s5xbs+A54WSzezTcKPqlVsOdOd4GhKXXpPTyPfriiUV0mBCVel//Vz5HAjLlI9ZqRoH6 o4XA== 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=Jg5FWIUkufpoIVg9cEdzlRTCwvVEZNCDqii3I69my/U=; b=O2CODd36L5DM7/pahoOvEfmG+jsQ5DhOV6IalbicAyzhfWOXue+oVOUlsT3fkvsgSI AQhR0UQuk3SjdvM+pg7X8U3FbcneNwi2pXz9fMvjzLjUdx5Ypb3/GfxM3/kdI4t0XLAy cZwt4u/1BqoQGBJsUxClrHvrfiDkP+9+TCdif2hwSs0scoMIYC+K2DR34dWILZ7bS36y sVWb60vntDHcaf/tE94ebPFf8jOGnfyOwswYfIBdBfdjl9iehSskNVZGe8PRGK/NsRVy kb1AjJS57AqViJprA0QmbMQiYdKCto7qy5Ee5vwTkbPQZchHwXz2kVaOIPlvghOkoHLM PHew== X-Gm-Message-State: AFeK/H2DRnx+mpolVmnrQmFPlB5STKiIq258oOyROy3d99rUeO005vy/u0HibpDpJYSto+Ma X-Received: by 10.200.56.141 with SMTP id f13mr737186qtc.206.1490892453494; Thu, 30 Mar 2017 09:47:33 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:24 -0400 Message-Id: <20170330164728.32215-8-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 30 Mar 2017 16:47:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 30 Mar 2017 16:47:34 +0000 (UTC) for IP:'209.85.216.172' DOMAIN:'mail-qt0-f172.google.com' HELO:'mail-qt0-f172.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.172 mail-qt0-f172.google.com 209.85.216.172 mail-qt0-f172.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 07/11] hyperv: update generator input file. 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 30 Mar 2017 16:47:43 +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" Adds defintiions for "v2" WMI class variants that are needed by the driver to handle both hyperv 2008 and 2012+ --- src/hyperv/hyperv_wmi_generator.input | 239 +++++++++++++++++++++++++++++-= ---- 1 file changed, 206 insertions(+), 33 deletions(-) diff --git a/src/hyperv/hyperv_wmi_generator.input b/src/hyperv/hyperv_wmi_= generator.input index 209a9ff..d7f819e 100644 --- a/src/hyperv/hyperv_wmi_generator.input +++ b/src/hyperv/hyperv_wmi_generator.input @@ -56,6 +56,55 @@ class Msvm_ComputerSystem end =20 =20 +class v2/Msvm_ComputerSystem + string InstanceID + string Caption + string Description + string ElementName + datetime InstallDate + uint16 OperationalStatus[] + string StatusDescriptions[] + string Status + uint16 HealthState + uint16 CommunicationStatus + uint16 DetailedStatus + uint16 OperatingStatus + uint16 PrimaryStatus + uint16 EnabledState + string OtherEnabledState + uint16 RequestedState + uint16 EnabledDefault + datetime TimeOfLastStateChange + uint16 AvailableRequestedStates[] + uint16 TransitioningToState + string CreationClassName + string Name + string PrimaryOwnerName + string PrimaryOwnerContact + string Roles[] + string NameFormat + string OtherIdentifyingInfo[] + string IdentifyingDescriptions[] + uint16 Dedicated[] + string OtherDedicatedDescriptions[] + uint16 ResetCapability + uint16 PowerManagementCapabilities[] + uint64 OnTimeInMilliseconds + uint32 ProcessID + datetime TimeOfLastConfigurationChange + uint16 NumberOfNumaNodes + uint16 ReplicationState + uint16 ReplicationHealth + uint16 ReplicationMode + uint16 FailedOverReplicationType + uint16 LastReplicationType + datetime LastApplicationConsistentReplicationTime + datetime LastReplicationTime + datetime LastSuccessfulBackupTime + uint16 EnhancedSessionModeState +end + + class Msvm_ConcreteJob string Caption string Description @@ -96,6 +145,51 @@ class Msvm_ConcreteJob end =20 =20 +class v2/Msvm_ConcreteJob + string InstanceID + string Caption + string Description + string ElementName + datetime InstallDate + string Name + uint16 OperationalStatus[] + string StatusDescriptions[] + string Status + uint16 HealthState + uint16 CommunicationStatus + uint16 DetailedStatus + uint16 OperatingStatus + uint16 PrimaryStatus + string JobStatus + datetime TimeSubmitted + datetime ScheduledStartTime + datetime StartTime + datetime ElapsedTime + uint32 JobRunTimes + uint8 RunMonth + sint8 RunDay + sint8 RunDayOfWeek + datetime RunStartInterval + uint16 LocalOrUtcTime + datetime UntilTime + string Notify + string Owner + uint32 Priority + uint16 PercentComplete + boolean DeleteOnCompletion + uint16 ErrorCode + string ErrorDescription + string ErrorSummaryDescription + uint16 RecoveryAction + string OtherRecoveryAction + uint16 JobState + datetime TimeOfLastStateChange + datetime TimeBeforeRemoval + boolean Cancellable + uint16 JobType +end + + class Msvm_MemorySettingData string Caption string Description @@ -126,6 +220,38 @@ class Msvm_MemorySettingData end =20 =20 +class v2/Msvm_MemorySettingData + string InstanceID + string Caption + string Description + string ElementName + uint16 ResourceType + string OtherResourceType + string ResourceSubType + string PoolID + uint16 ConsumerVisibility + string HostResource[] + string AllocationUnits + uint64 VirtualQuantity + uint64 Reservation + uint64 Limit + uint32 Weight + boolean AutomaticAllocation + boolean AutomaticDeallocation + string Parent + string Connection[] + string Address + uint16 MappingBehavior + string AddressOnParent + string VirtualQuantityUnits + boolean DynamicMemoryEnabled + uint32 TargetMemoryBuffer + boolean IsVirtualized + boolean SwapFilesInUse + uint64 MaxMemoryBlocksPerNumaNode +end + + class Msvm_ProcessorSettingData string Caption string Description @@ -159,6 +285,37 @@ class Msvm_ProcessorSettingData end =20 =20 +class v2/Msvm_ProcessorSettingData + string InstanceID + string Caption + string Description + string ElementName + uint16 ResourceType + string OtherResourceType + string ResourceSubType + string PoolID + uint16 ConsumerVisibility + string HostResource[] + string AllocationUnits + uint64 VirtualQuantity + uint64 Reservation + uint64 Limit + uint32 Weight + boolean AutomaticAllocation + boolean AutomaticDeallocation + string Parent + string Connection[] + string Address + uint16 MappingBehavior + string AddressOnParent + string VirtualQuantityUnits + boolean LimitCPUID + boolean LimitProcessorFeatures + uint64 MaxProcessorsPerNumaNode + uint64 MaxNumaNodesPerSocket +end + + class Msvm_VirtualSystemSettingData string Caption string Description @@ -184,6 +341,55 @@ class Msvm_VirtualSystemSettingData end =20 =20 +class v2/Msvm_VirtualSystemSettingData + string InstanceID + string Caption + string Description + string ElementName + string VirtualSystemIdentifier + string VirtualSystemType + string Notes[] + datetime CreationTime + string ConfigurationID + string ConfigurationDataRoot + string ConfigurationFile + string SnapshotDataRoot + string SuspendDataRoot + string SwapFileDataRoot + string LogDataRoot + uint16 AutomaticStartupAction + datetime AutomaticStartupActionDelay + uint16 AutomaticStartupActionSequenceNumber + uint16 AutomaticShutdownAction + uint16 AutomaticRecoveryAction + string RecoveryFile + string BIOSGUID + string BIOSSerialNumber + string BaseBoardSerialNumber + string ChassisSerialNumber + string ChassisAssetTag + boolean BIOSNumLock + uint16 BootOrder[] + string Parent + boolean IsSaved + string AdditionalRecoveryInformation + boolean AllowFullSCSICommandSet + uint32 DebugChannelId + uint16 DebugPortEnabled + uint32 DebugPort + string Version + boolean IncrementalBackupEnabled + boolean VirtualNumaEnabled + boolean AllowReducedFcRedundancy + string VirtualSystemSubType + string BootSourceOrder[] + boolean PauseAfterBootFailure + uint16 NetworkBootPreferredProtocol + boolean SecureBootEnabled + uint64 LowMmioGapSize +end + + class Win32_ComputerSystem uint16 AdminPasswordStatus boolean AutomaticManagedPagefile @@ -607,39 +813,6 @@ class Msvm_VirtualSystemGlobalSettingData end =20 =20 -class Msvm_VirtualSwitch - string Caption - string Description - string ElementName - datetime InstallDate - uint16 OperationalStatus[] - string StatusDescriptions[] - string Status - uint16 HealthState - uint16 EnabledState - string OtherEnabledState - uint16 RequestedState - uint16 EnabledDefault - datetime TimeOfLastStateChange - string CreationClassName - string Name - string PrimaryOwnerContact - string PrimaryOwnerName - string Roles[] - string NameFormat - string OtherIdentifyingInfo[] - string IdentifyingDescriptions[] - uint16 Dedicated[] - string OtherDedicatedDescriptions[] - uint16 ResetCapability - uint16 PowerManagementCapabilities[] - string ScopeOfResidence - uint32 NumLearnableAddresses - uint32 MaxVMQOffloads - uint32 MaxChimneyOffloads -end - - class Msvm_ResourceAllocationSettingData string Caption string Description --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892488840857.6210429024028; Thu, 30 Mar 2017 09:48:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 69CA641A27; Thu, 30 Mar 2017 16:48:07 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 381BC8765A; Thu, 30 Mar 2017 16:48:07 +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 E14E35EC63; Thu, 30 Mar 2017 16:48:06 +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 v2UGlbZb016948 for ; Thu, 30 Mar 2017 12:47:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1F48F90EC3; Thu, 30 Mar 2017 16:47:37 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 150B5173A4 for ; Thu, 30 Mar 2017 16:47:37 +0000 (UTC) Received: from mail-qk0-f177.google.com (mail-qk0-f177.google.com [209.85.220.177]) (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 399A264D8E for ; Thu, 30 Mar 2017 16:47:35 +0000 (UTC) Received: by mail-qk0-f177.google.com with SMTP id r142so45346944qke.2 for ; Thu, 30 Mar 2017 09:47:35 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:33 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 69CA641A27 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=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 69CA641A27 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="hnjPa3Py" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 399A264D8E 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=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 399A264D8E 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=ivUrSMzN9szUzlw7f2+nxj33CnfV3CZG2MEy/vcE8dI=; b=hnjPa3PywvAa+Qqq4D7I1Y7b7TcixoykbKoi2kAnYWGrdD6g6acXV5n1+Pj+ZcMrlY d8nlDlNv0rLVbHZthm8RM3O9ok7T7AXg9XEtPiU391eOOk9AKQqVKYXIB423ag9W7KNb 72zu04CAGdfpvchcKCuQO/OqlhtfNJ2INnt+kL0+PNXSlWiZOZVaYajsR25E2nNXBswH 52f4gvDy5P34y/hTINR1NNl3KmbxfW9M0WmMNYs6aE+IuuMITtTTO0JBqoSrxd/Ugh+z hdqLsPU2emnkn5Qg92udxaN29qLpU8BmaTnaA2q0xexYs4Q09hM/vmtei6iP+MxfCFsO m4bA== 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=ivUrSMzN9szUzlw7f2+nxj33CnfV3CZG2MEy/vcE8dI=; b=HlqVzLATbkKk8vwdN6adUyROgaLg5avykpPYiJrjacBPhTt0ncrs0jmV2igYHscUfx ujro+M0h2vzCivo5vbuDx0CQBCTnwge73v06szP9H9Bk+bxf0QMfwmdUBgTuOWA6LbYi mQQ0yd8XIAfG5RXEwPpd+vWi/EmYBmfvV9VEaL9YkprN7Nsuh49dlxf9QcBvxdz1nHd9 vEwXp/xI7Bf8dKGlts17p6+Mv9pp/rOId/t+Jp0a6nV50AwsOmI7vODlzvBusCOc9NwZ i6e6c6qvpgVV9oZ7geOXpg54xUNmmPcEnlkTkZHUYhRGkAm3QSdPCGI4xoBn7yQxgvKr J0dQ== X-Gm-Message-State: AFeK/H1MMul2usob19dd5aJwfjD/nI6Yr9Hlhhv0yHNmcW3a48Ah7perUiVILYqnD0FgJPiA X-Received: by 10.55.209.216 with SMTP id o85mr746590qkl.180.1490892454086; Thu, 30 Mar 2017 09:47:34 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:25 -0400 Message-Id: <20170330164728.32215-9-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 30 Mar 2017 16:47:35 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 30 Mar 2017 16:47:35 +0000 (UTC) for IP:'209.85.220.177' DOMAIN:'mail-qk0-f177.google.com' HELO:'mail-qk0-f177.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.220.177 mail-qk0-f177.google.com 209.85.220.177 mail-qk0-f177.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 08/11] hyperv: update wmi code generator. 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 30 Mar 2017 16:48:08 +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" This patch updates the code generator that outputs C headers and code for WMI classes. It has been updated to handle multiple versions (or namespaces) of the same class which were introduced with Hyperv 2012+ --- src/hyperv/hyperv_wmi_generator.py | 409 +++++++++++++++++++++++++--------= ---- 1 file changed, 284 insertions(+), 125 deletions(-) mode change 100755 =3D> 100644 src/hyperv/hyperv_wmi_generator.py diff --git a/src/hyperv/hyperv_wmi_generator.py b/src/hyperv/hyperv_wmi_gen= erator.py old mode 100755 new mode 100644 index 8c62882..c36abf2 --- a/src/hyperv/hyperv_wmi_generator.py +++ b/src/hyperv/hyperv_wmi_generator.py @@ -1,153 +1,308 @@ #!/usr/bin/env python =20 -# -# hyperv_wmi_generator.py: generates most of the WMI type mapping code -# -# Copyright (C) 2011 Matthias Bolte -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library. If not, see -# . -# - import sys import os import os.path =20 +separator =3D "/*" + ("*" * 50) + "*\n" +wmi_version_separator =3D "/" +wmi_classes_by_name =3D {} + +class WmiClass: + """Represents WMI class and provides methods to generate C code. + + This class holds one or more instances of WmiClassVersion because with= the + Windows 2012 release, Microsoft introduced "v2" version of Msvm_* fami= ly of + classes that need different URI for making wsman requests and also have + some additional/changed properties (though many of the properies are t= he + same as in "v1". Therefore, this class makes sure that C code is gener= ated + for each of them while avoiding name conflics, identifies common membe= rs, + and defined *_WmiInfo structs holding info about each version so the d= river + code can make the right choices based on which Hyper-v host it's conne= cted + to. + """ + + def __init__(self, name, versions =3D []): + self.name =3D name + self.versions =3D versions + self.common =3D None =20 =20 -separator =3D "/* " + ("* " * 37) + "*\n" + def prepare(self): + """Prepares the class for code generation =20 + Makes sure that "versioned" classes are sorted by version, identfi= es + common properies and ensures that they are aligned by name and + type in each version + """ + # sort vesioned classes by version in case input file did not have= them + # in order + self.versions =3D sorted(self.versions, key=3Dlambda cls: cls.vers= ion) =20 + # if there's more than one verion make sure first one has name suf= fixed + # because we'll generate "common" memeber and will the "base" name + if len(self.versions) > 1: + first =3D self.versions[0] + first.name =3D "%s_%s" % (first.name, first.version) =20 -class Class: - def __init__(self, name, properties): - self.name =3D name - self.properties =3D properties + # finally, identify common members in all versions and make sure t= hey + # are in the same order - to ensure C struc member alignment + self._align_property_members() + =20 =20 + def generate_classes_header(self): + """Generate C header code and return it as string + + Declares: + _Data - used as one of hypervObject->data members + _TypeInfo - used as wsman XmlSerializerInfo + - "inherits" hypervObject struct + """ =20 - def generate_header(self): name_upper =3D self.name.upper() =20 header =3D separator header +=3D " * %s\n" % self.name header +=3D " */\n" header +=3D "\n" - header +=3D "int hypervGet%sList(hypervPrivate *priv, virBufferPtr= query, %s **list);\n" \ - % (self.name.replace("_", ""), self.name) - header +=3D "\n" + header +=3D "#define %s_CLASSNAME \\\n" % name_upper + header +=3D " \"%s\"\n" % self.name header +=3D "\n" + header +=3D "#define %s_WQL_SELECT \\\n" % name_upper + header +=3D " \"SELECT * FROM %s \"\n" % self.name header +=3D "\n" + header +=3D "extern hypervWmiClassInfoListPtr %s_WmiInfo;\n\n" % s= elf.name + + header +=3D self._declare_data_structs() + header +=3D self._declare_hypervObject_struct() =20 return header =20 =20 + def generate_classes_source(self): + """Returns a C code string defining wsman data structs + + Defines: + _Data structs + _WmiInfo - list holding metadata (e.g. request URIs)= for + each known version of WMI class. + """ + + source =3D separator + source +=3D " * %s\n" % self.name + source +=3D " */\n" + + for cls in self.versions: + source +=3D "SER_START_ITEMS(%s_Data)\n" % cls.name + + for property in cls.properties: + source +=3D property.generate_classes_source(cls.name) + + source +=3D "SER_END_ITEMS(%s_Data);\n\n" % cls.name + + + source +=3D self._define_WmiInfo_struct() + source +=3D "\n\n" + + return source + + def generate_classes_typedef(self): - typedef =3D "typedef struct _%s_Data %s_Data;\n" % (self.name, sel= f.name) - typedef +=3D "typedef struct _%s %s;\n" % (self.name, self.name) + """Returns C string for typdefs""" =20 - return typedef + typedef =3D "typedef struct _%s %s;\n" % (self.name, self.name) =20 + if self.common is not None: + typedef +=3D "typedef struct _%s_Data %s_Data;\n" % (self.name= , self.name) =20 - def generate_classes_header(self): - name_upper =3D self.name.upper() + for cls in self.versions: + typedef +=3D "typedef struct _%s_Data %s_Data;\n" % (cls.name,= cls.name) =20 - header =3D separator - header +=3D " * %s\n" % self.name - header +=3D " */\n" - header +=3D "\n" - header +=3D "#define %s_RESOURCE_URI \\\n" % name_upper + return typedef =20 - if self.name.startswith("Win32_") or self.name.startswith("CIM_"): - header +=3D " \"http://schemas.microsoft.com/wbem/wsman/1/w= mi/root/cimv2/%s\"\n" % self.name - else: - header +=3D " \"http://schemas.microsoft.com/wbem/wsman/1/w= mi/root/virtualization/%s\"\n" % self.name =20 - header +=3D "\n" - header +=3D "#define %s_CLASSNAME \\\n" % name_upper - header +=3D " \"%s\"\n" % self.name - header +=3D "\n" - header +=3D "#define %s_WQL_SELECT \\\n" % name_upper - header +=3D " \"select * from %s \"\n" % self.name - header +=3D "\n" - header +=3D "struct _%s_Data {\n" % self.name =20 - for property in self.properties: - header +=3D property.generate_classes_header() + def _declare_data_structs(self): + """Returns string C code declaring data structs. + + The *_Data structs are members of hypervObject data union. Each on= e has + corresponding *_TypeInfo that is used for wsman unserialization of + response XML into the *_Data structs. If there's a "common" member= , it + won't have corresponding *_TypeInfo becuase this is a special case= only + used to provide a common "view" of v1, v2 etc members + """ + =20 + header =3D "" + if self.common is not None: + header +=3D "struct _%s_Data {\n" % self.name + for property in self.common: + header +=3D property.generate_classes_header() + header +=3D "};\n\n" + + # Declare actual data struct for each versions + for cls in self.versions: + header +=3D "#define %s_RESOURCE_URI \\\n" % cls.name.upper() + header +=3D " \"%s\"\n" % cls.uri_info.resourceUri=20 + header +=3D "\n" + header +=3D "struct _%s_Data {\n" % cls.name + for property in cls.properties: + header +=3D property.generate_classes_header() + header +=3D "};\n\n" + header +=3D "SER_DECLARE_TYPE(%s_Data);\n" % cls.name =20 - header +=3D "};\n" - header +=3D "\n" - header +=3D "SER_DECLARE_TYPE(%s_Data);\n" % self.name - header +=3D "\n" + return header + =20 + + def _declare_hypervObject_struct(self): + """Return string for C code declaring hypervObject instance""" + + header =3D "\n/* must match hypervObject */\n" header +=3D "struct _%s {\n" % self.name - header +=3D " XmlSerializerInfo *serializerInfo;\n" - header +=3D " %s_Data *data;\n" % self.name + header +=3D " union {\n" + + # if there's common use it as "common" else first and only version= is + # the "common" member + if self.common is not None: + header +=3D " %s_Data *common;\n" % self.name + else: + header +=3D " %s_Data *common;\n" % self.versions[0].na= me + + for cls in self.versions: + header +=3D " %s_Data *%s;\n" % (cls.name, cls.version) + + header +=3D " } data;\n" + header +=3D " hypervWmiClassInfoPtr info;\n" header +=3D " %s *next;\n" % self.name header +=3D "};\n" - header +=3D "\n" - header +=3D "\n" - header +=3D "\n" + + header +=3D "\n\n\n" =20 return header =20 =20 - def generate_source(self): - name_upper =3D self.name.upper() + def _define_WmiInfo_struct(self): + """Return string for C code defining *_WmiInfo struct =20 - source =3D separator - source +=3D " * %s\n" % self.name - source +=3D " */\n" - source +=3D "\n" - source +=3D "int\n" - source +=3D "hypervGet%sList(hypervPrivate *priv, virBufferPtr que= ry, %s **list)\n" \ - % (self.name.replace("_", ""), self.name) - source +=3D "{\n" - - if self.name.startswith("Win32_") or self.name.startswith("CIM_"): - source +=3D " return hypervEnumAndPull(priv, query, ROOT_CI= MV2,\n" - else: - source +=3D " return hypervEnumAndPull(priv, query, ROOT_VI= RTUALIZATION,\n" + Those structs hold info with meta-data needed to make wsman reques= ts for + each version of WMI class + """ =20 - source +=3D " %s_Data_TypeInfo,\n" % s= elf.name - source +=3D " %s_RESOURCE_URI,\n" % na= me_upper - source +=3D " %s_CLASSNAME,\n" % name_= upper - source +=3D " (hypervObject **)list);\= n" - source +=3D "}\n" - source +=3D "\n" - source +=3D "\n" - source +=3D "\n" + source =3D "hypervWmiClassInfoListPtr %s_WmiInfo =3D &(hypervWmiCl= assInfoList) {\n" % self.name + source +=3D " .count =3D %d,\n" % len(self.versions) + source +=3D " .objs =3D (hypervWmiClassInfoPtr []) {\n" + + for cls in self.versions: + source +=3D " &(hypervWmiClassInfo) {\n" + source +=3D " .name =3D %s_CLASSNAME,\n" % self.nam= e.upper() + source +=3D " .version =3D \"%s\",\n" % cls.version + source +=3D " .rootUri =3D %s,\n" % cls.uri_info.ro= otUri=20 + source +=3D " .resourceUri =3D %s_RESOURCE_URI,\n" = % cls.name.upper() + source +=3D " .serializerInfo =3D %s_Data_TypeInfo\= n" % cls.name + source +=3D " },\n" + + source +=3D " }\n" + source +=3D "};\n" =20 return source =20 =20 - def generate_classes_source(self): - name_upper =3D self.name.upper() + def _align_property_members(self): + """Identifies common properties in all class versions. =20 - source =3D separator - source +=3D " * %s\n" % self.name - source +=3D " */\n" - source +=3D "\n" - source +=3D "SER_START_ITEMS(%s_Data)\n" % self.name + Makes sure that properties in all versions are ordered with common=20 + members first and that they are in the same order. This makes the + generated C structs memory aligned and safe to access via the "com= mon" + struct that "shares" members with v1, v2 etc. + """ =20 - for property in self.properties: - source +=3D property.generate_classes_source(self.name) + num_classes =3D len(self.versions) + common =3D {} + property_info =3D {} =20 - source +=3D "SER_END_ITEMS(%s_Data);\n" % self.name - source +=3D "\n" - source +=3D "\n" - source +=3D "\n" + if num_classes < 2: + return + + # count property occurences in all class versions + 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) + + if key in property_info: + property_info[key][1] +=3D 1 + else: + property_info[key] =3D [prop, 1] + + # isolate those that are common for all and keep track of their po= stions + pos =3D 0 + for key in property_info: + info =3D property_info[key] + # exists in all class versions + if info[1] =3D=3D num_classes: + common[info[0].name] =3D [info[0], pos] + pos +=3D 1 + + # alter each versions's property list so that common members are f= irst + # and in the same order as in the common dictionary + total =3D len(common) + for cls in self.versions: + index =3D 0 + count =3D len(cls.properties) + + while index < count: + prop =3D cls.properties[index] + + # it's a "common" proptery + if prop.name in common: + pos =3D common[prop.name][1] + + # move to the same position as in "common" dictionary + if index !=3D pos: + tmp =3D cls.properties[pos] + cls.properties[pos] =3D prop + cls.properties[index] =3D tmp + else: + index +=3D 1 + else: + index +=3D 1 + + # finally, get common properties as list sorted by position in dic= tionary + tmp =3D sorted(common.values(), key=3Dlambda x: x[1]) + self.common =3D []=20 + for x in tmp: + self.common.append(x[0]) + + + +class ClassUriInfo: + """Prepares URI information needed for wsman requests.""" + + def __init__(self, wmi_name, version): + self.rootUri =3D "ROOT_CIMV2" + self.resourceUri =3D None + baseUri =3D "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/ci= mv2" + + if wmi_name.startswith("Msvm_"): + baseUri =3D "http://schemas.microsoft.com/wbem/wsman/1/wmi/roo= t/virtualization" + self.rootUri =3D "ROOT_VIRTUALIZATION" + + if version =3D=3D "v2": + baseUri +=3D "/v2" + self.rootUri =3D "ROOT_VIRTUALIZATION_V2" + + self.resourceUri =3D "%s/%s" % (baseUri, wmi_name) + + + +class WmiClassVersion: + """Represents specific verssion of WMI class.""" + + def __init__(self, name, version, properties, uri_info): + self.name =3D name + self.version =3D version + self.properties =3D properties + self.uri_info =3D uri_info =20 - return source =20 =20 class Property: @@ -155,9 +310,13 @@ class Property: "string" : "STR", "datetime" : "STR", "int8" : "INT8", + "sint8" : "INT8", "int16" : "INT16", + "sint16" : "INT16", "int32" : "INT32", + "sint32" : "INT32", "int64" : "INT64", + "sint64" : "INT64", "uint8" : "UINT8", "uint16" : "UINT16", "uint32" : "UINT32", @@ -189,8 +348,6 @@ class Property: return " SER_NS_%s(%s_RESOURCE_URI, \"%s\", 1),\n" \ % (Property.typemap[self.type], class_name.upper(), sel= f.name) =20 - - def open_and_print(filename): if filename.startswith("./"): print " GEN " + filename[2:] @@ -217,8 +374,15 @@ def parse_class(block): assert header_items[0] =3D=3D "class" =20 name =3D header_items[1] - properties =3D [] + version =3D "v1" + wmi_name =3D name + ns_separator =3D name.find(wmi_version_separator) + + if ns_separator !=3D -1: + version =3D name[:ns_separator] + wmi_name =3D name[ns_separator + 1:] + name =3D "%s_%s" % (wmi_name, version) =20 for line in block[1:]: # expected format: @@ -236,7 +400,13 @@ def parse_class(block): properties.append(Property(type=3Ditems[0], name=3Ditems[1], is_array=3Dis_array)) =20 - return Class(name=3Dname, properties=3Dproperties) + cls =3D WmiClassVersion(name=3Dname, version=3Dversion, properties=3Dp= roperties, + uri_info=3DClassUriInfo(wmi_name, version)) + + if wmi_name in wmi_classes_by_name: + wmi_classes_by_name[wmi_name].versions.append(cls) + else: + wmi_classes_by_name[wmi_name] =3D WmiClass(wmi_name, [cls]) =20 =20 =20 @@ -248,15 +418,13 @@ def main(): input_filename =3D os.path.join(os.getcwd(), "hyperv_wmi_generator= .input") output_dirname =3D os.getcwd() =20 - header =3D open_and_print(os.path.join(output_dirname, "hyperv_wmi.gen= erated.h")) - source =3D open_and_print(os.path.join(output_dirname, "hyperv_wmi.gen= erated.c")) + classes_typedef =3D open_and_print(os.path.join(output_dirname, "hyper= v_wmi_classes.generated.typedef")) classes_header =3D open_and_print(os.path.join(output_dirname, "hyperv= _wmi_classes.generated.h")) classes_source =3D open_and_print(os.path.join(output_dirname, "hyperv= _wmi_classes.generated.c")) =20 - # parse input file + number =3D 0 - classes_by_name =3D {} block =3D None =20 for line in file(input_filename, "rb").readlines(): @@ -268,7 +436,7 @@ def main(): line =3D line.lstrip().rstrip() =20 if len(line) < 1: - continue + continue =20 if line.startswith("class"): if block is not None: @@ -279,31 +447,22 @@ def main(): if block is not None: if line =3D=3D "end": if block[0][1].startswith("class"): - cls =3D parse_class(block) - classes_by_name[cls.name] =3D cls + parse_class(block) =20 block =3D None else: block.append((number, line)) =20 - # write output files - notice =3D "/* Generated by hyperv_wmi_generator.py */\n\n\n\n" - - header.write(notice) - source.write(notice) - classes_typedef.write(notice) - classes_header.write(notice) - classes_source.write(notice) - - names =3D classes_by_name.keys() + names =3D wmi_classes_by_name.keys() names.sort() =20 for name in names: - header.write(classes_by_name[name].generate_header()) - source.write(classes_by_name[name].generate_source()) - classes_typedef.write(classes_by_name[name].generate_classes_typed= ef()) - classes_header.write(classes_by_name[name].generate_classes_header= ()) - classes_source.write(classes_by_name[name].generate_classes_source= ()) + cls =3D wmi_classes_by_name[name] + cls.prepare() + + classes_typedef.write(cls.generate_classes_typedef()) + classes_header.write(cls.generate_classes_header()) + classes_source.write(cls.generate_classes_source()) =20 =20 =20 --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892481355678.8610615600443; Thu, 30 Mar 2017 09:48:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CA589465B; Thu, 30 Mar 2017 16:47:59 +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 9B7A9183C2; Thu, 30 Mar 2017 16:47:59 +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 47CB518523D2; Thu, 30 Mar 2017 16:47:59 +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 v2UGlc9H016963 for ; Thu, 30 Mar 2017 12:47:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 49BDE90EC4; Thu, 30 Mar 2017 16:47:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4251790EC3 for ; Thu, 30 Mar 2017 16:47:38 +0000 (UTC) Received: from mail-qt0-f176.google.com (mail-qt0-f176.google.com [209.85.216.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 AA5FD8F505 for ; Thu, 30 Mar 2017 16:47:35 +0000 (UTC) Received: by mail-qt0-f176.google.com with SMTP id i34so44471499qtc.0 for ; Thu, 30 Mar 2017 09:47:35 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:34 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CA589465B 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=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CA589465B 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="cBY6sUt2" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AA5FD8F505 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AA5FD8F505 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=czI4MvaDo/hpGosNMSaOaf8xmTBAJc6655UCuQlQlJI=; b=cBY6sUt2+QDp9Dx8jo5eMvTvgg1nAdRLqZttxGwhx52LJ4TjI558r2zXLmAn7/Jleh OS4w6jNgaFaUu/VsRDiRXW+Q4J+ApuorAW3+L+xlShnpm+tQE8y0FnDK0xVvSM6GZiwn QhB0Xquf6+iBXZgcjUzqO6+rNh0fdq4U5nxBjo6xFGryK+EoeHEzuQ5wjCzNJaWIAMfV B4/gfoV3Hi8aslzE07Js1O057hggM7Y8/oPyjDSa1oFI7K/h6Dsq8tnDQci/ZJ5H2GSu TL3UKDRuaGHaJMZIoFBtmmI5xXNz050WHFGQOgSdx3vp2s6gjnDUzN5ckrd5PBWRwyv1 4mkw== 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=czI4MvaDo/hpGosNMSaOaf8xmTBAJc6655UCuQlQlJI=; b=AcH9QQPxrVtDDsFVCjwpRNN2W7Mmb0gB+53SYzofsmCq5x9Xj73oG1EHaxT6Jn/BPt M3KW5179R0YUgRGbeUUtwDX/KVaKeBvVJxB/1HzhDWOgdn4sd+kkkJYdhwJuJvLnl42T hDUcQMaQNd8f1DpyQJPT5xCTpVhCt2QYEpKE+5a3CrQnKSpPtedCAu86BwdSM9363c9E njtBL8BMNlvFraxwH0sfozvzXOkjKdTqDx5dTo+wSIVbU5qD8wO+mzSBg7DOuVReSN95 4JLtCmXScgePpb2FN1edUBlIXRwbY9jEyjB4At9E/xtHv6J3o7OmMLNSDALwxYbiplLt lhXA== X-Gm-Message-State: AFeK/H1O4sIAUmnOZUfW+F2rr1Mcp4fLc8JTlvYpL05GiRKNtrji5qBmBAYXMqm5JFWAKYTf X-Received: by 10.237.61.52 with SMTP id g49mr773851qtf.79.1490892454643; Thu, 30 Mar 2017 09:47:34 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:26 -0400 Message-Id: <20170330164728.32215-10-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 30 Mar 2017 16:47:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 30 Mar 2017 16:47:37 +0000 (UTC) for IP:'209.85.216.176' DOMAIN:'mail-qt0-f176.google.com' HELO:'mail-qt0-f176.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.176 mail-qt0-f176.google.com 209.85.216.176 mail-qt0-f176.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 09/11] hyperv: add helper for getting WMI class lists. 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 30 Mar 2017 16:48:00 +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" Those used to be auto-generated and are hand-written now intead. The reason being that those are not very useful and better replacements are in order once the driver itself implements more of the API and common patterns start to emerge. --- src/Makefile.am | 2 - src/hyperv/hyperv_wmi.c | 81 +++++++++++++++++++++++++++++++++++++= ---- src/hyperv/hyperv_wmi.h | 24 +++++++++++- src/hyperv/hyperv_wmi_classes.h | 8 ++++ 4 files changed, 104 insertions(+), 11 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index 75e4344..99f5229 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -910,8 +910,6 @@ HYPERV_DRIVER_SOURCES =3D \ hyperv/openwsman.h =20 HYPERV_DRIVER_GENERATED =3D \ - hyperv/hyperv_wmi.generated.c \ - hyperv/hyperv_wmi.generated.h \ hyperv/hyperv_wmi_classes.generated.c \ hyperv/hyperv_wmi_classes.generated.h \ hyperv/hyperv_wmi_classes.generated.typedef diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index dcd4d7a..498b1ed 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -36,12 +36,6 @@ =20 #define WS_SERIALIZER_FREE_MEM_WORKS 0 =20 -# define ROOT_CIMV2 \ - "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*" - -# define ROOT_VIRTUALIZATION \ - "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/*" - #define VIR_FROM_THIS VIR_FROM_HYPERV =20 static int @@ -79,6 +73,18 @@ hypervGetWmiClassInfo(hypervPrivate *priv, hypervWmiClas= sInfoListPtr list, return -1; } =20 +static int +hypervGetWmiClassList(hypervPrivate *priv, hypervWmiClassInfoListPtr wmiIn= fo, + virBufferPtr query, hypervObject **wmiClass) +{ + hypervWqlQuery wqlQuery =3D HYPERV_WQL_QUERY_INITIALIZER; + + wqlQuery.info =3D wmiInfo; + wqlQuery.query =3D virBufferContentAndReset(query); + + return hypervEnumAndPull(priv, &wqlQuery, wmiClass); +} + int hypervVerifyResponse(WsManClient *client, WsXmlDocH response, const char *detail) @@ -697,5 +703,66 @@ hypervMsvmComputerSystemFromDomain(virDomainPtr domain, } =20 =20 +int +hypervGetMsvmComputerSystemList(hypervPrivate *priv, virBufferPtr query, + Msvm_ComputerSystem **list) +{ + return hypervGetWmiClassList(priv, Msvm_ComputerSystem_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetMsvmConcreteJobList(hypervPrivate *priv, virBufferPtr query, + Msvm_ConcreteJob **list) +{ + return hypervGetWmiClassList(priv, Msvm_ConcreteJob_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetWin32ComputerSystemList(hypervPrivate *priv, virBufferPtr query, + Win32_ComputerSystem **list) +{ + return hypervGetWmiClassList(priv, Win32_ComputerSystem_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetWin32ProcessorList(hypervPrivate *priv, virBufferPtr query, + Win32_Processor **list) +{ + return hypervGetWmiClassList(priv, Win32_Processor_WmiInfo, query, + (hypervObject **) list); +} + + +int +hypervGetMsvmVirtualSystemSettingDataList(hypervPrivate *priv, + virBufferPtr query, + Msvm_VirtualSystemSettingData **= list) +{ + return hypervGetWmiClassList(priv, Msvm_VirtualSystemSettingData_WmiIn= fo, query, + (hypervObject **) list); +} + + +int +hypervGetMsvmProcessorSettingDataList(hypervPrivate *priv, + virBufferPtr query, + Msvm_ProcessorSettingData **list) +{ + return hypervGetWmiClassList(priv, Msvm_ProcessorSettingData_WmiInfo, = query, + (hypervObject **) list); +} + =20 -#include "hyperv_wmi.generated.c" +int +hypervGetMsvmMemorySettingDataList(hypervPrivate *priv, virBufferPtr query, + Msvm_MemorySettingData **list) +{ + return hypervGetWmiClassList(priv, Msvm_MemorySettingData_WmiInfo, que= ry, + (hypervObject **) list); +} diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index 8ce32a9..2d90a3b 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -109,7 +109,29 @@ enum _Msvm_ReturnCode { =20 const char *hypervReturnCodeToString(int returnCode); =20 +/* Generic "Get WMI class list" */ +int hypervGetMsvmComputerSystemList(hypervPrivate *priv, virBufferPtr quer= y, + Msvm_ComputerSystem **list); =20 +int hypervGetMsvmConcreteJobList(hypervPrivate *priv, virBufferPtr query, + Msvm_ConcreteJob **list); + +int hypervGetWin32ComputerSystemList(hypervPrivate *priv, virBufferPtr que= ry, + Win32_ComputerSystem **list); + +int hypervGetWin32ProcessorList(hypervPrivate *priv, virBufferPtr query, + Win32_Processor **list); + +int hypervGetMsvmVirtualSystemSettingDataList(hypervPrivate *priv, + virBufferPtr query, + Msvm_VirtualSystemSettingDat= a **list); + +int hypervGetMsvmProcessorSettingDataList(hypervPrivate *priv, + virBufferPtr query, + Msvm_ProcessorSettingData **list= ); + +int hypervGetMsvmMemorySettingDataList(hypervPrivate *priv, virBufferPtr q= uery, + Msvm_MemorySettingData **list); =20 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *= * * * Msvm_ComputerSystem @@ -133,6 +155,4 @@ int hypervMsvmComputerSystemFromDomain(virDomainPtr dom= ain, =20 =20 =20 -# include "hyperv_wmi.generated.h" - #endif /* __HYPERV_WMI_H__ */ diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classe= s.h index b0f3e3c..0b8e29c 100644 --- a/src/hyperv/hyperv_wmi_classes.h +++ b/src/hyperv/hyperv_wmi_classes.h @@ -28,6 +28,14 @@ # include "hyperv_wmi_classes.generated.typedef" =20 =20 +# define ROOT_CIMV2 \ + "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*" + +# define ROOT_VIRTUALIZATION \ + "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/*" + +# define ROOT_VIRTUALIZATION_V2 \ + "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/virtualization/v2/= *" =20 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *= * * * Msvm_ComputerSystem --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892477526340.3196145281398; Thu, 30 Mar 2017 09:47:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 157F28AE6C; Thu, 30 Mar 2017 16:47:56 +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 DADED77DDE; Thu, 30 Mar 2017 16:47:55 +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 858D218523CF; Thu, 30 Mar 2017 16:47:55 +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 v2UGlcvx016956 for ; Thu, 30 Mar 2017 12:47:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3A15117AFA; Thu, 30 Mar 2017 16:47:38 +0000 (UTC) Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3317F17ADA for ; Thu, 30 Mar 2017 16:47:38 +0000 (UTC) Received: from mail-qk0-f175.google.com (mail-qk0-f175.google.com [209.85.220.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 5F5078F4FB for ; Thu, 30 Mar 2017 16:47:36 +0000 (UTC) Received: by mail-qk0-f175.google.com with SMTP id r142so45347443qke.2 for ; Thu, 30 Mar 2017 09:47:36 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:34 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 157F28AE6C Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx03.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 157F28AE6C 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="RSXA2aA2" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5F5078F4FB Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=datto.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzamirski@datto.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5F5078F4FB 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=ncyUxgDqk9hi/cu3RhCSAgTQR9+33MlbHHXD4m9em4I=; b=RSXA2aA2YWHEZpgpnVrchPvkmiA2k5UxImZD9E+HHMK3hy9qCwJM9N5qk+77UKuiZQ mwPue1/EsTFbzqBuzyEoJ/H3k52IKB/EUsiYn8/Ys7e0HoOjqq2P+S4ov+GPxPNAJjTv Iay20M8tquR4fRDayUC6IkWXefm3HA8izEc1fdiUFJAbOUmOLXmxgTpt88wCRm09CnMc O2UzB2G09fE7xAGsAQhQ597dn5u2PbStJ1VAhZ6TMez2d6iIc0D7fbAYQA4WKTRcte+S OcbTHVxT95PUwFZyTMivz0EsPKu7NeotgM4NXxw8Mmh473jw1Jqst/53GEIJQpksELUq wZcA== 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=ncyUxgDqk9hi/cu3RhCSAgTQR9+33MlbHHXD4m9em4I=; b=S/thdg+9CTAUTUJPKl7mPlbeU7GsoH/Ao2QMuqjxlACAEHGvRw075n5lJCt62VfxBR DJIx2Sq1roz9K0CcsKZTKeL9oO6GyREX3AIBws1LneF27ICV4lDXlrRBx6LVtiM4zUjr 0DUd/wD4BGLbK2tPyNneSDIK0WlZ3ANPfFBBGqSn7hZuN51s/tW2P2ecsJ3WjhzC4E/3 66Wo/r5Gi1G6mVxhqbVJmBORAr4LrbDV1G7LcGgxbnvfef3DxLS2AQUphVshmTUwXuO5 uQ2XPpVM4BRzP6VORMXo19ClytpLbHvb1xHZnFUkQbE+xsjAtLWmVL4yU9eaAUQ6eSen 51Jw== X-Gm-Message-State: AFeK/H3SAQCgnxRjH1ygmdpbs1HCRRIM3yrIoFCQb/Wyg5noLemiYKxT6pMHvsK4Zn1cndYL X-Received: by 10.55.133.193 with SMTP id h184mr699034qkd.205.1490892455116; Thu, 30 Mar 2017 09:47:35 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:27 -0400 Message-Id: <20170330164728.32215-11-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 30 Mar 2017 16:47:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 30 Mar 2017 16:47:36 +0000 (UTC) for IP:'209.85.220.175' DOMAIN:'mail-qk0-f175.google.com' HELO:'mail-qk0-f175.google.com' FROM:'dzamirski@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.175 mail-qk0-f175.google.com 209.85.220.175 mail-qk0-f175.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 10/11] hyperv: port rest of the driver to new stucts. 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 30 Mar 2017 16:47:56 +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" basically s/data->/data.common->/ Because the data member of hypervObject is a union, get the data via the "common" member everywhere - existing driver does not require special handling for v1 vs v2 separately. --- src/hyperv/hyperv_driver.c | 76 +++++++++++++++++++++++-------------------= ---- src/hyperv/hyperv_wmi.c | 21 ++++++++----- 2 files changed, 51 insertions(+), 46 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index b642a02..5d01c1f 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -240,7 +240,7 @@ hypervConnectGetHostname(virConnectPtr conn) goto cleanup; } =20 - ignore_value(VIR_STRDUP(hostname, computerSystem->data->DNSHostName)); + ignore_value(VIR_STRDUP(hostname, computerSystem->data.common->DNSHost= Name)); =20 cleanup: hypervFreeObject(priv, (hypervObject *)computerSystem); @@ -282,7 +282,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr in= fo) "{Win32_ComputerSystem.Name=3D\"%s\"} " "where AssocClass =3D Win32_ComputerSystemProcessor " "ResultClass =3D Win32_Processor", - computerSystem->data->Name); + computerSystem->data.common->Name); =20 if (hypervGetWin32ProcessorList(priv, &query, &processorList) < 0) goto cleanup; @@ -295,7 +295,7 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr in= fo) } =20 /* Strip the string to fit more relevant information in 32 chars */ - tmp =3D processorList->data->Name; + tmp =3D processorList->data.common->Name; =20 while (*tmp !=3D '\0') { if (STRPREFIX(tmp, " ")) { @@ -313,16 +313,16 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr = info) } =20 /* Fill struct */ - if (virStrncpy(info->model, processorList->data->Name, + if (virStrncpy(info->model, processorList->data.common->Name, sizeof(info->model) - 1, sizeof(info->model)) =3D=3D NU= LL) { virReportError(VIR_ERR_INTERNAL_ERROR, _("CPU model %s too long for destination"), - processorList->data->Name); + processorList->data.common->Name); goto cleanup; } =20 - info->memory =3D computerSystem->data->TotalPhysicalMemory / 1024; /* = byte to kilobyte */ - info->mhz =3D processorList->data->MaxClockSpeed; + info->memory =3D computerSystem->data.common->TotalPhysicalMemory / 10= 24; /* byte to kilobyte */ + info->mhz =3D processorList->data.common->MaxClockSpeed; info->nodes =3D 1; info->sockets =3D 0; =20 @@ -331,8 +331,8 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr in= fo) ++info->sockets; } =20 - info->cores =3D processorList->data->NumberOfCores; - info->threads =3D info->cores / processorList->data->NumberOfLogicalPr= ocessors; + info->cores =3D processorList->data.common->NumberOfCores; + info->threads =3D info->cores / processorList->data.common->NumberOfLo= gicalProcessors; info->cpus =3D info->sockets * info->cores; =20 result =3D 0; @@ -372,7 +372,7 @@ hypervConnectListDomains(virConnectPtr conn, int *ids, = int maxids) =20 for (computerSystem =3D computerSystemList; computerSystem !=3D NULL; computerSystem =3D computerSystem->next) { - ids[count++] =3D computerSystem->data->ProcessID; + ids[count++] =3D computerSystem->data.common->ProcessID; =20 if (count >=3D maxids) break; @@ -532,7 +532,7 @@ hypervDomainSuspend(virDomainPtr domain) if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) goto cleanup; =20 - if (computerSystem->data->EnabledState !=3D + if (computerSystem->data.common->EnabledState !=3D MSVM_COMPUTERSYSTEM_ENABLEDSTATE_ENABLED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not active")); @@ -560,7 +560,7 @@ hypervDomainResume(virDomainPtr domain) if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) goto cleanup; =20 - if (computerSystem->data->EnabledState !=3D + if (computerSystem->data.common->EnabledState !=3D MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not paused")); @@ -666,7 +666,7 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoP= tr info) virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not lookup %s for domain %s"), "Msvm_VirtualSystemSettingData", - computerSystem->data->ElementName); + computerSystem->data.common->ElementName); goto cleanup; } =20 @@ -676,7 +676,7 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoP= tr info) "{Msvm_VirtualSystemSettingData.InstanceID=3D\"%s\"}= " "where AssocClass =3D Msvm_VirtualSystemSettingDataC= omponent " "ResultClass =3D Msvm_ProcessorSettingData", - virtualSystemSettingData->data->InstanceID); + virtualSystemSettingData->data.common->InstanceID); =20 if (hypervGetMsvmProcessorSettingDataList(priv, &query, &processorSettingData) < 0) { @@ -687,7 +687,7 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoP= tr info) virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not lookup %s for domain %s"), "Msvm_ProcessorSettingData", - computerSystem->data->ElementName); + computerSystem->data.common->ElementName); goto cleanup; } =20 @@ -697,7 +697,7 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoP= tr info) "{Msvm_VirtualSystemSettingData.InstanceID=3D\"%s\"}= " "where AssocClass =3D Msvm_VirtualSystemSettingDataC= omponent " "ResultClass =3D Msvm_MemorySettingData", - virtualSystemSettingData->data->InstanceID); + virtualSystemSettingData->data.common->InstanceID); =20 if (hypervGetMsvmMemorySettingDataList(priv, &query, &memorySettingData) < 0) { @@ -709,15 +709,15 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInf= oPtr info) virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not lookup %s for domain %s"), "Msvm_MemorySettingData", - computerSystem->data->ElementName); + computerSystem->data.common->ElementName); goto cleanup; } =20 /* Fill struct */ info->state =3D hypervMsvmComputerSystemEnabledStateToDomainState(comp= uterSystem); - info->maxMem =3D memorySettingData->data->Limit * 1024; /* megabyte to= kilobyte */ - info->memory =3D memorySettingData->data->VirtualQuantity * 1024; /* m= egabyte to kilobyte */ - info->nrVirtCpu =3D processorSettingData->data->VirtualQuantity; + info->maxMem =3D memorySettingData->data.common->Limit * 1024; /* mega= byte to kilobyte */ + info->memory =3D memorySettingData->data.common->VirtualQuantity * 102= 4; /* megabyte to kilobyte */ + info->nrVirtCpu =3D processorSettingData->data.common->VirtualQuantity; info->cpuTime =3D 0; =20 result =3D 0; @@ -803,7 +803,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned in= t flags) virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not lookup %s for domain %s"), "Msvm_VirtualSystemSettingData", - computerSystem->data->ElementName); + computerSystem->data.common->ElementName); goto cleanup; } =20 @@ -813,7 +813,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned in= t flags) "{Msvm_VirtualSystemSettingData.InstanceID=3D\"%s\"}= " "where AssocClass =3D Msvm_VirtualSystemSettingDataC= omponent " "ResultClass =3D Msvm_ProcessorSettingData", - virtualSystemSettingData->data->InstanceID); + virtualSystemSettingData->data.common->InstanceID); =20 if (hypervGetMsvmProcessorSettingDataList(priv, &query, &processorSettingData) < 0) { @@ -824,7 +824,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned in= t flags) virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not lookup %s for domain %s"), "Msvm_ProcessorSettingData", - computerSystem->data->ElementName); + computerSystem->data.common->ElementName); goto cleanup; } =20 @@ -834,7 +834,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned in= t flags) "{Msvm_VirtualSystemSettingData.InstanceID=3D\"%s\"}= " "where AssocClass =3D Msvm_VirtualSystemSettingDataC= omponent " "ResultClass =3D Msvm_MemorySettingData", - virtualSystemSettingData->data->InstanceID); + virtualSystemSettingData->data.common->InstanceID); =20 if (hypervGetMsvmMemorySettingDataList(priv, &query, &memorySettingData) < 0) { @@ -846,7 +846,7 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned in= t flags) virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not lookup %s for domain %s"), "Msvm_MemorySettingData", - computerSystem->data->ElementName); + computerSystem->data.common->ElementName); goto cleanup; } =20 @@ -854,34 +854,34 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned = int flags) def->virtType =3D VIR_DOMAIN_VIRT_HYPERV; =20 if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) { - def->id =3D computerSystem->data->ProcessID; + def->id =3D computerSystem->data.common->ProcessID; } else { def->id =3D -1; } =20 - if (virUUIDParse(computerSystem->data->Name, def->uuid) < 0) { + if (virUUIDParse(computerSystem->data.common->Name, def->uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not parse UUID from string '%s'"), - computerSystem->data->Name); + computerSystem->data.common->Name); return NULL; } =20 - if (VIR_STRDUP(def->name, computerSystem->data->ElementName) < 0) + if (VIR_STRDUP(def->name, computerSystem->data.common->ElementName) < = 0) goto cleanup; =20 - if (VIR_STRDUP(def->description, virtualSystemSettingData->data->Notes= ) < 0) + if (VIR_STRDUP(def->description, virtualSystemSettingData->data.common= ->Notes) < 0) goto cleanup; =20 - virDomainDefSetMemoryTotal(def, memorySettingData->data->Limit * 1024)= ; /* megabyte to kilobyte */ - def->mem.cur_balloon =3D memorySettingData->data->VirtualQuantity * 10= 24; /* megabyte to kilobyte */ + virDomainDefSetMemoryTotal(def, memorySettingData->data.common->Limit = * 1024); /* megabyte to kilobyte */ + def->mem.cur_balloon =3D memorySettingData->data.common->VirtualQuanti= ty * 1024; /* megabyte to kilobyte */ =20 if (virDomainDefSetVcpusMax(def, - processorSettingData->data->VirtualQuantit= y, + processorSettingData->data.common->Virtual= Quantity, NULL) < 0) goto cleanup; =20 if (virDomainDefSetVcpus(def, - processorSettingData->data->VirtualQuantity) = < 0) + processorSettingData->data.common->VirtualQua= ntity) < 0) goto cleanup; =20 def->os.type =3D VIR_DOMAIN_OSTYPE_HVM; @@ -930,7 +930,7 @@ hypervConnectListDefinedDomains(virConnectPtr conn, cha= r **const names, int maxn =20 for (computerSystem =3D computerSystemList; computerSystem !=3D NULL; computerSystem =3D computerSystem->next) { - if (VIR_STRDUP(names[count], computerSystem->data->ElementName) < = 0) + if (VIR_STRDUP(names[count], computerSystem->data.common->ElementN= ame) < 0) goto cleanup; =20 ++count; @@ -1154,7 +1154,7 @@ hypervDomainHasManagedSaveImage(virDomainPtr domain, = unsigned int flags) if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) goto cleanup; =20 - result =3D computerSystem->data->EnabledState =3D=3D + result =3D computerSystem->data.common->EnabledState =3D=3D MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED ? 1 : 0; =20 cleanup: @@ -1177,7 +1177,7 @@ hypervDomainManagedSaveRemove(virDomainPtr domain, un= signed int flags) if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) goto cleanup; =20 - if (computerSystem->data->EnabledState !=3D + if (computerSystem->data.common->EnabledState !=3D MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain has no managed save image")); @@ -1280,7 +1280,7 @@ hypervConnectListAllDomains(virConnectPtr conn, =20 /* managed save filter */ if (MATCH(VIR_CONNECT_LIST_DOMAINS_FILTERS_MANAGEDSAVE)) { - bool mansave =3D computerSystem->data->EnabledState =3D=3D + bool mansave =3D computerSystem->data.common->EnabledState =3D= =3D MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED; =20 if (!((MATCH(VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE) && mansave)= || diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 498b1ed..831bcb3 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -437,6 +437,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDom= ainPtr domain, virBuffer query =3D VIR_BUFFER_INITIALIZER; Msvm_ConcreteJob *concreteJob =3D NULL; bool completed =3D false; + const char *resourceUri =3D MSVM_COMPUTERSYSTEM_V2_RESOURCE_URI; + =20 virUUIDFormat(domain->uuid, uuid_string); =20 @@ -445,6 +447,9 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDom= ainPtr domain, virAsprintf(&properties, "RequestedState=3D%d", requestedState) < = 0) goto cleanup; =20 + if (priv->wmiVersion =3D=3D HYPERV_WMI_VERSION_V1) + resourceUri =3D MSVM_COMPUTERSYSTEM_V2_RESOURCE_URI; + options =3D wsmc_options_init(); =20 if (options =3D=3D NULL) { @@ -457,7 +462,7 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDom= ainPtr domain, wsmc_add_prop_from_str(options, properties); =20 /* Invoke method */ - response =3D wsmc_action_invoke(priv->client, MSVM_COMPUTERSYSTEM_RESO= URCE_URI, + response =3D wsmc_action_invoke(priv->client, resourceUri, options, "RequestStateChange", NULL); =20 if (hypervVerifyResponse(priv->client, response, "invocation") < 0) @@ -506,7 +511,7 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDom= ainPtr domain, goto cleanup; } =20 - switch (concreteJob->data->JobState) { + switch (concreteJob->data.common->JobState) { case MSVM_CONCRETEJOB_JOBSTATE_NEW: case MSVM_CONCRETEJOB_JOBSTATE_STARTING: case MSVM_CONCRETEJOB_JOBSTATE_RUNNING: @@ -565,7 +570,7 @@ int hypervMsvmComputerSystemEnabledStateToDomainState (Msvm_ComputerSystem *computerSystem) { - switch (computerSystem->data->EnabledState) { + switch (computerSystem->data.common->EnabledState) { case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_UNKNOWN: return VIR_DOMAIN_NOSTATE; =20 @@ -605,7 +610,7 @@ hypervIsMsvmComputerSystemActive(Msvm_ComputerSystem *c= omputerSystem, if (in_transition !=3D NULL) *in_transition =3D false; =20 - switch (computerSystem->data->EnabledState) { + switch (computerSystem->data.common->EnabledState) { case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_UNKNOWN: return false; =20 @@ -649,20 +654,20 @@ hypervMsvmComputerSystemToDomain(virConnectPtr conn, return -1; } =20 - if (virUUIDParse(computerSystem->data->Name, uuid) < 0) { + if (virUUIDParse(computerSystem->data.common->Name, uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Could not parse UUID from string '%s'"), - computerSystem->data->Name); + computerSystem->data.common->Name); return -1; } =20 - *domain =3D virGetDomain(conn, computerSystem->data->ElementName, uuid= ); + *domain =3D virGetDomain(conn, computerSystem->data.common->ElementNam= e, uuid); =20 if (*domain =3D=3D NULL) return -1; =20 if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) { - (*domain)->id =3D computerSystem->data->ProcessID; + (*domain)->id =3D computerSystem->data.common->ProcessID; } else { (*domain)->id =3D -1; } --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 18 22:39:59 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 1490892687698555.265430702889; Thu, 30 Mar 2017 09:51:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3FDB02E6040; Thu, 30 Mar 2017 16:51:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0FE5B8764B; Thu, 30 Mar 2017 16:51:26 +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 A93AB5EC60; Thu, 30 Mar 2017 16:51:25 +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 v2UGldUS016970 for ; Thu, 30 Mar 2017 12:47:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 867AD5B829; Thu, 30 Mar 2017 16:47:39 +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 7DBBA7EA37 for ; Thu, 30 Mar 2017 16:47:37 +0000 (UTC) Received: from mail-qk0-f172.google.com (mail-qk0-f172.google.com [209.85.220.172]) (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 8228FC034E78 for ; Thu, 30 Mar 2017 16:47:36 +0000 (UTC) Received: by mail-qk0-f172.google.com with SMTP id p22so45129920qka.3 for ; Thu, 30 Mar 2017 09:47:36 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id j1sm1730322qkf.57.2017.03.30.09.47.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Mar 2017 09:47:35 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3FDB02E6040 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 3FDB02E6040 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="0lpbT6ku" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8228FC034E78 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 8228FC034E78 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=D8p9vNNUtmo6lI1CYiZDJuKlQ/a2jvTbY3nojzB7P8g=; b=0lpbT6kuVzSvsGBy9KkBEQyRHvuJ5p3DXgdc0m9djSdj6VxG6tjwWnsgOR547Gkquj jewSIaq9bM3RGJuP6tlEzXYWtGwV2lJIyaL5eS9JzKdy64Xvwbg5xBUQ3njFlr/bdtel Ld8KfjmgIAPMm0jZNp86qit5Qv/I9Yc0RF6X9S1VJL+b0X3pFQscRlO9yzvcYqpn4J+q wGMcFahG1t1Si7pgZm8mVKVmqZ2hys9CdoauKzHuW6fMdxJ2E3jnSo5gZkdNzBAF/Mfh n5s96qRqd1rqC/A5+iwfh9FyOtsPSlmXX8M6sNstK3kJwsXEA7ZZfYT6H7Pv+DcDQaFo 3dbw== 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=D8p9vNNUtmo6lI1CYiZDJuKlQ/a2jvTbY3nojzB7P8g=; b=uCHhHrUraChWAIW8JHnJ1sJSBTvfDbvdHBC4+gNnyWOMbTc+N1qUHMzPIcXXxTEJJw kjZMAj5W+bT0NDuoKKmvxXv16cXiLnQqwgWOC7wZ8D6DSz12cdWrsGv0LeR5Cojqq0r+ l4WHb/CkPj49Udn2WlywQJhjSTFhykGivmE2eGkp6GDUSSjtwivwGeERs3glIGksHvvv 2lqEkZa/ymUAtKKqny30gElppQjlyXI0aXWsMVnm1LxyDT1cSyeIsqJ9fd7ySz0Ps4zA uSW51V0VEpis/cGValbo//AFgq/OHq8AHLgr569jsm4mJ1omdDyyJAz7ystXNwBHij1z 6jDw== X-Gm-Message-State: AFeK/H0hf/Kfzit5UkhhUEU7SLRc33SjNaQHR8hpmFkCyo0g8PK/MYIpFbbZP+Qlb8D5E8/a X-Received: by 10.55.7.149 with SMTP id 143mr661146qkh.186.1490892455604; Thu, 30 Mar 2017 09:47:35 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Thu, 30 Mar 2017 12:47:28 -0400 Message-Id: <20170330164728.32215-12-dzamirski@datto.com> In-Reply-To: <20170330164728.32215-1-dzamirski@datto.com> References: <20170330164728.32215-1-dzamirski@datto.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 30 Mar 2017 16:47:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 30 Mar 2017 16:47:36 +0000 (UTC) for IP:'209.85.220.172' DOMAIN:'mail-qk0-f172.google.com' HELO:'mail-qk0-f172.google.com' FROM:'dzamirski@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.172 mail-qk0-f172.google.com 209.85.220.172 mail-qk0-f172.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: Sri Ramanujam Subject: [libvirt] [PATCH 11/11] hyperv: add hypervInitConnection. 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 30 Mar 2017 16:51:27 +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" This function detects hyperv version by issuing a simple query using "v2" namespace and falling back to "v1". --- src/hyperv/hyperv_driver.c | 92 ++++++++++++++++++++++++++++--------------= ---- 1 file changed, 56 insertions(+), 36 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 5d01c1f..0913517 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -55,7 +55,62 @@ hypervFreePrivate(hypervPrivate **priv) VIR_FREE(*priv); } =20 +static int +hypervInitConnection(virConnectPtr conn, hypervPrivate *priv, + char *username, char *password) +{ + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + hypervWqlQuery query =3D HYPERV_WQL_QUERY_INITIALIZER; + hypervObject *computerSystem =3D NULL; + int ret =3D -1; =20 + /* Initialize the openwsman connection */ + priv->client =3D wsmc_create(conn->uri->server, conn->uri->port, "/wsm= an", + priv->parsedUri->transport, username, passw= ord); + + if (priv->client =3D=3D NULL) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not create openwsman client")); + goto cleanup; + } + + if (wsmc_transport_init(priv->client, NULL) !=3D 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not initialize openwsman transport")); + goto cleanup; + } + + /* FIXME: Currently only basic authentication is supported */ + wsman_transport_set_auth_method(priv->client, "basic"); + + virBufferAddLit(&buf, MSVM_COMPUTERSYSTEM_WQL_SELECT); + virBufferAddLit(&buf, "WHERE "); + virBufferAddLit(&buf, MSVM_COMPUTERSYSTEM_WQL_PHYSICAL); + + query.query =3D virBufferContentAndReset(&buf); + query.info =3D Msvm_ComputerSystem_WmiInfo; + + /* try query using V2 namespace (for Hyperv 2012+) */ + priv->wmiVersion =3D HYPERV_WMI_VERSION_V2; + + if (hypervEnumAndPull(priv, &query, &computerSystem) < 0) { + /* fall back to V1 namespace (for Hyper-v 2008) */ + priv->wmiVersion =3D HYPERV_WMI_VERSION_V1; + + if (hypervEnumAndPull(priv, &query, &computerSystem) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s is not a Hyper-V server"), conn->uri->ser= ver); + goto cleanup; + } + } + + ret =3D 0; + + cleanup: + hypervFreeObject(priv, computerSystem); + + return ret; +} =20 static virDrvOpenStatus hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, @@ -67,8 +122,6 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr = auth, hypervPrivate *priv =3D NULL; char *username =3D NULL; char *password =3D NULL; - virBuffer query =3D VIR_BUFFER_INITIALIZER; - Msvm_ComputerSystem *computerSystem =3D NULL; =20 virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); =20 @@ -147,41 +200,9 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPt= r auth, goto cleanup; } =20 - /* Initialize the openwsman connection */ - priv->client =3D wsmc_create(conn->uri->server, conn->uri->port, "/wsm= an", - priv->parsedUri->transport, username, passw= ord); - - if (priv->client =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not create openwsman client")); - goto cleanup; - } - - if (wsmc_transport_init(priv->client, NULL) !=3D 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Could not initialize openwsman transport")); - goto cleanup; - } - - /* FIXME: Currently only basic authentication is supported */ - wsman_transport_set_auth_method(priv->client, "basic"); - - /* Check if the connection can be established and if the server has the - * Hyper-V role installed. If the call to hypervGetMsvmComputerSystemL= ist - * succeeds than the connection has been established. If the returned = list - * is empty than the server isn't a Hyper-V server. */ - virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_SELECT); - virBufferAddLit(&query, "where "); - virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_PHYSICAL); - - if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) - goto cleanup; =20 - if (computerSystem =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("%s is not a Hyper-V server"), conn->uri->server); + if (hypervInitConnection(conn, priv, username, password) < 0) goto cleanup; - } =20 conn->privateData =3D priv; priv =3D NULL; @@ -191,7 +212,6 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr= auth, hypervFreePrivate(&priv); VIR_FREE(username); VIR_FREE(password); - hypervFreeObject(priv, (hypervObject *)computerSystem); =20 return result; } --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list