[packages/libvirt] - build wireshark dissector - dropped outdated lxc patch

qboosh qboosh at pld-linux.org
Fri Aug 4 19:40:15 CEST 2017


commit af7f943c7834dcd0fd0a11e637dadba933065863
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Fri Aug 4 19:42:17 2017 +0200

    - build wireshark dissector
    - dropped outdated lxc patch

 libvirt-lxc.patch | 194 ------------------------------------------------------
 libvirt.spec      |  49 ++++++++++----
 2 files changed, 36 insertions(+), 207 deletions(-)
---
diff --git a/libvirt.spec b/libvirt.spec
index c00e740..45c2382 100644
--- a/libvirt.spec
+++ b/libvirt.spec
@@ -1,33 +1,35 @@
 # TODO:
-# - wireshark-dissector (BR: pkgconfig(wireshark) >= 1.11.3)
 # - parallels-sdk >= 7.0.22?
 # - virtuozzo storage?
-# - seems that lxc patch is not needed anymore, verify that before removing
 # - pldize virtlockd.init
-# - updated vserver patch, if anybody needs it
+# - update vserver patch, if anybody needs it
 #
 # Conditional build:
-%bcond_without	ceph		# RADOS BD (Ceph) storage support
+# - virtualization
 %bcond_without	esx		# VMware ESX support
-%bcond_without	glusterfs	# GlusterFS storage support
 %bcond_without	hyperv		# Hyper-V support
 %bcond_without	libxl		# libxenlight support
 %bcond_without	lxc		# LXC support
-%bcond_without	netcf		# host interfaces support
 %bcond_without	openvz		# OpenVZ support
 %bcond_without	phyp		# PHYP support
-%bcond_without	polkit		# PolicyKit support
 %bcond_without	qemu		# Qemu support
-%bcond_without	sanlock		# sanlock storage lock manager
-%bcond_without	systemtap	# systemtap/dtrace probes
 %bcond_without	uml		# UML support
 %bcond_without	vbox		# VirtualBox support
 %bcond_without	vmware		# VMware Workstation/Player support
 %bcond_with	vserver		# Support for Linux-VServer guests
 %bcond_without	xenapi		# Xen API (Citrix XenServer) support
 %bcond_without	xen		# Xen support
+# - storage
+%bcond_without	ceph		# RADOS BD (Ceph) storage support
+%bcond_without	glusterfs	# GlusterFS storage support
+# - storage locking
+%bcond_without	sanlock		# sanlock storage lock manager
+# - other
+%bcond_without	netcf		# host interfaces support
+%bcond_without	polkit		# PolicyKit support
+%bcond_without	systemtap	# systemtap/dtrace probes
+%bcond_without	wireshark	# wireshark dissector module
 %bcond_without	static_libs	# static libraries build
-%bcond_without	ldap		# don't require openldap-devel
 
 # qemu available only on x86 and ppc
 %ifnarch %{ix86} %{x8664} ppc
@@ -53,7 +55,6 @@ Source0:	http://libvirt.org/sources/libvirt-%{version}.tar.xz
 Source1:	%{name}.init
 Source2:	%{name}.tmpfiles
 Patch0:		%{name}-sasl.patch
-Patch1:		%{name}-lxc.patch
 Patch2:		%{name}-qemu-acl.patch
 Patch3:		virtlockd.init.patch
 Patch4:		%{name}-udevadm-settle.patch
@@ -94,7 +95,6 @@ BuildRequires:	libxslt-devel
 BuildRequires:	ncurses-devel
 %{?with_netcf:BuildRequires:	netcf-devel >= 0.2.0}
 BuildRequires:	numactl-devel
-%{?with_ldap:BuildRequires:	openldap-devel}
 %{?with_hyperv:BuildRequires:	openwsman-devel >= 2.2.3}
 BuildRequires:	parted-devel >= 1.8.0
 BuildRequires:	pkgconfig
@@ -106,6 +106,7 @@ BuildRequires:	rpmbuild(macros) >= 1.627
 BuildRequires:	systemd-devel
 %{?with_systemtap:BuildRequires:	systemtap-sdt-devel}
 BuildRequires:	udev-devel >= 1:218
+%{?with_wireshark:BuildRequires:	wireshark-devel >= 1.11.3}
 %{?with_xen:BuildRequires:	xen-devel >= 4.2}
 %{?with_libxl:BuildRequires:	xen-devel >= 4.4}
 # For disk driver
@@ -449,10 +450,21 @@ systemtap/dtrace probes for libvirt.
 %description -n systemtap-libvirt -l pl.UTF-8
 Sondy systemtap/dtrace dla libvirt.
 
