[PATCH 0/2] hyperv: bump minimum openwsman version to 2.6.3

As Daniel mentioned in the thread for my commit "hyperv: make Msvm_ComputerSystem WQL queries locale agnostic", we can increase the minimum openwsman version since all the supported distributions have at least version 2.6.3. Comments about older versions have been removed throughout the codebase. Also, openwsman.h has been removed entirely, since its original purpose was to work around bugs in earlier (now unsupported) openwsman versions. Matt Coleman (2): hyperv: bump minimum openwsman version to 2.6.3 hyperv: remove openwsman.h libvirt.spec.in | 2 +- meson.build | 2 +- src/hyperv/hyperv_driver.c | 5 +--- src/hyperv/hyperv_private.h | 3 ++- src/hyperv/hyperv_wmi.c | 12 +++------ src/hyperv/hyperv_wmi.h | 1 - src/hyperv/hyperv_wmi_classes.h | 3 ++- src/hyperv/openwsman.h | 47 --------------------------------- 8 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 src/hyperv/openwsman.h -- 2.27.0

Bug fixes and comments specific to older versions have been removed. Signed-off-by: Matt Coleman <matt@datto.com> --- libvirt.spec.in | 2 +- meson.build | 2 +- src/hyperv/hyperv_driver.c | 4 +--- src/hyperv/hyperv_wmi.c | 8 -------- src/hyperv/openwsman.h | 21 ++------------------- 5 files changed, 5 insertions(+), 32 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 29f34f673a..80563ce6ef 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -363,7 +363,7 @@ BuildRequires: netcf-devel >= 0.2.2 BuildRequires: libcurl-devel %endif %if %{with_hyperv} -BuildRequires: libwsman-devel >= 2.2.3 +BuildRequires: libwsman-devel >= 2.6.3 %endif BuildRequires: audit-libs-devel # we need /usr/sbin/dtrace diff --git a/meson.build b/meson.build index a5ce8e17a8..d0e977f7bd 100644 --- a/meson.build +++ b/meson.build @@ -1207,7 +1207,7 @@ if numactl_dep.found() conf.set('WITH_NUMACTL', 1) endif -openwsman_version = '2.2.3' +openwsman_version = '2.6.3' openwsman_dep = dependency('openwsman', version: '>=' + openwsman_version, required: get_option('openwsman')) parallels_sdk_version = '7.0.22' diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index dcde469442..7db6802a55 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -383,10 +383,8 @@ hypervFreePrivate(hypervPrivate **priv) if (priv == NULL || *priv == NULL) return; - if ((*priv)->client != NULL) { - /* FIXME: This leaks memory due to bugs in openwsman <= 2.2.6 */ + if ((*priv)->client != NULL) wsmc_release((*priv)->client); - } if ((*priv)->caps) virObjectUnref((*priv)->caps); diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index b233dab58d..6d0445184a 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -1082,8 +1082,6 @@ hypervEnumAndPull(hypervPrivate *priv, hypervWqlQueryPtr wqlQuery, if (data != NULL) { #if WS_SERIALIZER_FREE_MEM_WORKS - /* FIXME: ws_serializer_free_mem is broken in openwsman <= 2.2.6, - * see hypervFreeObject for a detailed explanation. */ if (ws_serializer_free_mem(serializerContext, data, wmiInfo->serializerInfo) < 0) { VIR_ERROR(_("Could not free deserialized data")); @@ -1118,12 +1116,6 @@ hypervFreeObject(hypervPrivate *priv G_GNUC_UNUSED, hypervObject *object) next = object->next; #if WS_SERIALIZER_FREE_MEM_WORKS - /* FIXME: ws_serializer_free_mem is broken in openwsman <= 2.2.6, - * but this is not that critical, because openwsman keeps - * track of all allocations of the deserializer and frees - * them in wsmc_release. So this doesn't result in a real - * memory leak, but just in piling up unused memory until - * the connection is closed. */ if (ws_serializer_free_mem(serializerContext, object->data.common, object->info->serializerInfo) < 0) { VIR_ERROR(_("Could not free deserialized data")); diff --git a/src/hyperv/openwsman.h b/src/hyperv/openwsman.h index cd7660ac2e..c59c450ea6 100644 --- a/src/hyperv/openwsman.h +++ b/src/hyperv/openwsman.h @@ -21,27 +21,10 @@ #pragma once -/* Workaround openwsman <= 2.2.6 unconditionally defining optarg. Just pretend - * that u/os.h was already included. Need to explicitly include time.h because - * wsman-xml-serializer.h needs it and u/os.h would have included it. */ -#include <time.h> -#define _LIBU_OS_H_ #include <wsman-api.h> -/* wsman-xml-serializer.h in openwsman <= 2.2.6 is missing this defines */ -#ifndef SER_NS_INT8 -# define SER_NS_INT8(ns, n, x) SER_NS_INT8_FLAGS(ns, n, x, 0) -#endif -#ifndef SER_NS_INT16 -# define SER_NS_INT16(ns, n, x) SER_NS_INT16_FLAGS(ns, n, x, 0) -#endif -#ifndef SER_NS_INT32 -# define SER_NS_INT32(ns, n, x) SER_NS_INT32_FLAGS(ns, n, x, 0) -#endif -#ifndef SER_NS_INT64 -# define SER_NS_INT64(ns, n, x) SER_NS_INT64_FLAGS(ns, n, x, 0) -#endif - /* wsman-xml.h */ WsXmlDocH ws_xml_create_doc(const char *rootNsUri, const char *rootName); + +/* wsman-xml-binding.h */ WsXmlNodeH xml_parser_get_root(WsXmlDocH doc); -- 2.27.0

