Accepting request 815801 from home:kallan:branches:Virtualization:VMware

- jsc#ECO-2164 for update 11.1.0 (build 16036546) (boo#1171764)
  with new 'Service Discovery' plugin (boo#1171765).
- Reenabled building sdmp in the spec file.
- Added patches (boo#1171765)
  + sdmp-get-version.patch
  + sdmp-netstat-to-ss.patch
  + sdmp-warnings.patch

OBS-URL: https://build.opensuse.org/request/show/815801
OBS-URL: https://build.opensuse.org/package/show/Virtualization:VMware/open-vm-tools?expand=0&rev=395
This commit is contained in:
Kirk Allan 2020-06-18 19:45:41 +00:00 committed by Git OBS Bridge
parent 47de722243
commit 4511903876
5 changed files with 182 additions and 14 deletions

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Thu Jun 18 18:10:23 UTC 2020 - Kirk Allan <kallan@suse.com>
- jsc#ECO-2164 for update 11.1.0 (build 16036546) (boo#1171764)
with new 'Service Discovery' plugin (boo#1171765).
- Reenabled building sdmp in the spec file.
- Added patches (boo#1171765)
+ sdmp-get-version.patch
+ sdmp-netstat-to-ss.patch
+ sdmp-warnings.patch
-------------------------------------------------------------------
Wed Jun 17 14:12:18 UTC 2020 - Kirk Allan <kallan@suse.com>

View File

@ -37,11 +37,6 @@
# X modules are lower prio upstream and once in a while fail. Offer an easy way to enable/disable them.
%define with_X 1
# VMware has asked to not build the service discovery plugin until they have
# removed the netstat dependency.
%define with_sdmp 0
%define arg_servicediscovery --without-servicediscovery
Name: open-vm-tools
%define subname open-vm-tools
%define tarname open-vm-tools
@ -142,6 +137,9 @@ ExclusiveArch: %ix86 x86_64
#Upstream patches
Patch0: gcc10-warning.patch
Patch1: pam-vmtoolsd.patch
Patch2: sdmp-warnings.patch
Patch3: sdmp-get-version.patch
Patch4: sdmp-netstat-to-ss.patch
%if 0%{?suse_version} >= 1500
%systemd_ordering
@ -190,7 +188,6 @@ This package contains only the user-space programs and libraries of
machines.
%endif
%if %{with_sdmp}
%package sdmp
Summary: Service Discovery Plugin
Group: System Environment/Libraries
@ -198,7 +195,6 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
%description sdmp
Service Discovery Plugin
%endif
%package -n libvmtools0
Summary: Open Virtual Machine Tools - shared library
@ -225,6 +221,9 @@ sed -i -e "s/\r//" README
#Upstream patches
%patch0 -p2
%patch1 -p2
%patch2 -p2
%patch3 -p2
%patch4 -p2
%build
%if %{with_X}
@ -260,7 +259,7 @@ chmod 755 configure
%{?arg_xerces} \
--with-udev-rules-dir=%{_udevrulesdir} \
--enable-resolutionkms \
%{?arg_servicediscovery} \
--enable-servicediscovery \
--disable-static
make
@ -358,10 +357,8 @@ install -D -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/modprobe.d/50-vmnics.co
%endif
%if %{with_sdmp}
%post sdmp
systemctl try-restart vmtoolsd.service || :
%endif
%preun
%service_del_preun vmtoolsd.service
@ -383,11 +380,9 @@ fi
%endif
/sbin/ldconfig
%if %{with_sdmp}
%postun sdmp
# restart tools without plugin
systemctl try-restart vmtoolsd.service || :
%endif
%post -n libvmtools0 -p /sbin/ldconfig
@ -482,7 +477,6 @@ rm -rf %{buildroot}
%endif
%if %{with_sdmp}
%files sdmp
%dir %{_libdir}/%{name}/serviceDiscovery/
%dir %{_libdir}/%{name}/serviceDiscovery/scripts/
@ -491,7 +485,6 @@ rm -rf %{buildroot}
%{_libdir}/%{name}/serviceDiscovery/scripts/get-listening-process-info.sh
%{_libdir}/%{name}/serviceDiscovery/scripts/get-listening-process-perf-metrics.sh
%{_libdir}/%{name}/serviceDiscovery/scripts/get-versions.sh
%endif
%files -n libvmtools0
%defattr(-, root, root)

44
sdmp-get-version.patch Normal file
View File

@ -0,0 +1,44 @@
commit 99a1a5ea0db308b88301f3c37c8458a255b8c473
Author: Oliver Kurth <okurth@vmware.com>
Date: Tue May 26 15:32:58 2020 -0700
serviceDiscovery: Updating 'get-versions.sh' script
The following changes have been made:
1. Environment variable 'ALIVE_BASE' is used to construct the path of
the file where vcops version is stored. The variable is not avialable
when running the script inside serviceDiscovery plugin process, so a
hardcoded path is used.
2. Added command to retrieve tcserver version
diff --git a/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh b/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh
index 496c95eb..b74d1715 100644
--- a/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh
+++ b/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh
@@ -23,7 +23,7 @@ get_version() {
}
get_vcops_version() {
- cat $ALIVE_BASE/user/conf/lastbuildversion.txt 2>/dev/null
+ cat /usr/lib/vmware-vcops/user/conf/lastbuildversion.txt 2>/dev/null
}
get_srm_mgt_server_version() {
@@ -76,10 +76,15 @@ get_db2_version() {
db2level 2>/dev/null | grep "DB2 v"
}
+get_tcserver_version() {
+ command -v tcserver >/dev/null 2>&1 && { tcserver version 2>/dev/null; }
+}
+
echo VERSIONSTART "vcops_version" "$(get_vcops_version)" VERSIONEND
echo VERSIONSTART "srm_mgt_server_version" "$(get_srm_mgt_server_version)" VERSIONEND
echo VERSIONSTART "vcenter_appliance_version" "$(get_vcenter_appliance_version)" VERSIONEND
echo VERSIONSTART "db2_version" "$(get_db2_version)" VERSIONEND
+echo VERSIONSTART "tcserver_version" "$(get_tcserver_version)" VERSIONEND
get_version "/\S+/(httpd-prefork|httpd|httpd2-prefork)($|\s)" -v
get_version "/usr/(bin|sbin)/apache\S*" -v

95
sdmp-netstat-to-ss.patch Normal file
View File

@ -0,0 +1,95 @@
commit 64db1c0ccf1b6f5fb705a5d32778991d2e8ea7a8
Author: Oliver Kurth <okurth@vmware.com>
Date: Thu Jun 11 20:43:21 2020 -0700
ServiceDiscovery: Replacing deprecated 'netstat' command with 'ss'
Updating the Linux serviceDiscovery scripts to use "ss" in place of
the deprecated "netstat" command.
diff --git a/open-vm-tools/services/plugins/serviceDiscovery/get-connection-info.sh b/open-vm-tools/services/plugins/serviceDiscovery/get-connection-info.sh
index 1694514a..0fc89c62 100644
--- a/open-vm-tools/services/plugins/serviceDiscovery/get-connection-info.sh
+++ b/open-vm-tools/services/plugins/serviceDiscovery/get-connection-info.sh
@@ -1,16 +1,16 @@
#!/bin/sh
# check if necesary commands exist
-command -v netstat >/dev/null 2>&1 || { echo >&2 "netstat doesn't exist"; exit 1; }
+command -v ss >/dev/null 2>&1 || { echo >&2 "ss doesn't exist"; exit 1; }
command -v grep >/dev/null 2>&1 || { echo >&2 "grep doesn't exist"; exit 1; }
command -v sort >/dev/null 2>&1 || { echo >&2 "sort doesn't exist"; exit 1; }
command -v tr >/dev/null 2>&1 || { echo >&2 "tr doesn't exist"; exit 1; }
# get pids of listening processes
-space_separated_pids=$(netstat -lntup | grep -Eo "[0-9]+/" | sort -u)
+space_separated_pids=$(ss -lntup | grep -Eo "pid=[0-9]+" | sort -u)
# grep pattern
pattern=$(echo $space_separated_pids | tr ' ' '|')
# get matching lines
-netstat -antup | grep -E $pattern
+ss -antup | grep -E $pattern
diff --git a/open-vm-tools/services/plugins/serviceDiscovery/get-listening-process-info.sh b/open-vm-tools/services/plugins/serviceDiscovery/get-listening-process-info.sh
index 173b1c04..d7a10200 100644
--- a/open-vm-tools/services/plugins/serviceDiscovery/get-listening-process-info.sh
+++ b/open-vm-tools/services/plugins/serviceDiscovery/get-listening-process-info.sh
@@ -1,14 +1,14 @@
#!/bin/sh
# check if necesary commands exist
-command -v netstat >/dev/null 2>&1 || { echo >&2 "netstat doesn't exist"; exit 1; }
+command -v ss >/dev/null 2>&1 || { echo >&2 "ss doesn't exist"; exit 1; }
command -v grep >/dev/null 2>&1 || { echo >&2 "grep doesn't exist"; exit 1; }
command -v sort >/dev/null 2>&1 || { echo >&2 "sort doesn't exist"; exit 1; }
command -v tr >/dev/null 2>&1 || { echo >&2 "tr doesn't exist"; exit 1; }
command -v ps >/dev/null 2>&1 || { echo >&2 "ps doesn't exist"; exit 1; }
# get pids of listening processes
-space_separated_pids=$(netstat -lntup | grep -Eo "[0-9]+/" | grep -Eo "[0-9]*" | sort -u)
+space_separated_pids=$(ss -lntup | grep -Eo "pid=[0-9]+" | grep -Eo "[0-9]*" | sort -u)
# ps accepts comma separated pids
comma_separated_pids=$(echo $space_separated_pids | tr ' ' ',')
diff --git a/open-vm-tools/services/plugins/serviceDiscovery/get-listening-process-perf-metrics.sh b/open-vm-tools/services/plugins/serviceDiscovery/get-listening-process-perf-metrics.sh
index ad83762d..9a694d4c 100644
--- a/open-vm-tools/services/plugins/serviceDiscovery/get-listening-process-perf-metrics.sh
+++ b/open-vm-tools/services/plugins/serviceDiscovery/get-listening-process-perf-metrics.sh
@@ -1,7 +1,7 @@
#!/bin/sh
# check if necesary commands exist
-command -v netstat >/dev/null 2>&1 || { echo >&2 "netstat doesn't exist"; exit 1; }
+command -v ss >/dev/null 2>&1 || { echo >&2 "ss doesn't exist"; exit 1; }
command -v grep >/dev/null 2>&1 || { echo >&2 "grep doesn't exist"; exit 1; }
command -v sort >/dev/null 2>&1 || { echo >&2 "sort doesn't exist"; exit 1; }
command -v awk >/dev/null 2>&1 || { echo >&2 "awk doesn't exist"; exit 1; }
@@ -108,6 +108,6 @@ get_performance_metrics() {
run $pids
}
-space_separated_pids=$(netstat -lntup | grep -Eo "[0-9]+/" | grep -Eo "[0-9]+" | sort -u)
+space_separated_pids=$(ss -lntup | grep -Eo "pid=[0-9]+" | grep -Eo "[0-9]+" | sort -u)
get_performance_metrics $space_separated_pids
\ No newline at end of file
diff --git a/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh b/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh
index b74d1715..c7a1e7cf 100644
--- a/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh
+++ b/open-vm-tools/services/plugins/serviceDiscovery/get-versions.sh
@@ -1,12 +1,12 @@
#!/bin/sh
# check if necesary commands exist
-command -v netstat >/dev/null 2>&1 || { echo >&2 "netstat doesn't exist"; exit 1; }
+command -v ss >/dev/null 2>&1 || { echo >&2 "ss doesn't exist"; exit 1; }
command -v grep >/dev/null 2>&1 || { echo >&2 "grep doesn't exist"; exit 1; }
command -v sort >/dev/null 2>&1 || { echo >&2 "sort doesn't exist"; exit 1; }
command -v ps >/dev/null 2>&1 || { echo >&2 "ps doesn't exist"; exit 1; }
-space_separated_pids=$(netstat -lntup | grep -Eo "[0-9]+/" | grep -Eo "[0-9]*" | sort -u)
+space_separated_pids=$(ss -lntup | grep -Eo "pid=[0-9]+" | grep -Eo "[0-9]*" | sort -u)
get_command_line() {
ps --pid $1 -o command

25
sdmp-warnings.patch Normal file
View File

@ -0,0 +1,25 @@
commit 2141bda9c0c424b8a1407940642676b2b8d53499
Author: Oliver Kurth <okurth@vmware.com>
Date: Wed Jun 10 12:05:45 2020 -0700
SDMP plugin logs warning message every 5 minute if there is no
Namespace DB instance created on a VM. Changing the log level to
debug to solve the problem.
diff --git a/open-vm-tools/services/plugins/serviceDiscovery/serviceDiscovery.c b/open-vm-tools/services/plugins/serviceDiscovery/serviceDiscovery.c
index 87dd5893..c6c2e1dc 100644
--- a/open-vm-tools/services/plugins/serviceDiscovery/serviceDiscovery.c
+++ b/open-vm-tools/services/plugins/serviceDiscovery/serviceDiscovery.c
@@ -381,9 +381,9 @@ ReadData(ToolsAppCtx *ctx,
status = SendRpcMessage(ctx, DynBuf_Get(&buf), DynBuf_GetSize(&buf),
resultData, resultDataLen);
if (!status) {
- g_warning("%s: Read over RPC failed, result: %s, resultDataLen: %" FMTSZ
- "u\n", __FUNCTION__, (*resultData != NULL) ?
- *resultData : "(null)", *resultDataLen);
+ g_debug("%s: Read over RPC failed, result: %s, resultDataLen: %" FMTSZ
+ "u\n", __FUNCTION__, (*resultData != NULL) ?
+ *resultData : "(null)", *resultDataLen);
}
done:
DynBuf_Destroy(&buf);