+%package -n wireshark-libvirt
+Summary:	Wireshark dissector module for libvirt packets
+Summary(pl.UTF-8):	Moduł sekcji Wiresharka do pakietów libvirt
+Group:		Libraries
+Requires:	wireshark >= 1.11.3
+
+%description -n wireshark-libvirt
+Wireshark dissector module for libvirt packets.
+
+%description -n wireshark-libvirt -l pl.UTF-8
+Moduł sekcji Wiresharka do pakietów libvirt.
+
 %prep
 %setup -q
 %patch0 -p1
-#%%patch1 -p1
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
@@ -548,6 +560,7 @@ Sondy systemtap/dtrace dla libvirt.
 	%{__with_without vbox vbox %{_libdir}/VirtualBox} \
 	--with-virtualport \
 	%{__with_without vmware} \
+	%{!?with_wireshark:--without-wireshark-dissector} \
 	%{__with_without xen} \
 	%{__with_without xenapi} \
 	--with-yajl \
@@ -579,6 +592,10 @@ cp -p %{SOURCE2} $RPM_BUILD_ROOT%{systemdtmpfilesdir}/%{name}.conf
 %{__rm} $RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.la \
 	%{?with_static_libs:$RPM_BUILD_ROOT%{_libdir}/libvirt/lock-driver/*.a}
 %endif
+%if %{with wireshark}
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.la \
+	%{?with_static_libs:$RPM_BUILD_ROOT%{_libdir}/wireshark/plugins/*/libvirt.a} \
+%endif
 
 %find_lang %{name}
 