This header's main purpose was to work around bugs in older versions of openwsman. Most of the files using it only needed wsman-api.h, which they now include directly. Signed-off-by: Matt Coleman <matt@datto.com> --- src/hyperv/hyperv_driver.c | 1 - src/hyperv/hyperv_private.h | 3 ++- src/hyperv/hyperv_wmi.c | 4 +++- src/hyperv/hyperv_wmi.h | 1 - src/hyperv/hyperv_wmi_classes.h | 3 ++- src/hyperv/openwsman.h | 30 ------------------------------ 6 files changed, 7 insertions(+), 35 deletions(-) delete mode 100644 src/hyperv/openwsman.h diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 7db6802a55..2ac30fa4c6 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -34,7 +34,6 @@ #include "hyperv_private.h" #include "hyperv_util.h" #include "hyperv_wmi.h" -#include "openwsman.h" #include "virstring.h" #include "virkeycode.h" #include "domain_conf.h" diff --git a/src/hyperv/hyperv_private.h b/src/hyperv/hyperv_private.h index cf08bf542b..b31cb616af 100644 --- a/src/hyperv/hyperv_private.h +++ b/src/hyperv/hyperv_private.h @@ -22,10 +22,11 @@ #pragma once +#include <wsman-api.h> + #include "internal.h" #include "virerror.h" #include "hyperv_util.h" -#include "openwsman.h" #include "capabilities.h" typedef enum _hypervWmiVersion hypervWmiVersion; diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c index 6d0445184a..2b40e72053 100644 --- a/src/hyperv/hyperv_wmi.c +++ b/src/hyperv/hyperv_wmi.c @@ -24,7 +24,10 @@ */ #include <config.h> + #include <wsman-soap.h> +#include <wsman-xml.h> +#include <wsman-xml-binding.h> #include "internal.h" #include "virerror.h" @@ -35,7 +38,6 @@ #include "hyperv_private.h" #include "hyperv_wmi.h" #include "virstring.h" -#include "openwsman.h" #include "virlog.h" #include "virxml.h" diff --git a/src/hyperv/hyperv_wmi.h b/src/hyperv/hyperv_wmi.h index 8c9c5ed9c1..ee16657768 100644 --- a/src/hyperv/hyperv_wmi.h +++ b/src/hyperv/hyperv_wmi.h @@ -26,7 +26,6 @@ #include "virbuffer.h" #include "hyperv_private.h" #include "hyperv_wmi_classes.h" -#include "openwsman.h" #include "virhash.h" diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classes.h index 7465684d6e..d32711589a 100644 --- a/src/hyperv/hyperv_wmi_classes.h +++ b/src/hyperv/hyperv_wmi_classes.h @@ -23,8 +23,9 @@ #pragma once +#include <wsman-api.h> + #include "internal.h" -#include "openwsman.h" #include "hyperv_wmi_classes.generated.typedef" diff --git a/src/hyperv/openwsman.h b/src/hyperv/openwsman.h deleted file mode 100644 index c59c450ea6..0000000000 --- a/src/hyperv/openwsman.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * openwsman.h: workarounds for bugs in openwsman - * - * Copyright (C) 2011 Matthias Bolte <matthias.bolte@googlemail.com> - * - * 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 - * <http://www.gnu.org/licenses/>. - * - */ - -#pragma once - -#include <wsman-api.h> - -/* wsman-xml.h */ -WsXmlDocH ws_xml_create_doc(const char *rootNsUri, const char *rootName); - -/* wsman-xml-binding.h */ -WsXmlNodeH xml_parser_get_root(WsXmlDocH doc); -- 2.27.0

