Changes of Revision 3
[+] | Deleted | _service:download_src_package:rhevm-guest-agent.spec |
@@ -1,619 +0,0 @@ - -%global release_version 4 - -%global _ovirt_version 1.0.9 -%global _moduledir /%{_lib}/security -%global _kdmrc /etc/kde/kdm/kdmrc -%global RHEV_AGENT_RUNNING /tmp/rhev-agent-running - -Name: rhevm-guest-agent -Version: 1.0.9 -Release: %{release_version}%{?dist} -Summary: RHEV-M Guest Agent -Group: Applications/System -License: ASL 2.0 -URL: http://wiki.ovirt.org/wiki/Category:Ovirt_guest_agent -Source0: http://evilissimo.fedorapeople.org/releases/ovirt-guest-agent/%{version}/ovirt-guest-agent-%{_ovirt_version}.tar.bz2 -BuildRequires: libtool -BuildRequires: pam-devel -BuildRequires: python2-devel - -%package common -Summary: RHEV-M Guest Agent -BuildArch: noarch -Requires: dbus-python -Requires: rpm-python -Requires: python-ethtool >= 0.4-1 -Requires: udev >= 095-14.23 -Requires: usermode -Requires: tuned >= 0.2.19-10 -Requires: qemu-guest-agent -Provides: %{name} = %{version}-%{release} -Obsoletes: rhev-agent -Obsoletes: rhevm-guest-agent - -Conflicts: selinux-policy < 3.7.19-188 - -Patch1: 0001-plugins-use-rhev-m-in-authentication-s-dialogs-bz-84.patch -Patch2: 0002-agent-updated-conf-file-and-replaced-ini-file-name.patch -Patch3: 0000-Adding-missing-unit-test-files.patch -Patch9: 0012-agent-Implement-basics-for-API-Versioning.patch -Patch10: 0013-agent-Report-number-of-CPU-cores-visible-online-on-t.patch -Patch11: 0014-agent-setNumberOfCPUs-support.patch -Patch12: 0015-Implement-default-configuration-values.patch -Patch13: 0016-Fix-SSO-on-RHEL6.patch - -%package pam-module -Summary: PAM module for the oVirt Guest Agent -Requires: %{name} = %{version}-%{release} -Requires: pam -Obsoletes: rhev-agent-pam-rhev-cred - -%package gdm-plugin -Summary: GDM plug-in for the oVirt Guest Agent -# No gdm-devel package is available for plug-in development. So for now -# we build the gdm package. -%if 0%{?rhel} -Source1: gdm-2.30.4-48.el6.src.rpm - -%define gdm_version gdm-2.30.4 -%define gdm_release %{gdm_version}-48.el6 - -%define libauditver 1.0.6 -%define pango_version 1.2.0 -%define gtk2_version 2.6.0 -%define libglade2_version 2.0.0 -%define libgnomeui_version 2.2.0 -%define scrollkeeper_version 0.3.4 -%define pam_version 0.99.8.1-11 -%define desktop_file_utils_version 0.2.90 -%define gail_version 1.2.0 -%define nss_version 3.11.1 -%define consolekit_version 0.3.0-9 -%define hal_version 0.5.9 -%define fontconfig_version 2.6.0 - -# The following requirements were copied from the gdm.spec file. -BuildRequires: pkgconfig(libcanberra-gtk) -BuildRequires: scrollkeeper >= 0:%{scrollkeeper_version} -BuildRequires: pango-devel >= 0:%{pango_version} -BuildRequires: gtk2-devel >= 0:%{gtk2_version} -BuildRequires: libglade2-devel >= 0:%{libglade2_version} -BuildRequires: libgnomeui-devel >= 0:%{libgnomeui_version} -BuildRequires: pam-devel >= 0:%{pam_version} -BuildRequires: fontconfig >= 0:%{fontconfig_version} -BuildRequires: desktop-file-utils >= %{desktop_file_utils_version} -BuildRequires: gail-devel >= 0:%{gail_version} -BuildRequires: libtool automake autoconf -BuildRequires: libattr-devel -BuildRequires: gettext -BuildRequires: gnome-doc-utils -BuildRequires: libdmx-devel -BuildRequires: audit-libs-devel >= %{libauditver} -BuildRequires: autoconf automake libtool -BuildRequires: intltool -%ifnarch s390 s390x -BuildRequires: xorg-x11-server-Xorg -%endif -BuildRequires: nss-devel >= %{nss_version} -BuildRequires: ConsoleKit -BuildRequires: libselinux-devel -BuildRequires: check-devel -BuildRequires: iso-codes-devel -BuildRequires: gnome-panel-devel -BuildRequires: libxklavier-devel >= 4.0 -BuildRequires: DeviceKit-power-devel >= 008 -BuildRequires: pkgconfig(libgnomekbdui) -BuildRequires: pkgconfig(libxklavier) -BuildRequires: libXdmcp-devel -%else -BuildRequires: dbus-glib-devel -BuildRequires: gdm-devel -BuildRequires: gobject-introspection-devel -BuildRequires: gtk2-devel -%endif -Requires: %{name} = %{version}-%{release} -Requires: %{name}-pam-module = %{version}-%{release} -Requires: gdm -Obsoletes: rhev-agent-gdm-plugin-rhevcred - -%package kdm-plugin -Summary: KDM plug-in for the oVirt Guest Agent -BuildRequires: kdebase-workspace-devel -Requires: %{name} = %{version}-%{release} -Requires: %{name}-pam-module = %{version}-%{release} -Requires: kdm -Obsoletes: rhev-agent-kdm-plugin-rhevcred - -%description -This is the oVirt management agent running inside the guest. The agent -interfaces with the oVirt manager, supplying heart-beat info as well as -run-time data from within the guest itself. The agent also accepts -control commands to be run executed within the OS (like: shutdown and -restart). - -%description common -This is the oVirt management agent running inside the guest. The agent -interfaces with the oVirt manager, supplying heart-beat info as well as -run-time data from within the guest itself. The agent also accepts -control commands to be run executed within the OS (like: shutdown and -restart). - -%description pam-module -The oVirt PAM module provides the functionality necessary to use the -oVirt automatic log-in system. - -%description gdm-plugin -The GDM plug-in provides the functionality necessary to use the -oVirt automatic log-in system. - -%description kdm-plugin -The KDM plug-in provides the functionality necessary to use the -oVirt automatic log-in system. - -%prep -%setup -q -n ovirt-guest-agent-%{version} - -%patch1 -p1 -%patch2 -p1 -%patch3 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 - -sed -i s/AM_PROG_AR/#AM_PROG_AR/ge configure.ac - -cp -f gdm2-plugin/gdm2-Makefile.am gdm-plugin/Makefile.am -cp -f gdm2-plugin/gdm-ovirtcred-extension.c gdm-plugin/ -cp -f gdm2-plugin/gdm-ovirtcred-extension.h gdm-plugin/ -cp -f gdm2-plugin/plugin.c gdm-plugin/ - -rpmbuild --define="_topdir %{_topdir}" --recompile %{SOURCE1} - -autoreconf -i -f - -%build -%configure \ - --enable-securedir=%{_moduledir} \ - --includedir=%{_includedir}/security \ - --with-gdm-src-dir=%{_topdir}/BUILD/%{gdm_version} \ - --with-simple-greeter-plugins-dir=%{_libdir}/gdm/simple-greeter/plugins \ - --with-pam-prefix=%{_sysconfdir} - -make %{?_smp_mflags} - -%install -# libtool will look for this file when relinking during installation. -mkdir -p %{buildroot}%{_libdir} -cp %{_topdir}/BUILDROOT/%{gdm_release}.%{?_arch}%{_libdir}/libgdmsimplegreeter.so \ - %{buildroot}%{_libdir} - -sed -i "s~parent->setObjectName(\"welcome\");~parent->setObjectName(\"talker\");~" kdm-plugin/src/kgreet_ovirtcred.cpp - -make install DESTDIR=%{buildroot} - -# Install SystemV init script. -install -Dm 0755 ovirt-guest-agent/ovirt-guest-agent %{buildroot}%{_initrddir}/ovirt-guest-agent - | ||
[-] | Added | rhevm-guest-agent.spec ^ |
x 1
2 + 3 +%global release_version 4 4 + 5 +%global _ovirt_version 1.0.9 6 +%global _moduledir /%{_lib}/security 7 +%global _kdmrc /etc/kde/kdm/kdmrc 8 +%global RHEV_AGENT_RUNNING /tmp/rhev-agent-running 9 + 10 +Name: rhevm-guest-agent 11 +Version: 1.0.9 12 +Release: 1 13 +Summary: RHEV-M Guest Agent 14 +Group: Applications/System 15 +License: ASL 2.0 16 +URL: http://wiki.ovirt.org/wiki/Category:Ovirt_guest_agent 17 +Source0: http://evilissimo.fedorapeople.org/releases/ovirt-guest-agent/%{version}/ovirt-guest-agent-%{_ovirt_version}.tar.bz2 18 +BuildRequires: libtool 19 +BuildRequires: pam-devel 20 +BuildRequires: python2-devel 21 + 22 +%package common 23 +Summary: RHEV-M Guest Agent 24 +BuildArch: noarch 25 +Requires: dbus-python 26 +Requires: rpm-python 27 +Requires: python-ethtool 28 +Requires: udev 29 +Requires: usermode 30 +Requires: tuned >= 0.2.19-10 31 +Requires: qemu-guest-agent 32 +Provides: %{name} = %{version}-%{release} 33 +Obsoletes: rhev-agent 34 +Obsoletes: rhevm-guest-agent 35 + 36 +Conflicts: selinux-policy < 3.7.19-188 37 + 38 +Patch1: 0001-plugins-use-rhev-m-in-authentication-s-dialogs-bz-84.patch 39 +Patch2: 0002-agent-updated-conf-file-and-replaced-ini-file-name.patch 40 +Patch3: 0000-Adding-missing-unit-test-files.patch 41 +Patch9: 0012-agent-Implement-basics-for-API-Versioning.patch 42 +Patch10: 0013-agent-Report-number-of-CPU-cores-visible-online-on-t.patch 43 +Patch11: 0014-agent-setNumberOfCPUs-support.patch 44 +Patch12: 0015-Implement-default-configuration-values.patch 45 +Patch13: 0016-Fix-SSO-on-RHEL6.patch 46 + 47 +%package pam-module 48 +Summary: PAM module for the oVirt Guest Agent 49 +Requires: %{name} = %{version}-%{release} 50 +Requires: pam 51 +Obsoletes: rhev-agent-pam-rhev-cred 52 + 53 +%package gdm-plugin 54 +Summary: GDM plug-in for the oVirt Guest Agent 55 +# No gdm-devel package is available for plug-in development. So for now 56 +# we build the gdm package. 57 +%if 0%{?rhel} 58 +Source1: gdm-2.30.4-48.el6.src.rpm 59 + 60 +%define gdm_version gdm-2.30.4 61 +%define gdm_release %{gdm_version}-48.el6 62 + 63 +%define libauditver 1.0.6 64 +%define pango_version 1.2.0 65 +%define gtk2_version 2.6.0 66 +%define libglade2_version 2.0.0 67 +%define libgnomeui_version 2.2.0 68 +%define scrollkeeper_version 0.3.4 69 +%define pam_version 0.99.8.1-11 70 +%define desktop_file_utils_version 0.2.90 71 +%define gail_version 1.2.0 72 +%define nss_version 3.11.1 73 +%define consolekit_version 0.3.0-9 74 +%define hal_version 0.5.9 75 +%define fontconfig_version 2.6.0 76 + 77 +# The following requirements were copied from the gdm.spec file. 78 +BuildRequires: pkgconfig(libcanberra-gtk) 79 +BuildRequires: scrollkeeper >= 0:%{scrollkeeper_version} 80 +BuildRequires: pango-devel >= 0:%{pango_version} 81 +BuildRequires: gtk2-devel >= 0:%{gtk2_version} 82 +BuildRequires: libglade2-devel >= 0:%{libglade2_version} 83 +BuildRequires: libgnomeui-devel >= 0:%{libgnomeui_version} 84 +BuildRequires: pam-devel >= 0:%{pam_version} 85 +BuildRequires: fontconfig >= 0:%{fontconfig_version} 86 +BuildRequires: desktop-file-utils >= %{desktop_file_utils_version} 87 +BuildRequires: gail-devel >= 0:%{gail_version} 88 +BuildRequires: libtool automake autoconf 89 +BuildRequires: libattr-devel 90 +BuildRequires: gettext 91 +BuildRequires: gnome-doc-utils 92 +BuildRequires: libdmx-devel 93 +BuildRequires: audit-libs-devel >= %{libauditver} 94 +BuildRequires: autoconf automake libtool 95 +BuildRequires: intltool 96 +%ifnarch s390 s390x 97 +BuildRequires: xorg-x11-server-Xorg 98 +%endif 99 +BuildRequires: nss-devel >= %{nss_version} 100 +BuildRequires: ConsoleKit 101 +BuildRequires: libselinux-devel 102 +BuildRequires: check-devel 103 +BuildRequires: iso-codes-devel 104 +BuildRequires: gnome-panel-devel 105 +BuildRequires: libxklavier-devel >= 4.0 106 +BuildRequires: DeviceKit-power-devel >= 008 107 +BuildRequires: pkgconfig(libgnomekbdui) 108 +BuildRequires: pkgconfig(libxklavier) 109 +BuildRequires: libXdmcp-devel 110 +%else 111 +BuildRequires: dbus-glib-devel 112 +BuildRequires: gdm-devel 113 +BuildRequires: gobject-introspection-devel 114 +BuildRequires: gtk2-devel 115 +%endif 116 +Requires: %{name} = %{version}-%{release} 117 +Requires: %{name}-pam-module = %{version}-%{release} 118 +Requires: gdm 119 +Obsoletes: rhev-agent-gdm-plugin-rhevcred 120 + 121 +%package kdm-plugin 122 +Summary: KDM plug-in for the oVirt Guest Agent 123 +BuildRequires: kdebase-workspace-devel 124 +Requires: %{name} = %{version}-%{release} 125 +Requires: %{name}-pam-module = %{version}-%{release} 126 +Requires: kdm 127 +Obsoletes: rhev-agent-kdm-plugin-rhevcred 128 + 129 +%description 130 +This is the oVirt management agent running inside the guest. The agent 131 +interfaces with the oVirt manager, supplying heart-beat info as well as 132 +run-time data from within the guest itself. The agent also accepts 133 +control commands to be run executed within the OS (like: shutdown and 134 +restart). 135 + 136 +%description common 137 +This is the oVirt management agent running inside the guest. The agent 138 +interfaces with the oVirt manager, supplying heart-beat info as well as 139 +run-time data from within the guest itself. The agent also accepts 140 +control commands to be run executed within the OS (like: shutdown and 141 +restart). 142 + 143 +%description pam-module 144 +The oVirt PAM module provides the functionality necessary to use the 145 +oVirt automatic log-in system. 146 + 147 +%description gdm-plugin 148 +The GDM plug-in provides the functionality necessary to use the 149 +oVirt automatic log-in system. 150 + 151 +%description kdm-plugin 152 +The KDM plug-in provides the functionality necessary to use the 153 +oVirt automatic log-in system. 154 + 155 +%prep 156 +%setup -q -n ovirt-guest-agent-%{version} 157 + 158 +%patch1 -p1 159 +%patch2 -p1 160 +%patch3 -p1 161 +%patch9 -p1 162 +%patch10 -p1 163 +%patch11 -p1 164 +%patch12 -p1 165 +%patch13 -p1 166 + 167 +sed -i s/AM_PROG_AR/#AM_PROG_AR/ge configure.ac 168 + 169 +cp -f gdm2-plugin/gdm2-Makefile.am gdm-plugin/Makefile.am 170 +cp -f gdm2-plugin/gdm-ovirtcred-extension.c gdm-plugin/ 171 +cp -f gdm2-plugin/gdm-ovirtcred-extension.h gdm-plugin/ 172 +cp -f gdm2-plugin/plugin.c gdm-plugin/ 173 + 174 +rpmbuild --define="_topdir %{_topdir}" --recompile %{SOURCE1} 175 + 176 +autoreconf -i -f 177 + 178 +%build 179 +%configure \ 180 + --enable-securedir=%{_moduledir} \ 181 + --includedir=%{_includedir}/security \ 182 + --with-gdm-src-dir=%{_topdir}/BUILD/%{gdm_version} \ 183 + --with-simple-greeter-plugins-dir=%{_libdir}/gdm/simple-greeter/plugins \ 184 + --with-pam-prefix=%{_sysconfdir} 185 + 186 +make %{?_smp_mflags} 187 + 188 +%install 189 +# libtool will look for this file when relinking during installation. 190 +mkdir -p %{buildroot}%{_libdir} 191 +cp %{_topdir}/BUILDROOT/%{gdm_release}.%{?_arch}%{_libdir}/libgdmsimplegreeter.so \ 192 + %{buildroot}%{_libdir} 193 + 194 +sed -i "s~parent->setObjectName(\"welcome\");~parent->setObjectName(\"talker\");~" kdm-plugin/src/kgreet_ovirtcred.cpp 195 + 196 +make install DESTDIR=%{buildroot} 197 + 198 +# Install SystemV init script. 199 +install -Dm 0755 ovirt-guest-agent/ovirt-guest-agent %{buildroot}%{_initrddir}/ovirt-guest-agent 200 + 201 |
||
[+] | Added | 0000-Adding-missing-unit-test-files.patch ^ |
@@ -0,0 +1,494 @@ +From 7bd2232b7827eb886cb18b5ea62cf2a4f31a540e Mon Sep 17 00:00:00 2001 +From: Vinzenz Feenstra <vfeenstr@redhat.com> +Date: Thu, 15 May 2014 14:49:57 +0200 +Subject: [PATCH] Adding missing unit test files + +Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> +--- + tests/encoding_test.py | 45 ++++++++++ + tests/guest_agent_test.py | 93 ++++++++++++++++++++ + tests/message_validator.py | 210 +++++++++++++++++++++++++++++++++++++++++++++ + tests/test_port.py | 26 ++++++ + tests/testrunner.py | 68 +++++++++++++++ + 5 files changed, 442 insertions(+) + create mode 100644 tests/encoding_test.py + create mode 100644 tests/guest_agent_test.py + create mode 100644 tests/message_validator.py + create mode 100644 tests/test_port.py + create mode 100644 tests/testrunner.py + +diff --git a/tests/encoding_test.py b/tests/encoding_test.py +new file mode 100644 +index 0000000..770bcb6 +--- /dev/null ++++ b/tests/encoding_test.py +@@ -0,0 +1,45 @@ ++#! /usr/bin/env python ++# -*- coding: utf-8 -*- ++# vim:fenc=utf-8 ++ ++from testrunner import GuestAgentTestCase as TestCaseBase ++from VirtIoChannel import _filter_object ++ ++ ++class EncodingTest(TestCaseBase): ++ ++ def testNonUnicodeKeyInput(self): ++ non_unicode_key = {'non-unicode-key': u'unicode value'} ++ self.assertEquals({u'non-unicode-key': u'unicode value'}, ++ _filter_object(non_unicode_key)) ++ ++ def testNonUnicodeValueInput(self): ++ non_unicode_value = {u'unicode-key': 'non-unicode value'} ++ self.assertEquals({u'unicode-key': u'non-unicode value'}, ++ _filter_object(non_unicode_value)) ++ ++ def testWindowsFailureOnValidValue(self): ++ VALID = u'\u0F65' ++ self.assertEquals(VALID, _filter_object(VALID)) ++ ++ def testNullChar(self): ++ non_unicode_value = {u'unicode-key': '\x00'} ++ self.assertEquals({u'unicode-key': u'\ufffd'}, ++ _filter_object(non_unicode_value)) ++ ++ def testIllegalUnicodeInput(self): ++ ILLEGAL_DATA = {u'foo': u'\x00data\x00test\uffff\ufffe\udc79\ud800'} ++ EXPECTED = {u'foo': u'\ufffddata\ufffdtest\ufffd\ufffd\ufffd\ufffd'} ++ self.assertEqual(EXPECTED, _filter_object(ILLEGAL_DATA)) ++ ++ def testIllegalUnicodeCharacters(self): ++ INVALID = (u'\u0000', u'\ufffe', u'\uffff', u'\ud800', u'\udc79', ++ u'\U00000000', '\x00', '\x01', '\x02', '\x03', '\x04', ++ '\x05') ++ for invchar in INVALID: ++ self.assertEqual(u'\ufffd', _filter_object(invchar)) ++ ++ def testLegalUnicodeCharacters(self): ++ LEGAL = (u'\u2122', u'Hello World') ++ for legalchar in LEGAL: ++ self.assertEqual(legalchar, _filter_object(legalchar)) +diff --git a/tests/guest_agent_test.py b/tests/guest_agent_test.py +new file mode 100644 +index 0000000..b3939ad +--- /dev/null ++++ b/tests/guest_agent_test.py +@@ -0,0 +1,93 @@ ++#! /usr/bin/env python ++# -*- coding: utf-8 -*- ++# vim:fenc=utf-8 ++ ++ ++from ConfigParser import ConfigParser ++import platform ++ ++from message_validator import MessageValidator ++from testrunner import GuestAgentTestCase ++ ++import test_port ++ ++ ++def _linux_setup_test(conf): ++ port_name = 'linux-functional-test-port' ++ conf.set('general', 'applications_list', ++ 'kernel ovirt-guest-agent xorg-x11-drv-qxl ' ++ 'linux-image xserver-xorg-video-qxl') ++ conf.set('general', 'ignored_fs', ++ 'rootfs tmpfs autofs cgroup selinuxfs udev mqueue ' ++ 'nfds proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts ' ++ 'securityfs debugfs binfmt_misc fuse.gvfsd-fuse ' ++ 'fuse.gvfs-fuse-daemon fusectl usbfs') ++ from GuestAgentLinux2 import LinuxVdsAgent ++ return port_name, LinuxVdsAgent ++ ++ ++def _win32_setup_test(conf): ++ port_name = "windows-functional-test-port" ++ from GuestAgentWin32 import WinVdsAgent ++ return port_name, WinVdsAgent ++ ++ ++class FunctionalTest(GuestAgentTestCase): ++ def setUp(self): ++ self._config = ConfigParser() ++ self._config.add_section('general') ++ self._config.add_section('virtio') ++ ++ agent_class = None ++ if platform.system() in ['Windows', 'Microsoft']: ++ self._vport_name, agent_class = _win32_setup_test(self._config) ++ else: ++ self._vport_name, agent_class = _linux_setup_test(self._config) ++ ++ self._validator = MessageValidator(self._vport_name) ++ self._vport = self._validator.port() ++ test_port.add_test_port(self._vport_name, self._vport) ++ ++ self._config.set('general', 'heart_beat_rate', '5') ++ self._config.set('general', 'report_user_rate', '10') ++ self._config.set('general', 'report_application_rate', '120') ++ self._config.set('general', 'report_disk_usage', '300') ++ self._config.set('virtio', 'device', self._vport_name) ++ ++ self.vdsAgent = agent_class(self._config) ++ ++ def testSendInfo(self): ++ self._validator.verifySendInfo(self.vdsAgent) ++ ++ def testSendAppList(self): ++ self._validator.verifySendAppList(self.vdsAgent) ++ ++ def testSendDisksUsages(self): ++ self._validator.verifySendDisksUsages(self.vdsAgent) ++ ++ def testSendMemoryStats(self): ++ self._validator.verifySendMemoryStats(self.vdsAgent) ++ ++ def testSendFQDN(self): ++ self._validator.verifySendFQDN(self.vdsAgent) ++ ++ def testSendUserInfo(self): ++ self._validator.verifySendUserInfo(self.vdsAgent) ++ ++ def testSessionLogon(self): ++ self._validator.verifySessionLogon(self.vdsAgent) ++ ++ def testSessionLogoff(self): ++ self._validator.verifySessionLogon(self.vdsAgent) ++ ++ def testSessionLock(self): ++ self._validator.verifySessionLock(self.vdsAgent) ++ ++ def testSessionUnlock(self): ++ self._validator.verifySessionUnlock(self.vdsAgent) ++ ++ def testSessionStartup(self): ++ self._validator.verifySessionStartup(self.vdsAgent) ++ ++ def testSessionShutdown(self): ++ self._validator.verifySessionShutdown(self.vdsAgent) +diff --git a/tests/message_validator.py b/tests/message_validator.py +new file mode 100644 +index 0000000..95c379d +--- /dev/null ++++ b/tests/message_validator.py +@@ -0,0 +1,210 @@ ++#! /usr/bin/env python ++# -*- coding: utf-8 -*- ++# vim:fenc=utf-8 ++ ++import test_port ++import json ++import logging ++ ++ ++class TestPortWriteBuffer(test_port.TestPort): ++ def __init__(self, vport_name, *args, **kwargs): ++ test_port.TestPort.__init__(self, vport_name, *args, **kwargs) ++ self._buffer = '' ++ ++ def write(self, buffer): ++ self._buffer = self._buffer + buffer ++ return len(buffer) ++ ++ def read(self, size): ++ return '' ++ ++ def clear(self): ++ self._buffer = '' ++ | ||
Renamed | 0001-plugins-use-rhev-m-in-authentication-s-dialogs-bz-84.patch ^ | |
[+] | Added | 0002-agent-updated-conf-file-and-replaced-ini-file-name.patch ^ |
@@ -0,0 +1,43 @@ +From 6811b9e6400a6532a3d1d801e0830c9c756ded59 Mon Sep 17 00:00:00 2001 +From: Gal Hammer <ghammer@redhat.com> +Date: Tue, 25 Dec 2012 15:38:28 +0200 +Subject: [PATCH 2/8] agent: updated conf file and replaced ini file name + +Bug-Url: https://bugzilla.redhat.com/904045 +Change-Id: Ifdf03e83c2e7051dfeea7abc4417035e5559b47f +Label: DOWNSTREAM ONLY +Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> +--- + ovirt-guest-agent/OVirtGuestService.py | 2 +- + ovirt-guest-agent/ovirt-guest-agent.conf | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/ovirt-guest-agent/OVirtGuestService.py b/ovirt-guest-agent/OVirtGuestService.py +index 3206e8a..d68a2b9 100644 +--- a/ovirt-guest-agent/OVirtGuestService.py ++++ b/ovirt-guest-agent/OVirtGuestService.py +@@ -12,7 +12,7 @@ import ConfigParser + import os + import _winreg + +-AGENT_CONFIG = 'ovirt-guest-agent.ini' ++AGENT_CONFIG = 'rhev-agent.ini' + + # Values from WM_WTSSESSION_CHANGE message + # (http://msdn.microsoft.com/en-us/library/aa383828.aspx) +diff --git a/ovirt-guest-agent/ovirt-guest-agent.conf b/ovirt-guest-agent/ovirt-guest-agent.conf +index ee541ae..ad239a3 100644 +--- a/ovirt-guest-agent/ovirt-guest-agent.conf ++++ b/ovirt-guest-agent/ovirt-guest-agent.conf +@@ -10,7 +10,7 @@ report_application_rate = 120 + report_disk_usage = 300 + # RHEL/Fedora Packages: kernel ovirt-guest-agent-common xorg-x11-drv-qxl + # Debian Packages: linux-image xserver-xorg-video-qxl +-applications_list = kernel ovirt-guest-agent-common xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl ++applications_list = kernel rhevm-guest-agent-common xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl + ignored_fs = rootfs tmpfs autofs cgroup selinuxfs udev mqueue nfsd proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts securityfs debugfs binfmt_misc fuse.gvfsd-fuse fuse.gvfs-fuse-daemon fusectl usbfs + + [virtio] +-- +1.8.5.3 + | ||
[+] | Added | 0012-agent-Implement-basics-for-API-Versioning.patch ^ |
@@ -0,0 +1,406 @@ +From f2d1493440b562ad1d3b32189a3dae111a9a84b6 Mon Sep 17 00:00:00 2001 +From: Vinzenz Feenstra <vfeenstr@redhat.com> +Date: Wed, 17 Jul 2013 11:05:51 +0200 +Subject: [PATCH 1/3] agent: Implement basics for API Versioning + +This commit introduces the basics needed to support API versioning between +the ovirt-guest-agent and VDSM. + +How the negotiation works: +- VDSM has as a default the apiVersion value set to _DISABLED_API_VALUE marking + it as unsupported +- The guest agent sends its max supported version with every `heartbeat` + message +- VDSM checks that `apiVersion` exists in the `heartbeat` message arguments + - If it exists it retrieves the minimum common version and sends the + `api-version` message with the common version as `apiVersion` argument + - If it does NOT exist it and the apiVersion is not set to + _DISABLED_API_VALUE it will set it to _DISABLED_API_VALUE, with the meaning + that it is not supported at all by the guest agent on the other end. +- The guest agent on receiving this message makes it own check and sets the + `apiVersion` to the commonVersion + +- If VDSM sends the `refresh` command it also sends its `apiVersion` value + however if it does not, capable guest agents are disabling the versioning + support and will know it in pre-supported state as well. + +NOTE: VDSM will never send an api-version message without being triggered. + This is to ensure backwards compatibility. + +Change-Id: I754d52009538914dd0143894b24ad48fbf13cb38 +Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> +--- + ovirt-guest-agent/OVirtAgentLogic.py | 116 ++++++++++++++++++++++++++++------- + tests/guest_agent_test.py | 10 +++ + tests/message_validator.py | 68 +++++++++++++++++++- + 3 files changed, 170 insertions(+), 24 deletions(-) + +diff --git a/ovirt-guest-agent/OVirtAgentLogic.py b/ovirt-guest-agent/OVirtAgentLogic.py +index 52c3825..1c8fb30 100644 +--- a/ovirt-guest-agent/OVirtAgentLogic.py ++++ b/ovirt-guest-agent/OVirtAgentLogic.py +@@ -24,6 +24,27 @@ import socket + from threading import Event + from VirtIoChannel import VirtIoChannel + ++_MAX_SUPPORTED_API_VERSION = 0 ++_DISABLED_API_VALUE = 0 ++ ++_MESSAGE_MIN_API_VERSION = { ++ 'active-user': 0, ++ 'applications': 0, ++ 'disks-usage': 0, ++ 'echo': 0, ++ 'fqdn': 0, ++ 'heartbeat': 0, ++ 'host-name': 0, ++ 'memory-stats': 0, ++ 'network-interfaces': 0, ++ 'os-version': 0, ++ 'session-lock': 0, ++ 'session-logoff': 0, ++ 'session-logon': 0, ++ 'session-shutdown': 0, ++ 'session-startup': 0, ++ 'session-unlock': 0} ++ + + # Return a safe (password masked) repr of the credentials block. + def safe_creds_repr(creds): +@@ -36,6 +57,7 @@ def safe_creds_repr(creds): + + class DataRetriverBase: + def __init__(self): ++ self.apiVersion = _DISABLED_API_VALUE + self.memStats = { + 'mem_total': 0, + 'mem_free': 0, +@@ -45,6 +67,39 @@ class DataRetriverBase: + 'pageflt': 0, + 'majflt': 0} + ++ def onAPIVersionUpdated(self, oldVersion, newVersion): ++ pass ++ ++ def getAPIVersion(self): ++ return self.apiVersion ++ ++ def setAPIVersion(self, version): ++ oldVersion = self.apiVersion ++ try: ++ version = int(version) ++ except ValueError: ++ logging.info("Invalid api version value '%s' set. Version value " ++ "not changed.", version) ++ return ++ ++ if _MAX_SUPPORTED_API_VERSION < version: ++ logging.debug("API version requested (%d) higher than known (%d). " ++ "Using max known version.", version, ++ _MAX_SUPPORTED_API_VERSION) ++ version = _MAX_SUPPORTED_API_VERSION ++ ++ if version == self.apiVersion: ++ logging.debug("API version %d already set, no update necessary", ++ version) ++ return ++ self.apiVersion = version ++ ++ logging.info("API Version updated from %d to %d", oldVersion, version) ++ try: ++ self.onAPIVersionUpdated(oldVersion, version) ++ except Exception: ++ logging.exception("onAPIVersionUpdated failed") ++ + def getMachineName(self): + pass + +@@ -91,6 +146,16 @@ class AgentLogicBase: + self.dr = None + self.commandHandler = None + ++ def _send(self, name, arguments=None): ++ version = _MESSAGE_MIN_API_VERSION.get(name, None) ++ if version is None: ++ logging.error('Undocumented message "%s"', name) ++ elif version <= self.dr.getAPIVersion(): ++ self.vio.write(name, arguments or {}) ++ else: ++ logging.debug("Message %s not supported by api version %d.", ++ name, self.dr.getAPIVersion()) ++ + def run(self): + logging.debug("AgentLogicBase:: run() entered") + thread.start_new_thread(self.doListen, ()) +@@ -125,9 +190,10 @@ class AgentLogicBase: + counter += 1 + hbsecs -= 1 + if hbsecs <= 0: +- self.vio.write('heartbeat', +- {'free-ram': self.dr.getAvailableRAM(), +- 'memory-stat': self.dr.getMemoryStats()}) ++ self._send('heartbeat', ++ {'free-ram': self.dr.getAvailableRAM(), ++ 'memory-stat': self.dr.getMemoryStats(), ++ 'apiVersion': _MAX_SUPPORTED_API_VERSION}) + hbsecs = self.heartBitRate + usersecs -= 1 + if usersecs <= 0: +@@ -165,12 +231,17 @@ class AgentLogicBase: + 'channel.') + logging.debug("AgentLogicBase::doListen() - exiting") + ++ def _onApiVersion(self, args): ++ self.dr.setAPIVersion(args['apiVersion']) ++ + def parseCommand(self, command, args): + logging.info("Received an external command: %s..." % (command)) + if command == 'lock-screen': + self.commandHandler.lock_screen() + elif command == 'log-off': + self.commandHandler.logoff() ++ elif command == 'api-version': ++ self._onApiVersion(args) + elif command == 'shutdown': + try: + timeout = int(args['timeout']) +@@ -201,6 +272,10 @@ class AgentLogicBase: + % (safe_creds_repr(credentials))) + self.commandHandler.login(credentials) + elif command == 'refresh': ++ if not 'apiVersion' in args and self.dr.getAPIVersion() > 0: ++ logging.info('API versioning not supported by VDSM. Disabling ' ++ 'versioning support.') ++ self.dr.setAPIVersion(_DISABLED_API_VALUE) + self.sendUserInfo(True) + self.sendAppList() + self.sendInfo() +@@ -208,7 +283,7 @@ class AgentLogicBase: + self.sendFQDN() + elif command == 'echo': + logging.debug("Echo: %s", args) +- self.vio.write('echo', args) ++ self._send('echo', args) + elif command == 'hibernate': + state = args.get('state', 'disk') + self.commandHandler.hibernate(state) +@@ -217,31 +292,30 @@ class AgentLogicBase: + % (command, args)) + + def sendFQDN(self): +- self.vio.write('fqdn', {'fqdn': self.dr.getFQDN()}) ++ self._send('fqdn', {'fqdn': self.dr.getFQDN()}) + + def sendUserInfo(self, force=False): + cur_user = str(self.dr.getActiveUser()) + logging.debug("AgentLogicBase::sendUserInfo - cur_user = '%s'" % + (cur_user)) + if cur_user != self.activeUser or force: +- self.vio.write('active-user', {'name': cur_user}) | ||
[+] | Added | 0013-agent-Report-number-of-CPU-cores-visible-online-on-t.patch ^ |
@@ -0,0 +1,186 @@ +From 120c53bec8fbfc711c703750e9c5210411ff135b Mon Sep 17 00:00:00 2001 +From: Vinzenz Feenstra <vfeenstr@redhat.com> +Date: Mon, 7 Apr 2014 11:12:41 +0200 +Subject: [PATCH 2/3] agent: Report number of CPU cores visible online on the + guest OS + +This patches a new message and increases the Guest Agent API to +version 1. + +The new message has this format: +{"__name__": "number-of-cpus", "count": <int>} + +The reported number 'count' is the number of visible online CPU cores +on the guest OS system. + +Change-Id: Ief777608519a35319665c4cd0f580b7b38305b3e +Guest-Agent-API-Version: 1 +Bug-URL: https://bugzilla.redhat.com/show_bug.cgi?id=1063280 +Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> +--- + ovirt-guest-agent/OVirtAgentLogic.py | 33 +++++++++++++++++++++++++++++++- + ovirt-guest-agent/ovirt-guest-agent.conf | 1 + + tests/guest_agent_test.py | 4 ++++ + tests/message_validator.py | 16 ++++++++++++++++ + 5 files changed, 54 insertions(+), 1 deletion(-) + +diff --git a/ovirt-guest-agent/OVirtAgentLogic.py b/ovirt-guest-agent/OVirtAgentLogic.py +index 1c8fb30..5369180 100644 +--- a/ovirt-guest-agent/OVirtAgentLogic.py ++++ b/ovirt-guest-agent/OVirtAgentLogic.py +@@ -21,10 +21,21 @@ import time + import logging + import struct + import socket ++ ++multiproc = None ++try: ++ import multiprocessing ++ multiproc = multiprocessing ++except ImportError: ++ class MultiProcessingFake: ++ def cpu_count(self): ++ return -1 ++ multiproc = MultiProcessingFake() ++ + from threading import Event + from VirtIoChannel import VirtIoChannel + +-_MAX_SUPPORTED_API_VERSION = 0 ++_MAX_SUPPORTED_API_VERSION = 1 + _DISABLED_API_VALUE = 0 + + _MESSAGE_MIN_API_VERSION = { +@@ -37,6 +48,7 @@ _MESSAGE_MIN_API_VERSION = { + 'host-name': 0, + 'memory-stats': 0, + 'network-interfaces': 0, ++ 'number-of-cpus': 1, + 'os-version': 0, + 'session-lock': 0, + 'session-logoff': 0, +@@ -130,6 +142,16 @@ class DataRetriverBase: + def getFQDN(self): + return socket.getfqdn() + ++ def getNumberOfCPUs(self): ++ """ ++ Reports the number of CPUs or -1 if this was not implemented for the ++ current OS/Platform ++ """ ++ try: ++ return multiproc.cpu_count() ++ except NotImplementedError: ++ return -1 ++ + + class AgentLogicBase: + +@@ -141,6 +163,7 @@ class AgentLogicBase: + self.appRefreshRate = config.getint("general", + "report_application_rate") + self.disksRefreshRate = config.getint("general", "report_disk_usage") ++ self.numCPUsCheckRate = config.getint("general", "report_num_cpu_rate") + self.activeUser = "" + self.vio = VirtIoChannel(config.get("virtio", "device")) + self.dr = None +@@ -184,6 +207,7 @@ class AgentLogicBase: + appsecs = self.appRefreshRate + disksecs = self.disksRefreshRate + usersecs = self.userCheckRate ++ numcpusecs = self.numCPUsCheckRate + + try: + while not self.wait_stop.isSet(): +@@ -208,6 +232,10 @@ class AgentLogicBase: + if disksecs <= 0: + self.sendDisksUsages() + disksecs = self.disksRefreshRate ++ numcpusecs -= 1 ++ if numcpusecs <= 0: ++ self.sendNumberOfCPUs() ++ numcpusecs = self.numCPUsCheckRate + time.sleep(1) + logging.debug("AgentLogicBase:: doWork() exiting") + except: +@@ -317,6 +345,9 @@ class AgentLogicBase: + def sendMemoryStats(self): + self._send('memory-stats', {'memory': self.dr.getMemoryStats()}) + ++ def sendNumberOfCPUs(self): ++ self._send('number-of-cpus', {'count': self.dr.getNumberOfCPUs()}) ++ + def sessionLogon(self): + logging.debug("AgentLogicBase::sessionLogon: user logs on the system.") + cur_user = self.dr.getActiveUser() +diff --git a/ovirt-guest-agent/ovirt-guest-agent.conf b/ovirt-guest-agent/ovirt-guest-agent.conf +index ad239a3..d3c984e 100644 +--- a/ovirt-guest-agent/ovirt-guest-agent.conf ++++ b/ovirt-guest-agent/ovirt-guest-agent.conf +@@ -6,6 +6,7 @@ + + heart_beat_rate = 5 + report_user_rate = 10 ++report_num_cpu_rate = 60 + report_application_rate = 120 + report_disk_usage = 300 + # RHEL/Fedora Packages: kernel ovirt-guest-agent-common xorg-x11-drv-qxl +diff --git a/tests/guest_agent_test.py b/tests/guest_agent_test.py +index bd4a7f4..1962e19 100644 +--- a/tests/guest_agent_test.py ++++ b/tests/guest_agent_test.py +@@ -50,6 +50,7 @@ class FunctionalTest(GuestAgentTestCase): + + self._config.set('general', 'heart_beat_rate', '5') + self._config.set('general', 'report_user_rate', '10') ++ self._config.set('general', 'report_num_cpu_rate', '60') + self._config.set('general', 'report_application_rate', '120') + self._config.set('general', 'report_disk_usage', '300') + self._config.set('virtio', 'device', self._vport_name) +@@ -78,6 +79,9 @@ class FunctionalTest(GuestAgentTestCase): + def testSendUserInfo(self): + self._validator.verifySendUserInfo(self.vdsAgent) + ++ def testSendNumberOfCPUs(self): ++ self._validator.verifySendNumberOfCPUs(self.vdsAgent) ++ + def testSessionLogon(self): + self._validator.verifySessionLogon(self.vdsAgent) + +diff --git a/tests/message_validator.py b/tests/message_validator.py +index 20954b9..703c453 100644 +--- a/tests/message_validator.py ++++ b/tests/message_validator.py +@@ -155,6 +155,7 @@ _MSG_VALIDATORS = { + 'host-name': _name_and_one_str_param('host-name', 'name'), + 'memory-stats': validate_memory_stats, + 'network-interfaces': validate_network_interfaces, ++ 'number-of-cpus': _name_and_one_integral_param('number-of-cpus', 'count'), + 'os-version': _name_and_one_str_param('os-version', 'version'), + 'session-lock': _name_only('session-lock'), + 'session-logoff': _name_only('session-logoff'), +@@ -206,6 +207,21 @@ class MessageValidator(object): + def verifySendMemoryStats(self, agent): + agent.sendMemoryStats() + ++ def verifySendNumberOfCPUs(self, agent): ++ self._verifySendNumberOfCPUsV0(agent) ++ self._verifySendNumberOfCPUsV1(agent) ++ ++ @_ensure_messages() ++ def _verifySendNumberOfCPUsV0(self, agent): ++ agent.dr.apiVersion = 0 ++ agent.sendNumberOfCPUs() ++ ++ @_ensure_messages('number-of-cpus') ++ def _verifySendNumberOfCPUsV1(self, agent): ++ agent.dr.apiVersion = 1 ++ agent.sendNumberOfCPUs() ++ agent.dr.apiVersion = 0 ++ + @_ensure_messages('active-user') + def verifySendUserInfo(self, agent): + agent.sendUserInfo() +-- +1.9.0 + | ||
[+] | Added | 0014-agent-setNumberOfCPUs-support.patch ^ |
@@ -0,0 +1,60 @@ +From 1cb48caa24a585f0f84b29de49368a3bd4923c20 Mon Sep 17 00:00:00 2001 +From: Vinzenz Feenstra <vfeenstr@redhat.com> +Date: Mon, 7 Apr 2014 16:13:01 +0200 +Subject: [PATCH 3/3] agent: setNumberOfCPUs support + +Change-Id: I0b03bd96bd52b76e7d3bf1f8bbcdd7d8e8fbc560 +Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> +--- + ovirt-guest-agent/GuestAgentLinux2.py | 3 +++ + ovirt-guest-agent/GuestAgentWin32.py | 3 +++ + ovirt-guest-agent/OVirtAgentLogic.py | 5 +++++ + 3 files changed, 11 insertions(+) + +diff --git a/ovirt-guest-agent/GuestAgentLinux2.py b/ovirt-guest-agent/GuestAgentLinux2.py +index dec6676..6b4aeac 100644 +--- a/ovirt-guest-agent/GuestAgentLinux2.py ++++ b/ovirt-guest-agent/GuestAgentLinux2.py +@@ -183,6 +183,9 @@ class CommandHandlerLinux: + logging.debug("Executing hibernate command: %s", cmd) + subprocess.call(cmd) + ++ def set_number_of_cpus(self, count): ++ pass # currently noop ++ + + class LinuxDataRetriver(DataRetriverBase): + +diff --git a/ovirt-guest-agent/GuestAgentWin32.py b/ovirt-guest-agent/GuestAgentWin32.py +index af9bbf5..ad5e822 100644 +--- a/ovirt-guest-agent/GuestAgentWin32.py ++++ b/ovirt-guest-agent/GuestAgentWin32.py +@@ -301,6 +301,9 @@ class CommandHandlerWin: + except: + logging.exception("LockWorkStation exception") + ++ def setNumberOfCPUs(self, count): ++ pass ++ + + class WinDataRetriver(DataRetriverBase): + def __init__(self): +diff --git a/ovirt-guest-agent/OVirtAgentLogic.py b/ovirt-guest-agent/OVirtAgentLogic.py +index 5369180..126b0db 100644 +--- a/ovirt-guest-agent/OVirtAgentLogic.py ++++ b/ovirt-guest-agent/OVirtAgentLogic.py +@@ -315,6 +315,11 @@ class AgentLogicBase: + elif command == 'hibernate': + state = args.get('state', 'disk') + self.commandHandler.hibernate(state) ++ elif command == 'set-number-of-cpus': ++ count = args.get('count', 0) ++ if count > 0: ++ self.commandHandler.set_number_of_cpus(count) ++ self.sendNumberOfCPUs() + else: + logging.error("Unknown external command: %s (%s)" + % (command, args)) +-- +1.9.0 + | ||
[+] | Added | 0015-Implement-default-configuration-values.patch ^ |
@@ -0,0 +1,522 @@ +From 9cc129a7d86dda17be3dd819bf641b2d199da7f5 Mon Sep 17 00:00:00 2001 +From: Vinzenz Feenstra <vfeenstr@redhat.com> +Date: Fri, 23 May 2014 09:58:26 +0200 +Subject: [PATCH] Implement default configuration values + +When adding new config values to the configuration files, it's possible +that due to the installation the configuration files won't get updated, +when they are modified by an user/administrator on that given system. + +By using defaults, we can override this problem and ensure a proper +application start, when config values are missing which are mandatory, +to the functionality. + +Change-Id: I5ce9d457e826448aad205ce4abda5dc4b0210804 +Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> +Bug-Url: https://bugzilla.redhat.com/1101129 +--- + Makefile.am | 1 + + configurations/Makefile.am | 16 +++++++ + configurations/default-logger.conf | 41 ++++++++++++++++ + configurations/default.conf | 19 ++++++++ + configurations/ovirt-guest-agent.conf | 63 +++++++++++++++++++++++++ + configure.ac | 1 + + ovirt-guest-agent.rhel6.spec | 3 ++ + ovirt-guest-agent.spec | 3 ++ + ovirt-guest-agent/Makefile.am | 8 +--- + ovirt-guest-agent/Makefile.el5 | 3 +- + ovirt-guest-agent/OVirtGuestService.py | 28 +++++++++-- + ovirt-guest-agent/bytesio.py | 40 ++++++++++++++++ + ovirt-guest-agent/ovirt-guest-agent.conf | 61 ------------------------ + ovirt-guest-agent/ovirt-guest-agent.py | 25 +++++++++- + 19 files changed, 341 insertions(+), 127 deletions(-) + create mode 100644 configurations/Makefile.am + create mode 100644 configurations/default-logger.conf + create mode 100644 configurations/default.conf + create mode 100644 configurations/ovirt-guest-agent.conf + create mode 100644 ovirt-guest-agent/bytesio.py + delete mode 100644 ovirt-guest-agent/ovirt-guest-agent.conf + +diff --git a/Makefile.am b/Makefile.am +index ff73c6a..acc2eee 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -1,6 +1,7 @@ + ACLOCAL_AMFLAGS=-I m4 + + SUBDIRS = \ ++ configurations \ + ovirt-guest-agent \ + GinaSSO \ + tests \ +diff --git a/configurations/Makefile.am b/configurations/Makefile.am +new file mode 100644 +index 0000000..2f2864e +--- /dev/null ++++ b/configurations/Makefile.am +@@ -0,0 +1,13 @@ ++ ++EXTRA_DIST= \ ++ $(NULL) ++ ++agentconfdir=$(sysconfdir) ++dist_agentconf_DATA=ovirt-guest-agent.conf ++ ++agentdefaultconfdir=$(datadir)/ovirt-guest-agent ++dist_agentdefaultconf_DATA=\ ++ default.conf \ ++ default-logger.conf \ ++ $(NULL) ++ +diff --git a/configurations/default-logger.conf b/configurations/default-logger.conf +new file mode 100644 +index 0000000..898fb92 +--- /dev/null ++++ b/configurations/default-logger.conf +@@ -0,0 +1,41 @@ ++[loggers] ++keys=root ++ ++[handlers] ++keys=console,syslog,logfile ++ ++[formatters] ++keys=long,simple,none,sysform ++ ++[logger_root] ++level=INFO ++handlers=logfile ++propagate=0 ++ ++[handler_syslog] ++class=handlers.SysLogHandler ++formatter=sysform ++args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER) ++ ++[handler_logfile] ++class=handlers.RotatingFileHandler ++args=('/var/log/ovirt-guest-agent/ovirt-guest-agent.log', 'a', 100*1024, 5) ++formatter=long ++ ++[handler_console] ++class: StreamHandler ++args: [] ++formatter: none ++ ++[formatter_simple] ++format: %(name)s:%(levelname)s: %(message)s ++ ++[formatter_none] ++format: %(message)s ++ ++[formatter_long] ++format: %(threadName)s::%(levelname)s::%(asctime)s::%(module)s::%(lineno)d::%(name)s::%(message)s ++ ++[formatter_sysform] ++format= %(asctime)s %(levelname)s %(message)s ++datefmt= +diff --git a/configurations/default.conf b/configurations/default.conf +new file mode 100644 +index 0000000..c377f0c +--- /dev/null ++++ b/configurations/default.conf +@@ -0,0 +1,19 @@ ++# ++# default.conf ++# ++ ++[general] ++ ++heart_beat_rate = 5 ++report_user_rate = 10 ++report_num_cpu_rate = 60 ++report_application_rate = 120 ++report_disk_usage = 300 ++ ++# RHEL/Fedora Packages: kernel ovirt-guest-agent-common xorg-x11-drv-qxl ++# Debian Packages: linux-image xserver-xorg-video-qxl ++applications_list = kernel rhevm-guest-agent-common xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl ++ignored_fs = rootfs tmpfs autofs cgroup selinuxfs udev mqueue nfsd proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts securityfs debugfs binfmt_misc fuse.gvfsd-fuse fuse.gvfs-fuse-daemon fusectl usbfs ++ ++[virtio] ++device = /dev/virtio-ports/com.redhat.rhevm.vdsm +diff --git a/configurations/ovirt-guest-agent.conf b/configurations/ovirt-guest-agent.conf +new file mode 100644 +index 0000000..80509f5 +--- /dev/null ++++ b/configurations/ovirt-guest-agent.conf +@@ -0,0 +1,63 @@ ++# ++# ovirt-guest-agent.conf ++# ++ ++[general] ++ ++# heart_beat_rate = 5 ++# report_user_rate = 10 ++# report_num_cpu_rate = 60 ++# report_application_rate = 120 ++# report_disk_usage = 300 ++ ++## Generic: ovirt-guest-agent ++## RHEL/Fedora Packages: kernel ovirt-guest-agent-common xorg-x11-drv-qxl ++## Debian Packages: linux-image xserver-xorg-video-qxl ++## openSUSE Packages: xf86-video-qxl kernel-desktop kernel-default kernel-trace kernel-vanilla kernel-debug kernel-ec2 kernel-xen ++# applications_list = kernel ovirt-guest-agent ovirt-guest-agent-common xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl xf86-video-qxl kernel-desktop kernel-default kernel-trace kernel-vanilla kernel-debug kernel-ec2 kernel-xen ++# ignored_fs = rootfs tmpfs autofs cgroup selinuxfs udev mqueue nfsd proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts securityfs debugfs binfmt_misc fuse.gvfsd-fuse fuse.gvfs-fuse-daemon fusectl usbfs ++ ++[virtio] ++# device = /dev/virtio-ports/com.redhat.rhevm.vdsm ++ ++#[loggers] ++#keys=root ++ ++#[handlers] ++#keys=console,syslog,logfile ++ ++#[formatters] ++#keys=long,simple,none,sysform ++ ++#[logger_root] ++#level=INFO ++#handlers=logfile ++#propagate=0 ++ ++#[handler_syslog] ++#class=handlers.SysLogHandler ++#formatter=sysform ++#args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER) ++ ++#[handler_logfile] ++#class=handlers.RotatingFileHandler ++#args=('/var/log/ovirt-guest-agent/ovirt-guest-agent.log', 'a', 100*1024, 5) ++#formatter=long ++ ++#[handler_console] ++#class: StreamHandler ++#args: [] ++#formatter: none ++ | ||
Renamed | 0016-Fix-SSO-on-RHEL6.patch ^ | |
[+] | Deleted | _service:download_src_package:0000-Adding-missing-unit-test-files.patch ^ |
@@ -1,494 +0,0 @@ -From 7bd2232b7827eb886cb18b5ea62cf2a4f31a540e Mon Sep 17 00:00:00 2001 -From: Vinzenz Feenstra <vfeenstr@redhat.com> -Date: Thu, 15 May 2014 14:49:57 +0200 -Subject: [PATCH] Adding missing unit test files - -Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> ---- - tests/encoding_test.py | 45 ++++++++++ - tests/guest_agent_test.py | 93 ++++++++++++++++++++ - tests/message_validator.py | 210 +++++++++++++++++++++++++++++++++++++++++++++ - tests/test_port.py | 26 ++++++ - tests/testrunner.py | 68 +++++++++++++++ - 5 files changed, 442 insertions(+) - create mode 100644 tests/encoding_test.py - create mode 100644 tests/guest_agent_test.py - create mode 100644 tests/message_validator.py - create mode 100644 tests/test_port.py - create mode 100644 tests/testrunner.py - -diff --git a/tests/encoding_test.py b/tests/encoding_test.py -new file mode 100644 -index 0000000..770bcb6 ---- /dev/null -+++ b/tests/encoding_test.py -@@ -0,0 +1,45 @@ -+#! /usr/bin/env python -+# -*- coding: utf-8 -*- -+# vim:fenc=utf-8 -+ -+from testrunner import GuestAgentTestCase as TestCaseBase -+from VirtIoChannel import _filter_object -+ -+ -+class EncodingTest(TestCaseBase): -+ -+ def testNonUnicodeKeyInput(self): -+ non_unicode_key = {'non-unicode-key': u'unicode value'} -+ self.assertEquals({u'non-unicode-key': u'unicode value'}, -+ _filter_object(non_unicode_key)) -+ -+ def testNonUnicodeValueInput(self): -+ non_unicode_value = {u'unicode-key': 'non-unicode value'} -+ self.assertEquals({u'unicode-key': u'non-unicode value'}, -+ _filter_object(non_unicode_value)) -+ -+ def testWindowsFailureOnValidValue(self): -+ VALID = u'\u0F65' -+ self.assertEquals(VALID, _filter_object(VALID)) -+ -+ def testNullChar(self): -+ non_unicode_value = {u'unicode-key': '\x00'} -+ self.assertEquals({u'unicode-key': u'\ufffd'}, -+ _filter_object(non_unicode_value)) -+ -+ def testIllegalUnicodeInput(self): -+ ILLEGAL_DATA = {u'foo': u'\x00data\x00test\uffff\ufffe\udc79\ud800'} -+ EXPECTED = {u'foo': u'\ufffddata\ufffdtest\ufffd\ufffd\ufffd\ufffd'} -+ self.assertEqual(EXPECTED, _filter_object(ILLEGAL_DATA)) -+ -+ def testIllegalUnicodeCharacters(self): -+ INVALID = (u'\u0000', u'\ufffe', u'\uffff', u'\ud800', u'\udc79', -+ u'\U00000000', '\x00', '\x01', '\x02', '\x03', '\x04', -+ '\x05') -+ for invchar in INVALID: -+ self.assertEqual(u'\ufffd', _filter_object(invchar)) -+ -+ def testLegalUnicodeCharacters(self): -+ LEGAL = (u'\u2122', u'Hello World') -+ for legalchar in LEGAL: -+ self.assertEqual(legalchar, _filter_object(legalchar)) -diff --git a/tests/guest_agent_test.py b/tests/guest_agent_test.py -new file mode 100644 -index 0000000..b3939ad ---- /dev/null -+++ b/tests/guest_agent_test.py -@@ -0,0 +1,93 @@ -+#! /usr/bin/env python -+# -*- coding: utf-8 -*- -+# vim:fenc=utf-8 -+ -+ -+from ConfigParser import ConfigParser -+import platform -+ -+from message_validator import MessageValidator -+from testrunner import GuestAgentTestCase -+ -+import test_port -+ -+ -+def _linux_setup_test(conf): -+ port_name = 'linux-functional-test-port' -+ conf.set('general', 'applications_list', -+ 'kernel ovirt-guest-agent xorg-x11-drv-qxl ' -+ 'linux-image xserver-xorg-video-qxl') -+ conf.set('general', 'ignored_fs', -+ 'rootfs tmpfs autofs cgroup selinuxfs udev mqueue ' -+ 'nfds proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts ' -+ 'securityfs debugfs binfmt_misc fuse.gvfsd-fuse ' -+ 'fuse.gvfs-fuse-daemon fusectl usbfs') -+ from GuestAgentLinux2 import LinuxVdsAgent -+ return port_name, LinuxVdsAgent -+ -+ -+def _win32_setup_test(conf): -+ port_name = "windows-functional-test-port" -+ from GuestAgentWin32 import WinVdsAgent -+ return port_name, WinVdsAgent -+ -+ -+class FunctionalTest(GuestAgentTestCase): -+ def setUp(self): -+ self._config = ConfigParser() -+ self._config.add_section('general') -+ self._config.add_section('virtio') -+ -+ agent_class = None -+ if platform.system() in ['Windows', 'Microsoft']: -+ self._vport_name, agent_class = _win32_setup_test(self._config) -+ else: -+ self._vport_name, agent_class = _linux_setup_test(self._config) -+ -+ self._validator = MessageValidator(self._vport_name) -+ self._vport = self._validator.port() -+ test_port.add_test_port(self._vport_name, self._vport) -+ -+ self._config.set('general', 'heart_beat_rate', '5') -+ self._config.set('general', 'report_user_rate', '10') -+ self._config.set('general', 'report_application_rate', '120') -+ self._config.set('general', 'report_disk_usage', '300') -+ self._config.set('virtio', 'device', self._vport_name) -+ -+ self.vdsAgent = agent_class(self._config) -+ -+ def testSendInfo(self): -+ self._validator.verifySendInfo(self.vdsAgent) -+ -+ def testSendAppList(self): -+ self._validator.verifySendAppList(self.vdsAgent) -+ -+ def testSendDisksUsages(self): -+ self._validator.verifySendDisksUsages(self.vdsAgent) -+ -+ def testSendMemoryStats(self): -+ self._validator.verifySendMemoryStats(self.vdsAgent) -+ -+ def testSendFQDN(self): -+ self._validator.verifySendFQDN(self.vdsAgent) -+ -+ def testSendUserInfo(self): -+ self._validator.verifySendUserInfo(self.vdsAgent) -+ -+ def testSessionLogon(self): -+ self._validator.verifySessionLogon(self.vdsAgent) -+ -+ def testSessionLogoff(self): -+ self._validator.verifySessionLogon(self.vdsAgent) -+ -+ def testSessionLock(self): -+ self._validator.verifySessionLock(self.vdsAgent) -+ -+ def testSessionUnlock(self): -+ self._validator.verifySessionUnlock(self.vdsAgent) -+ -+ def testSessionStartup(self): -+ self._validator.verifySessionStartup(self.vdsAgent) -+ -+ def testSessionShutdown(self): -+ self._validator.verifySessionShutdown(self.vdsAgent) -diff --git a/tests/message_validator.py b/tests/message_validator.py -new file mode 100644 -index 0000000..95c379d ---- /dev/null -+++ b/tests/message_validator.py -@@ -0,0 +1,210 @@ -+#! /usr/bin/env python -+# -*- coding: utf-8 -*- -+# vim:fenc=utf-8 -+ -+import test_port -+import json -+import logging -+ -+ -+class TestPortWriteBuffer(test_port.TestPort): -+ def __init__(self, vport_name, *args, **kwargs): -+ test_port.TestPort.__init__(self, vport_name, *args, **kwargs) -+ self._buffer = '' -+ -+ def write(self, buffer): -+ self._buffer = self._buffer + buffer -+ return len(buffer) -+ -+ def read(self, size): -+ return '' -+ -+ def clear(self): -+ self._buffer = '' -+ | ||
[+] | Deleted | _service:download_src_package:0002-agent-updated-conf-file-and-replaced-ini-file-name.patch ^ |
@@ -1,43 +0,0 @@ -From 6811b9e6400a6532a3d1d801e0830c9c756ded59 Mon Sep 17 00:00:00 2001 -From: Gal Hammer <ghammer@redhat.com> -Date: Tue, 25 Dec 2012 15:38:28 +0200 -Subject: [PATCH 2/8] agent: updated conf file and replaced ini file name - -Bug-Url: https://bugzilla.redhat.com/904045 -Change-Id: Ifdf03e83c2e7051dfeea7abc4417035e5559b47f -Label: DOWNSTREAM ONLY -Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> ---- - ovirt-guest-agent/OVirtGuestService.py | 2 +- - ovirt-guest-agent/ovirt-guest-agent.conf | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ovirt-guest-agent/OVirtGuestService.py b/ovirt-guest-agent/OVirtGuestService.py -index 3206e8a..d68a2b9 100644 ---- a/ovirt-guest-agent/OVirtGuestService.py -+++ b/ovirt-guest-agent/OVirtGuestService.py -@@ -12,7 +12,7 @@ import ConfigParser - import os - import _winreg - --AGENT_CONFIG = 'ovirt-guest-agent.ini' -+AGENT_CONFIG = 'rhev-agent.ini' - - # Values from WM_WTSSESSION_CHANGE message - # (http://msdn.microsoft.com/en-us/library/aa383828.aspx) -diff --git a/ovirt-guest-agent/ovirt-guest-agent.conf b/ovirt-guest-agent/ovirt-guest-agent.conf -index ee541ae..ad239a3 100644 ---- a/ovirt-guest-agent/ovirt-guest-agent.conf -+++ b/ovirt-guest-agent/ovirt-guest-agent.conf -@@ -10,7 +10,7 @@ report_application_rate = 120 - report_disk_usage = 300 - # RHEL/Fedora Packages: kernel ovirt-guest-agent-common xorg-x11-drv-qxl - # Debian Packages: linux-image xserver-xorg-video-qxl --applications_list = kernel ovirt-guest-agent-common xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl -+applications_list = kernel rhevm-guest-agent-common xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl - ignored_fs = rootfs tmpfs autofs cgroup selinuxfs udev mqueue nfsd proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts securityfs debugfs binfmt_misc fuse.gvfsd-fuse fuse.gvfs-fuse-daemon fusectl usbfs - - [virtio] --- -1.8.5.3 - | ||
[+] | Deleted | _service:download_src_package:0012-agent-Implement-basics-for-API-Versioning.patch ^ |
@@ -1,406 +0,0 @@ -From f2d1493440b562ad1d3b32189a3dae111a9a84b6 Mon Sep 17 00:00:00 2001 -From: Vinzenz Feenstra <vfeenstr@redhat.com> -Date: Wed, 17 Jul 2013 11:05:51 +0200 -Subject: [PATCH 1/3] agent: Implement basics for API Versioning - -This commit introduces the basics needed to support API versioning between -the ovirt-guest-agent and VDSM. - -How the negotiation works: -- VDSM has as a default the apiVersion value set to _DISABLED_API_VALUE marking - it as unsupported -- The guest agent sends its max supported version with every `heartbeat` - message -- VDSM checks that `apiVersion` exists in the `heartbeat` message arguments - - If it exists it retrieves the minimum common version and sends the - `api-version` message with the common version as `apiVersion` argument - - If it does NOT exist it and the apiVersion is not set to - _DISABLED_API_VALUE it will set it to _DISABLED_API_VALUE, with the meaning - that it is not supported at all by the guest agent on the other end. -- The guest agent on receiving this message makes it own check and sets the - `apiVersion` to the commonVersion - -- If VDSM sends the `refresh` command it also sends its `apiVersion` value - however if it does not, capable guest agents are disabling the versioning - support and will know it in pre-supported state as well. - -NOTE: VDSM will never send an api-version message without being triggered. - This is to ensure backwards compatibility. - -Change-Id: I754d52009538914dd0143894b24ad48fbf13cb38 -Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> ---- - ovirt-guest-agent/OVirtAgentLogic.py | 116 ++++++++++++++++++++++++++++------- - tests/guest_agent_test.py | 10 +++ - tests/message_validator.py | 68 +++++++++++++++++++- - 3 files changed, 170 insertions(+), 24 deletions(-) - -diff --git a/ovirt-guest-agent/OVirtAgentLogic.py b/ovirt-guest-agent/OVirtAgentLogic.py -index 52c3825..1c8fb30 100644 ---- a/ovirt-guest-agent/OVirtAgentLogic.py -+++ b/ovirt-guest-agent/OVirtAgentLogic.py -@@ -24,6 +24,27 @@ import socket - from threading import Event - from VirtIoChannel import VirtIoChannel - -+_MAX_SUPPORTED_API_VERSION = 0 -+_DISABLED_API_VALUE = 0 -+ -+_MESSAGE_MIN_API_VERSION = { -+ 'active-user': 0, -+ 'applications': 0, -+ 'disks-usage': 0, -+ 'echo': 0, -+ 'fqdn': 0, -+ 'heartbeat': 0, -+ 'host-name': 0, -+ 'memory-stats': 0, -+ 'network-interfaces': 0, -+ 'os-version': 0, -+ 'session-lock': 0, -+ 'session-logoff': 0, -+ 'session-logon': 0, -+ 'session-shutdown': 0, -+ 'session-startup': 0, -+ 'session-unlock': 0} -+ - - # Return a safe (password masked) repr of the credentials block. - def safe_creds_repr(creds): -@@ -36,6 +57,7 @@ def safe_creds_repr(creds): - - class DataRetriverBase: - def __init__(self): -+ self.apiVersion = _DISABLED_API_VALUE - self.memStats = { - 'mem_total': 0, - 'mem_free': 0, -@@ -45,6 +67,39 @@ class DataRetriverBase: - 'pageflt': 0, - 'majflt': 0} - -+ def onAPIVersionUpdated(self, oldVersion, newVersion): -+ pass -+ -+ def getAPIVersion(self): -+ return self.apiVersion -+ -+ def setAPIVersion(self, version): -+ oldVersion = self.apiVersion -+ try: -+ version = int(version) -+ except ValueError: -+ logging.info("Invalid api version value '%s' set. Version value " -+ "not changed.", version) -+ return -+ -+ if _MAX_SUPPORTED_API_VERSION < version: -+ logging.debug("API version requested (%d) higher than known (%d). " -+ "Using max known version.", version, -+ _MAX_SUPPORTED_API_VERSION) -+ version = _MAX_SUPPORTED_API_VERSION -+ -+ if version == self.apiVersion: -+ logging.debug("API version %d already set, no update necessary", -+ version) -+ return -+ self.apiVersion = version -+ -+ logging.info("API Version updated from %d to %d", oldVersion, version) -+ try: -+ self.onAPIVersionUpdated(oldVersion, version) -+ except Exception: -+ logging.exception("onAPIVersionUpdated failed") -+ - def getMachineName(self): - pass - -@@ -91,6 +146,16 @@ class AgentLogicBase: - self.dr = None - self.commandHandler = None - -+ def _send(self, name, arguments=None): -+ version = _MESSAGE_MIN_API_VERSION.get(name, None) -+ if version is None: -+ logging.error('Undocumented message "%s"', name) -+ elif version <= self.dr.getAPIVersion(): -+ self.vio.write(name, arguments or {}) -+ else: -+ logging.debug("Message %s not supported by api version %d.", -+ name, self.dr.getAPIVersion()) -+ - def run(self): - logging.debug("AgentLogicBase:: run() entered") - thread.start_new_thread(self.doListen, ()) -@@ -125,9 +190,10 @@ class AgentLogicBase: - counter += 1 - hbsecs -= 1 - if hbsecs <= 0: -- self.vio.write('heartbeat', -- {'free-ram': self.dr.getAvailableRAM(), -- 'memory-stat': self.dr.getMemoryStats()}) -+ self._send('heartbeat', -+ {'free-ram': self.dr.getAvailableRAM(), -+ 'memory-stat': self.dr.getMemoryStats(), -+ 'apiVersion': _MAX_SUPPORTED_API_VERSION}) - hbsecs = self.heartBitRate - usersecs -= 1 - if usersecs <= 0: -@@ -165,12 +231,17 @@ class AgentLogicBase: - 'channel.') - logging.debug("AgentLogicBase::doListen() - exiting") - -+ def _onApiVersion(self, args): -+ self.dr.setAPIVersion(args['apiVersion']) -+ - def parseCommand(self, command, args): - logging.info("Received an external command: %s..." % (command)) - if command == 'lock-screen': - self.commandHandler.lock_screen() - elif command == 'log-off': - self.commandHandler.logoff() -+ elif command == 'api-version': -+ self._onApiVersion(args) - elif command == 'shutdown': - try: - timeout = int(args['timeout']) -@@ -201,6 +272,10 @@ class AgentLogicBase: - % (safe_creds_repr(credentials))) - self.commandHandler.login(credentials) - elif command == 'refresh': -+ if not 'apiVersion' in args and self.dr.getAPIVersion() > 0: -+ logging.info('API versioning not supported by VDSM. Disabling ' -+ 'versioning support.') -+ self.dr.setAPIVersion(_DISABLED_API_VALUE) - self.sendUserInfo(True) - self.sendAppList() - self.sendInfo() -@@ -208,7 +283,7 @@ class AgentLogicBase: - self.sendFQDN() - elif command == 'echo': - logging.debug("Echo: %s", args) -- self.vio.write('echo', args) -+ self._send('echo', args) - elif command == 'hibernate': - state = args.get('state', 'disk') - self.commandHandler.hibernate(state) -@@ -217,31 +292,30 @@ class AgentLogicBase: - % (command, args)) - - def sendFQDN(self): -- self.vio.write('fqdn', {'fqdn': self.dr.getFQDN()}) -+ self._send('fqdn', {'fqdn': self.dr.getFQDN()}) - - def sendUserInfo(self, force=False): - cur_user = str(self.dr.getActiveUser()) - logging.debug("AgentLogicBase::sendUserInfo - cur_user = '%s'" % - (cur_user)) - if cur_user != self.activeUser or force: -- self.vio.write('active-user', {'name': cur_user}) | ||
[+] | Deleted | _service:download_src_package:0013-agent-Report-number-of-CPU-cores-visible-online-on-t.patch ^ |
@@ -1,186 +0,0 @@ -From 120c53bec8fbfc711c703750e9c5210411ff135b Mon Sep 17 00:00:00 2001 -From: Vinzenz Feenstra <vfeenstr@redhat.com> -Date: Mon, 7 Apr 2014 11:12:41 +0200 -Subject: [PATCH 2/3] agent: Report number of CPU cores visible online on the - guest OS - -This patches a new message and increases the Guest Agent API to -version 1. - -The new message has this format: -{"__name__": "number-of-cpus", "count": <int>} - -The reported number 'count' is the number of visible online CPU cores -on the guest OS system. - -Change-Id: Ief777608519a35319665c4cd0f580b7b38305b3e -Guest-Agent-API-Version: 1 -Bug-URL: https://bugzilla.redhat.com/show_bug.cgi?id=1063280 -Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> ---- - ovirt-guest-agent/OVirtAgentLogic.py | 33 +++++++++++++++++++++++++++++++- - ovirt-guest-agent/ovirt-guest-agent.conf | 1 + - tests/guest_agent_test.py | 4 ++++ - tests/message_validator.py | 16 ++++++++++++++++ - 5 files changed, 54 insertions(+), 1 deletion(-) - -diff --git a/ovirt-guest-agent/OVirtAgentLogic.py b/ovirt-guest-agent/OVirtAgentLogic.py -index 1c8fb30..5369180 100644 ---- a/ovirt-guest-agent/OVirtAgentLogic.py -+++ b/ovirt-guest-agent/OVirtAgentLogic.py -@@ -21,10 +21,21 @@ import time - import logging - import struct - import socket -+ -+multiproc = None -+try: -+ import multiprocessing -+ multiproc = multiprocessing -+except ImportError: -+ class MultiProcessingFake: -+ def cpu_count(self): -+ return -1 -+ multiproc = MultiProcessingFake() -+ - from threading import Event - from VirtIoChannel import VirtIoChannel - --_MAX_SUPPORTED_API_VERSION = 0 -+_MAX_SUPPORTED_API_VERSION = 1 - _DISABLED_API_VALUE = 0 - - _MESSAGE_MIN_API_VERSION = { -@@ -37,6 +48,7 @@ _MESSAGE_MIN_API_VERSION = { - 'host-name': 0, - 'memory-stats': 0, - 'network-interfaces': 0, -+ 'number-of-cpus': 1, - 'os-version': 0, - 'session-lock': 0, - 'session-logoff': 0, -@@ -130,6 +142,16 @@ class DataRetriverBase: - def getFQDN(self): - return socket.getfqdn() - -+ def getNumberOfCPUs(self): -+ """ -+ Reports the number of CPUs or -1 if this was not implemented for the -+ current OS/Platform -+ """ -+ try: -+ return multiproc.cpu_count() -+ except NotImplementedError: -+ return -1 -+ - - class AgentLogicBase: - -@@ -141,6 +163,7 @@ class AgentLogicBase: - self.appRefreshRate = config.getint("general", - "report_application_rate") - self.disksRefreshRate = config.getint("general", "report_disk_usage") -+ self.numCPUsCheckRate = config.getint("general", "report_num_cpu_rate") - self.activeUser = "" - self.vio = VirtIoChannel(config.get("virtio", "device")) - self.dr = None -@@ -184,6 +207,7 @@ class AgentLogicBase: - appsecs = self.appRefreshRate - disksecs = self.disksRefreshRate - usersecs = self.userCheckRate -+ numcpusecs = self.numCPUsCheckRate - - try: - while not self.wait_stop.isSet(): -@@ -208,6 +232,10 @@ class AgentLogicBase: - if disksecs <= 0: - self.sendDisksUsages() - disksecs = self.disksRefreshRate -+ numcpusecs -= 1 -+ if numcpusecs <= 0: -+ self.sendNumberOfCPUs() -+ numcpusecs = self.numCPUsCheckRate - time.sleep(1) - logging.debug("AgentLogicBase:: doWork() exiting") - except: -@@ -317,6 +345,9 @@ class AgentLogicBase: - def sendMemoryStats(self): - self._send('memory-stats', {'memory': self.dr.getMemoryStats()}) - -+ def sendNumberOfCPUs(self): -+ self._send('number-of-cpus', {'count': self.dr.getNumberOfCPUs()}) -+ - def sessionLogon(self): - logging.debug("AgentLogicBase::sessionLogon: user logs on the system.") - cur_user = self.dr.getActiveUser() -diff --git a/ovirt-guest-agent/ovirt-guest-agent.conf b/ovirt-guest-agent/ovirt-guest-agent.conf -index ad239a3..d3c984e 100644 ---- a/ovirt-guest-agent/ovirt-guest-agent.conf -+++ b/ovirt-guest-agent/ovirt-guest-agent.conf -@@ -6,6 +6,7 @@ - - heart_beat_rate = 5 - report_user_rate = 10 -+report_num_cpu_rate = 60 - report_application_rate = 120 - report_disk_usage = 300 - # RHEL/Fedora Packages: kernel ovirt-guest-agent-common xorg-x11-drv-qxl -diff --git a/tests/guest_agent_test.py b/tests/guest_agent_test.py -index bd4a7f4..1962e19 100644 ---- a/tests/guest_agent_test.py -+++ b/tests/guest_agent_test.py -@@ -50,6 +50,7 @@ class FunctionalTest(GuestAgentTestCase): - - self._config.set('general', 'heart_beat_rate', '5') - self._config.set('general', 'report_user_rate', '10') -+ self._config.set('general', 'report_num_cpu_rate', '60') - self._config.set('general', 'report_application_rate', '120') - self._config.set('general', 'report_disk_usage', '300') - self._config.set('virtio', 'device', self._vport_name) -@@ -78,6 +79,9 @@ class FunctionalTest(GuestAgentTestCase): - def testSendUserInfo(self): - self._validator.verifySendUserInfo(self.vdsAgent) - -+ def testSendNumberOfCPUs(self): -+ self._validator.verifySendNumberOfCPUs(self.vdsAgent) -+ - def testSessionLogon(self): - self._validator.verifySessionLogon(self.vdsAgent) - -diff --git a/tests/message_validator.py b/tests/message_validator.py -index 20954b9..703c453 100644 ---- a/tests/message_validator.py -+++ b/tests/message_validator.py -@@ -155,6 +155,7 @@ _MSG_VALIDATORS = { - 'host-name': _name_and_one_str_param('host-name', 'name'), - 'memory-stats': validate_memory_stats, - 'network-interfaces': validate_network_interfaces, -+ 'number-of-cpus': _name_and_one_integral_param('number-of-cpus', 'count'), - 'os-version': _name_and_one_str_param('os-version', 'version'), - 'session-lock': _name_only('session-lock'), - 'session-logoff': _name_only('session-logoff'), -@@ -206,6 +207,21 @@ class MessageValidator(object): - def verifySendMemoryStats(self, agent): - agent.sendMemoryStats() - -+ def verifySendNumberOfCPUs(self, agent): -+ self._verifySendNumberOfCPUsV0(agent) -+ self._verifySendNumberOfCPUsV1(agent) -+ -+ @_ensure_messages() -+ def _verifySendNumberOfCPUsV0(self, agent): -+ agent.dr.apiVersion = 0 -+ agent.sendNumberOfCPUs() -+ -+ @_ensure_messages('number-of-cpus') -+ def _verifySendNumberOfCPUsV1(self, agent): -+ agent.dr.apiVersion = 1 -+ agent.sendNumberOfCPUs() -+ agent.dr.apiVersion = 0 -+ - @_ensure_messages('active-user') - def verifySendUserInfo(self, agent): - agent.sendUserInfo() --- -1.9.0 - | ||
[+] | Deleted | _service:download_src_package:0014-agent-setNumberOfCPUs-support.patch ^ |
@@ -1,60 +0,0 @@ -From 1cb48caa24a585f0f84b29de49368a3bd4923c20 Mon Sep 17 00:00:00 2001 -From: Vinzenz Feenstra <vfeenstr@redhat.com> -Date: Mon, 7 Apr 2014 16:13:01 +0200 -Subject: [PATCH 3/3] agent: setNumberOfCPUs support - -Change-Id: I0b03bd96bd52b76e7d3bf1f8bbcdd7d8e8fbc560 -Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> ---- - ovirt-guest-agent/GuestAgentLinux2.py | 3 +++ - ovirt-guest-agent/GuestAgentWin32.py | 3 +++ - ovirt-guest-agent/OVirtAgentLogic.py | 5 +++++ - 3 files changed, 11 insertions(+) - -diff --git a/ovirt-guest-agent/GuestAgentLinux2.py b/ovirt-guest-agent/GuestAgentLinux2.py -index dec6676..6b4aeac 100644 ---- a/ovirt-guest-agent/GuestAgentLinux2.py -+++ b/ovirt-guest-agent/GuestAgentLinux2.py -@@ -183,6 +183,9 @@ class CommandHandlerLinux: - logging.debug("Executing hibernate command: %s", cmd) - subprocess.call(cmd) - -+ def set_number_of_cpus(self, count): -+ pass # currently noop -+ - - class LinuxDataRetriver(DataRetriverBase): - -diff --git a/ovirt-guest-agent/GuestAgentWin32.py b/ovirt-guest-agent/GuestAgentWin32.py -index af9bbf5..ad5e822 100644 ---- a/ovirt-guest-agent/GuestAgentWin32.py -+++ b/ovirt-guest-agent/GuestAgentWin32.py -@@ -301,6 +301,9 @@ class CommandHandlerWin: - except: - logging.exception("LockWorkStation exception") - -+ def setNumberOfCPUs(self, count): -+ pass -+ - - class WinDataRetriver(DataRetriverBase): - def __init__(self): -diff --git a/ovirt-guest-agent/OVirtAgentLogic.py b/ovirt-guest-agent/OVirtAgentLogic.py -index 5369180..126b0db 100644 ---- a/ovirt-guest-agent/OVirtAgentLogic.py -+++ b/ovirt-guest-agent/OVirtAgentLogic.py -@@ -315,6 +315,11 @@ class AgentLogicBase: - elif command == 'hibernate': - state = args.get('state', 'disk') - self.commandHandler.hibernate(state) -+ elif command == 'set-number-of-cpus': -+ count = args.get('count', 0) -+ if count > 0: -+ self.commandHandler.set_number_of_cpus(count) -+ self.sendNumberOfCPUs() - else: - logging.error("Unknown external command: %s (%s)" - % (command, args)) --- -1.9.0 - | ||
[+] | Deleted | _service:download_src_package:0015-Implement-default-configuration-values.patch ^ |
@@ -1,522 +0,0 @@ -From 9cc129a7d86dda17be3dd819bf641b2d199da7f5 Mon Sep 17 00:00:00 2001 -From: Vinzenz Feenstra <vfeenstr@redhat.com> -Date: Fri, 23 May 2014 09:58:26 +0200 -Subject: [PATCH] Implement default configuration values - -When adding new config values to the configuration files, it's possible -that due to the installation the configuration files won't get updated, -when they are modified by an user/administrator on that given system. - -By using defaults, we can override this problem and ensure a proper -application start, when config values are missing which are mandatory, -to the functionality. - -Change-Id: I5ce9d457e826448aad205ce4abda5dc4b0210804 -Signed-off-by: Vinzenz Feenstra <vfeenstr@redhat.com> -Bug-Url: https://bugzilla.redhat.com/1101129 ---- - Makefile.am | 1 + - configurations/Makefile.am | 16 +++++++ - configurations/default-logger.conf | 41 ++++++++++++++++ - configurations/default.conf | 19 ++++++++ - configurations/ovirt-guest-agent.conf | 63 +++++++++++++++++++++++++ - configure.ac | 1 + - ovirt-guest-agent.rhel6.spec | 3 ++ - ovirt-guest-agent.spec | 3 ++ - ovirt-guest-agent/Makefile.am | 8 +--- - ovirt-guest-agent/Makefile.el5 | 3 +- - ovirt-guest-agent/OVirtGuestService.py | 28 +++++++++-- - ovirt-guest-agent/bytesio.py | 40 ++++++++++++++++ - ovirt-guest-agent/ovirt-guest-agent.conf | 61 ------------------------ - ovirt-guest-agent/ovirt-guest-agent.py | 25 +++++++++- - 19 files changed, 341 insertions(+), 127 deletions(-) - create mode 100644 configurations/Makefile.am - create mode 100644 configurations/default-logger.conf - create mode 100644 configurations/default.conf - create mode 100644 configurations/ovirt-guest-agent.conf - create mode 100644 ovirt-guest-agent/bytesio.py - delete mode 100644 ovirt-guest-agent/ovirt-guest-agent.conf - -diff --git a/Makefile.am b/Makefile.am -index ff73c6a..acc2eee 100644 ---- a/Makefile.am -+++ b/Makefile.am -@@ -1,6 +1,7 @@ - ACLOCAL_AMFLAGS=-I m4 - - SUBDIRS = \ -+ configurations \ - ovirt-guest-agent \ - GinaSSO \ - tests \ -diff --git a/configurations/Makefile.am b/configurations/Makefile.am -new file mode 100644 -index 0000000..2f2864e ---- /dev/null -+++ b/configurations/Makefile.am -@@ -0,0 +1,13 @@ -+ -+EXTRA_DIST= \ -+ $(NULL) -+ -+agentconfdir=$(sysconfdir) -+dist_agentconf_DATA=ovirt-guest-agent.conf -+ -+agentdefaultconfdir=$(datadir)/ovirt-guest-agent -+dist_agentdefaultconf_DATA=\ -+ default.conf \ -+ default-logger.conf \ -+ $(NULL) -+ -diff --git a/configurations/default-logger.conf b/configurations/default-logger.conf -new file mode 100644 -index 0000000..898fb92 ---- /dev/null -+++ b/configurations/default-logger.conf -@@ -0,0 +1,41 @@ -+[loggers] -+keys=root -+ -+[handlers] -+keys=console,syslog,logfile -+ -+[formatters] -+keys=long,simple,none,sysform -+ -+[logger_root] -+level=INFO -+handlers=logfile -+propagate=0 -+ -+[handler_syslog] -+class=handlers.SysLogHandler -+formatter=sysform -+args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER) -+ -+[handler_logfile] -+class=handlers.RotatingFileHandler -+args=('/var/log/ovirt-guest-agent/ovirt-guest-agent.log', 'a', 100*1024, 5) -+formatter=long -+ -+[handler_console] -+class: StreamHandler -+args: [] -+formatter: none -+ -+[formatter_simple] -+format: %(name)s:%(levelname)s: %(message)s -+ -+[formatter_none] -+format: %(message)s -+ -+[formatter_long] -+format: %(threadName)s::%(levelname)s::%(asctime)s::%(module)s::%(lineno)d::%(name)s::%(message)s -+ -+[formatter_sysform] -+format= %(asctime)s %(levelname)s %(message)s -+datefmt= -diff --git a/configurations/default.conf b/configurations/default.conf -new file mode 100644 -index 0000000..c377f0c ---- /dev/null -+++ b/configurations/default.conf -@@ -0,0 +1,19 @@ -+# -+# default.conf -+# -+ -+[general] -+ -+heart_beat_rate = 5 -+report_user_rate = 10 -+report_num_cpu_rate = 60 -+report_application_rate = 120 -+report_disk_usage = 300 -+ -+# RHEL/Fedora Packages: kernel ovirt-guest-agent-common xorg-x11-drv-qxl -+# Debian Packages: linux-image xserver-xorg-video-qxl -+applications_list = kernel rhevm-guest-agent-common xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl -+ignored_fs = rootfs tmpfs autofs cgroup selinuxfs udev mqueue nfsd proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts securityfs debugfs binfmt_misc fuse.gvfsd-fuse fuse.gvfs-fuse-daemon fusectl usbfs -+ -+[virtio] -+device = /dev/virtio-ports/com.redhat.rhevm.vdsm -diff --git a/configurations/ovirt-guest-agent.conf b/configurations/ovirt-guest-agent.conf -new file mode 100644 -index 0000000..80509f5 ---- /dev/null -+++ b/configurations/ovirt-guest-agent.conf -@@ -0,0 +1,63 @@ -+# -+# ovirt-guest-agent.conf -+# -+ -+[general] -+ -+# heart_beat_rate = 5 -+# report_user_rate = 10 -+# report_num_cpu_rate = 60 -+# report_application_rate = 120 -+# report_disk_usage = 300 -+ -+## Generic: ovirt-guest-agent -+## RHEL/Fedora Packages: kernel ovirt-guest-agent-common xorg-x11-drv-qxl -+## Debian Packages: linux-image xserver-xorg-video-qxl -+## openSUSE Packages: xf86-video-qxl kernel-desktop kernel-default kernel-trace kernel-vanilla kernel-debug kernel-ec2 kernel-xen -+# applications_list = kernel ovirt-guest-agent ovirt-guest-agent-common xorg-x11-drv-qxl linux-image xserver-xorg-video-qxl xf86-video-qxl kernel-desktop kernel-default kernel-trace kernel-vanilla kernel-debug kernel-ec2 kernel-xen -+# ignored_fs = rootfs tmpfs autofs cgroup selinuxfs udev mqueue nfsd proc sysfs devtmpfs hugetlbfs rpc_pipefs devpts securityfs debugfs binfmt_misc fuse.gvfsd-fuse fuse.gvfs-fuse-daemon fusectl usbfs -+ -+[virtio] -+# device = /dev/virtio-ports/com.redhat.rhevm.vdsm -+ -+#[loggers] -+#keys=root -+ -+#[handlers] -+#keys=console,syslog,logfile -+ -+#[formatters] -+#keys=long,simple,none,sysform -+ -+#[logger_root] -+#level=INFO -+#handlers=logfile -+#propagate=0 -+ -+#[handler_syslog] -+#class=handlers.SysLogHandler -+#formatter=sysform -+#args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER) -+ -+#[handler_logfile] -+#class=handlers.RotatingFileHandler -+#args=('/var/log/ovirt-guest-agent/ovirt-guest-agent.log', 'a', 100*1024, 5) -+#formatter=long -+ -+#[handler_console] -+#class: StreamHandler -+#args: [] -+#formatter: none -+ | ||
[+] | Deleted | _service ^ |
@@ -1,7 +0,0 @@ -<services> - <service name="download_src_package"> - <param name="host">ftp.redhat.de</param> - <param name="protocol">http</param> - <param name="path">/redhat/linux/enterprise/6Server/en/RHEV/SRPMS/rhevm-guest-agent-1.0.9-4.el6ev.src.rpm</param> - </service> -</services> \ No newline at end of file | ||
Deleted | _service:download_src_package:gdm-2.30.4-48.el6.src.rpm ^ | |
Deleted | _service:download_src_package:ovirt-guest-agent-1.0.9.tar.bz2 ^ | |
Added | gdm-2.30.4-48.el6.src.rpm ^ | |
Added | ovirt-guest-agent-1.0.9.tar.bz2 ^ |