@@ -884,3 +901,9 @@ fi
 %{_datadir}/systemtap/tapset/libvirt_probes.stp
 %{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp
 %endif
+
+%if %{with wireshark}
+%files -n wireshark-libvirt
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/wireshark/plugins/*/libvirt.so
+%endif
diff --git a/libvirt-lxc.patch b/libvirt-lxc.patch
deleted file mode 100644
index f0d8f7d..0000000
--- a/libvirt-lxc.patch
+++ /dev/null
@@ -1,194 +0,0 @@
---- libvirt-0.9.13/src/lxc/lxc_controller.c.orig	2012-06-25 09:06:18.000000000 +0200
-+++ libvirt-0.9.13/src/lxc/lxc_controller.c	2012-07-08 11:48:06.949684744 +0200
-@@ -44,6 +44,7 @@
- #include <grp.h>
- #include <sys/stat.h>
- #include <time.h>
-+#include <sys/time.h>
- 
- #if HAVE_CAPNG
- # include <cap-ng.h>
-@@ -558,6 +559,7 @@
-     return ret;
- }
- 
-+static virCgroupPtr domain_cgroup = NULL;
- 
- /**
-  * lxcSetContainerResources
-@@ -617,10 +619,13 @@
-                              _("Unable to add task %d to cgroup for domain %s"),
-                              getpid(), def->name);
-     }
-+    domain_cgroup = cgroup;
-+    goto out;
- 
- cleanup:
--    virCgroupFree(&driver);
-     virCgroupFree(&cgroup);
-+out:
-+    virCgroupFree(&driver);
- 
-     return rc;
- }
-@@ -709,6 +714,63 @@
- static bool quit = false;
- static virMutex lock;
- static int sigpipe[2];
-+static pid_t initpid = -1;
-+
-+static void lxcSignalALRMHandler(int signum ATTRIBUTE_UNUSED)
-+{
-+    int tasks = 0;
-+    char *keypath = NULL;
-+    int rc = -1;
-+    FILE *fp;
-+
-+    if (initpid <= 0)
-+        return;
-+    if (domain_cgroup == NULL)
-+        return;
-+
-+    rc = virCgroupPathOfController(domain_cgroup, -1, "tasks", &keypath);
-+    if (rc != 0) {
-+        VIR_DEBUG("No path of cgroup tasks");
-+        return;
-+    }
-+
-+    if (!(fp = fopen(keypath, "r"))) {
-+        VIR_DEBUG("Failed to read %s: %m\n", keypath);
-+        return;
-+    }
-+    while (!feof(fp)) {
-+        unsigned long pid_value;
-+        if (fscanf(fp, "%lu", &pid_value) != 1) {
-+            if (feof(fp))
-+                 break;
-+            rc = -errno;
-+            VIR_DEBUG("Failed to read %s: %m\n", keypath);
-+            fclose(fp);
-+            return;
-+        }
-+        tasks++;
-+    }
-+    fclose(fp);
-+    VIR_DEBUG("Tasks left: %d", tasks);
-+    /* Kill init if it's the only process left beside container controller process */
-+    if (tasks == 2)
-+        kill(initpid, SIGKILL);
-+}
-+
-+static void lxcSignalINTHandler(int signum ATTRIBUTE_UNUSED)
-+{
-+    struct itimerval timer;
-+
-+    if (initpid <= 0)
-+        return;
-+    kill(initpid, SIGINT);
-+
-+    timer.it_interval.tv_sec = 1;
-+    timer.it_interval.tv_usec = 0;
-+    timer.it_value.tv_sec = 1;
-+    timer.it_value.tv_usec = 0;
-+    setitimer(ITIMER_REAL, &timer, NULL);
-+}
- 
- static void lxcSignalChildHandler(int signum ATTRIBUTE_UNUSED)
- {
-@@ -1134,6 +1196,18 @@
-         goto cleanup;
-     }
- 
-+    if (signal(SIGINT, lxcSignalINTHandler) == SIG_ERR) {
-+        virReportSystemError(errno, "%s",
-+                             _("Cannot install signal handler"));
-+        goto cleanup;
-+    }
-+
-+    if (signal(SIGALRM, lxcSignalALRMHandler) == SIG_ERR) {
-+        virReportSystemError(errno, "%s",
-+                             _("Cannot install signal handler"));
-+        goto cleanup;
-+    }
-+
-     VIR_DEBUG("serverFd=%d clientFd=%d",
-               serverFd, clientFd);
-     virResetLastError();
-@@ -1539,6 +1613,7 @@
-         goto cleanup;
-     VIR_FORCE_CLOSE(control[1]);
-     VIR_FORCE_CLOSE(containerhandshake[1]);
-+    initpid = container;
- 
-     if (lxcControllerMoveInterfaces(nveths, veths, container) < 0)
-         goto cleanup;
-diff -ur libvirt-0.9.12/src/lxc/lxc_driver.c libvirt-0.9.12-lxc/src/lxc/lxc_driver.c
---- libvirt-0.9.12/src/lxc/lxc_driver.c	2012-05-02 05:08:53.000000000 +0200
-+++ libvirt-0.9.12-lxc/src/lxc/lxc_driver.c	2012-05-16 19:54:48.946901077 +0200
-@@ -3751,6 +3751,58 @@
- }
- 
- static int
-+lxcDomainShutdown (virDomainPtr dom)
-+{
-+    lxc_driver_t *driver = dom->conn->privateData;
-+    virDomainObjPtr vm;
-+    virDomainEventPtr event = NULL;
-+    int ret = -1;
-+
-+    lxcDriverLock(driver);
-+    vm = virDomainFindByUUID(&driver->domains, dom->uuid);
-+    if (!vm) {
-+        char uuidstr[VIR_UUID_STRING_BUFLEN];
-+        virUUIDFormat(dom->uuid, uuidstr);
-+        lxcError(VIR_ERR_NO_DOMAIN,
-+                 _("No domain with matching uuid '%s'"), uuidstr);
-+        goto cleanup;
-+    }
-+
-+    if (!virDomainObjIsActive(vm)) {
-+        lxcError(VIR_ERR_OPERATION_INVALID,
-+                 "%s", _("Domain is not running"));
-+        goto cleanup;
-+    }
-+
-+    if (vm->pid <= 0) {
-+        lxcError(VIR_ERR_INTERNAL_ERROR,
-+                 _("Invalid PID %d for container"), vm->pid);
-+        goto cleanup;
-+    }
-+
-+    if (kill(vm->pid, SIGINT) < -1)
-+        goto cleanup;
-+    ret = 0;
-+
-+    event = virDomainEventNewFromObj(vm,
-+                                     VIR_DOMAIN_EVENT_STOPPED,
-+                                     VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN);
-+    virDomainAuditStop(vm, "shutdown");
-+    if (!vm->persistent) {
-+        virDomainRemoveInactive(&driver->domains, vm);
-+        vm = NULL;
-+    }
-+
-+cleanup:
-+    if (vm)
-+        virDomainObjUnlock(vm);
-+    if (event)
-+        lxcDomainEventQueue(driver, event);
-+    lxcDriverUnlock(driver);
-+    return ret;
-+}
-+
-+static int
- lxcDomainOpenConsole(virDomainPtr dom,
-                       const char *dev_name,
-                       virStreamPtr st,
-@@ -3866,6 +3918,7 @@
-     .domainLookupByName = lxcDomainLookupByName, /* 0.4.2 */
-     .domainSuspend = lxcDomainSuspend, /* 0.7.2 */
-     .domainResume = lxcDomainResume, /* 0.7.2 */
-+    .domainShutdown = lxcDomainShutdown, /* PLD */
-     .domainDestroy = lxcDomainDestroy, /* 0.4.4 */
-     .domainDestroyFlags = lxcDomainDestroyFlags, /* 0.9.4 */
-     .domainGetOSType = lxcGetOSType, /* 0.4.2 */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/libvirt.git/commitdiff/af7f943c7834dcd0fd0a11e637dadba933065863



More information about the pld-cvs-commit mailing list