On 10/9/20 9:46 AM, Matt Coleman wrote:
As Daniel mentioned in the thread for my commit "hyperv: make Msvm_ComputerSystem WQL queries locale agnostic", we can increase the minimum openwsman version since all the supported distributions have at least version 2.6.3.
Comments about older versions have been removed throughout the codebase.
Also, openwsman.h has been removed entirely, since its original purpose was to work around bugs in earlier (now unsupported) openwsman versions.
Matt Coleman (2): hyperv: bump minimum openwsman version to 2.6.3 hyperv: remove openwsman.h
libvirt.spec.in | 2 +- meson.build | 2 +- src/hyperv/hyperv_driver.c | 5 +--- src/hyperv/hyperv_private.h | 3 ++- src/hyperv/hyperv_wmi.c | 12 +++------ src/hyperv/hyperv_wmi.h | 1 - src/hyperv/hyperv_wmi_classes.h | 3 ++- src/hyperv/openwsman.h | 47 --------------------------------- 8 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 src/hyperv/openwsman.h
Reviewed-by: Michal Privoznik <mprivozn@redhat.com> and pushed. Michal

On Fri, Oct 9, 2020 at 3:47 AM Matt Coleman <mcoleman@datto.com> wrote:
As Daniel mentioned in the thread for my commit "hyperv: make Msvm_ComputerSystem WQL queries locale agnostic", we can increase the minimum openwsman version since all the supported distributions have at least version 2.6.3.
Comments about older versions have been removed throughout the codebase.
Also, openwsman.h has been removed entirely, since its original purpose was to work around bugs in earlier (now unsupported) openwsman versions.
Matt Coleman (2): hyperv: bump minimum openwsman version to 2.6.3 hyperv: remove openwsman.h
libvirt.spec.in | 2 +- meson.build | 2 +- src/hyperv/hyperv_driver.c | 5 +--- src/hyperv/hyperv_private.h | 3 ++- src/hyperv/hyperv_wmi.c | 12 +++------ src/hyperv/hyperv_wmi.h | 1 - src/hyperv/hyperv_wmi_classes.h | 3 ++- src/hyperv/openwsman.h | 47 --------------------------------- 8 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 src/hyperv/openwsman.h
-- 2.27.0
Series LGTM. Reviewed-by: Neal Gompa <ngompa13@gmail.com> -- 真実はいつも一つ!/ Always, there's only one truth!

On Wed, Oct 14, 2020 at 9:28 PM Neal Gompa <ngompa13@gmail.com> wrote:
On Fri, Oct 9, 2020 at 3:47 AM Matt Coleman <mcoleman@datto.com> wrote:
As Daniel mentioned in the thread for my commit "hyperv: make Msvm_ComputerSystem WQL queries locale agnostic", we can increase the minimum openwsman version since all the supported distributions have at least version 2.6.3.
Comments about older versions have been removed throughout the codebase.
Also, openwsman.h has been removed entirely, since its original purpose was to work around bugs in earlier (now unsupported) openwsman versions.
Matt Coleman (2): hyperv: bump minimum openwsman version to 2.6.3 hyperv: remove openwsman.h
libvirt.spec.in | 2 +- meson.build | 2 +- src/hyperv/hyperv_driver.c | 5 +--- src/hyperv/hyperv_private.h | 3 ++- src/hyperv/hyperv_wmi.c | 12 +++------ src/hyperv/hyperv_wmi.h | 1 - src/hyperv/hyperv_wmi_classes.h | 3 ++- src/hyperv/openwsman.h | 47 --------------------------------- 8 files changed, 10 insertions(+), 65 deletions(-) delete mode 100644 src/hyperv/openwsman.h
-- 2.27.0
Series LGTM.
Reviewed-by: Neal Gompa <ngompa13@gmail.com>
Blech, ignore this, the threading was broken due to the auto-marking as spam and I didn't know this was already pushed... -- 真実はいつも一つ!/ Always, there's only one truth!
participants (3)
-
Matt Coleman
-
Michal Privoznik
-
Neal Gompa