Squashed 'import-layers/meta-virtualization/' content from commit c4a1711

Change-Id: I42132e4f0aef12ec265e74d95f489a6409e22f46
git-subtree-dir: import-layers/meta-virtualization
git-subtree-split: c4a1711dd31659b027c70c07e4ef6da98591ac95
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt-1.3.2/0001-to-fix-build-error.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt-1.3.2/0001-to-fix-build-error.patch
new file mode 100644
index 0000000..089ee33
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt-1.3.2/0001-to-fix-build-error.patch
@@ -0,0 +1,46 @@
+From 8353dc1e642011199c3b3ba057d51d8768e4cd54 Mon Sep 17 00:00:00 2001
+From: Lei Maohui <leimaohui@cn.fujitsu.com>
+Date: Fri, 31 Jul 2015 03:17:07 +0900
+Subject: [PATCH] to fix build error
+
+The error likes as following
+
+| Generating internals/command.html.tmp
+| /bin/sh: line 3: internals/command.html.tmp: No such file or directory
+| rm: Generating internals/locking.html.tmp
+| cannot remove `internals/command.html.tmp': No such file or directory
+| make[3]: *** [internals/command.html.tmp] Error 1
+| make[3]: *** Waiting for unfinished jobs....
+
+Signed-off-by: Lei Maohui <leimaohui@cn.fujitsu.com>
+[ywei: rebased to libvirt-1.3.2]
+Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com>
+---
+ docs/Makefile.am | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/docs/Makefile.am b/docs/Makefile.am
+index 1b4353b..c199551 100644
+--- a/docs/Makefile.am
++++ b/docs/Makefile.am
+@@ -164,7 +164,7 @@ EXTRA_DIST=					\
+   todo.pl hvsupport.pl todo.cfg-example \
+   $(schema_DATA)
+ 
+-acl_generated = aclperms.htmlinc
++acl.html:: $(srcdir)/aclperms.htmlinc
+ 
+ $(srcdir)/aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \
+         $(srcdir)/genaclperms.pl Makefile.am
+@@ -221,7 +221,7 @@ $(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \
+ 	convert -rotate 90 $< $@
+ 
+ %.html.tmp: %.html.in site.xsl subsite.xsl page.xsl \
+-		sitemap.html.in $(acl_generated)
++		sitemap.html.in
+ 	@if [ -x $(XSLTPROC) ] ; then \
+ 	  echo "Generating $@"; \
+ 	  name=`echo $@ | sed -e 's/.tmp//'`; \
+-- 
+1.9.1
+
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt-python.inc b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt-python.inc
new file mode 100644
index 0000000..c1dafe9
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt-python.inc
@@ -0,0 +1,55 @@
+inherit pythonnative python-dir
+
+export STAGING_INCDIR
+export STAGING_LIBDIR
+export BUILD_SYS 
+export HOST_SYS
+
+RDEPENDS_${PN}-python += "python"
+PACKAGECONFIG_${PN}-python[xen] = ",,,xen-python"
+
+PACKAGES += "${PN}-python-staticdev ${PN}-python-dev ${PN}-python-dbg ${PN}-python"
+
+FILES_${PN}-python-staticdev += "${PYTHON_SITEPACKAGES_DIR}/*.a"
+FILES_${PN}-python-dev += "${PYTHON_SITEPACKAGES_DIR}/*.la"
+FILES_${PN}-python-dbg += "${PYTHON_SITEPACKAGES_DIR}/.debug/"
+FILES_${PN}-python = "${bindir}/* ${libdir}/* ${libdir}/${PYTHON_DIR}/*"
+
+SRC_URI += "http://libvirt.org/sources/python/libvirt-python-${PV}.tar.gz;name=libvirt_python"
+SRC_URI += "file://libvirt_api_xml_path.patch;patchdir=../libvirt-python-${PV}"
+
+SRC_URI[libvirt_python.md5sum] = "ed018c714d7ddbe93221c796dff283ed"
+SRC_URI[libvirt_python.sha256sum] = "6d35ae9e7801573393b9c92471f39e6700d479f10b641df81d041b469f160bf8"
+
+export LIBVIRT_API_PATH = "${S}/docs/libvirt-api.xml"
+export LIBVIRT_CFLAGS = "-I${S}/include"
+export LIBVIRT_LIBS = "-L${B}/src/.libs -lvirt -ldl"
+export LDFLAGS="-L${B}/src/.libs"
+
+LIBVIRT_INSTALL_ARGS = "--root=${D} \
+    --prefix=${prefix} \
+    --install-lib=${PYTHON_SITEPACKAGES_DIR} \
+    --install-data=${datadir}"
+
+python __anonymous () {
+    pkgconfig = d.getVar('PACKAGECONFIG', True)
+    if ('python') in pkgconfig.split():
+        d.setVar('LIBVIRT_PYTHON_ENABLE', '1')
+    else:
+        d.setVar('LIBVIRT_PYTHON_ENABLE', '0')
+}
+
+do_compile_append() {
+	if [ "${LIBVIRT_PYTHON_ENABLE}" = "1" ]; then
+		cd ${WORKDIR}/libvirt-python-${PV} && \
+		  ${STAGING_BINDIR_NATIVE}/python-native/python setup.py build
+	fi
+}
+
+do_install_append() {
+	if [ "${LIBVIRT_PYTHON_ENABLE}" = "1" ]; then
+		cd ${WORKDIR}/${PN}-python-${PV} && \
+		  ${STAGING_BINDIR_NATIVE}/python-native/python setup.py install \
+                       --install-lib=${D}/${PYTHON_SITEPACKAGES_DIR} ${LIBVIRT_INSTALL_ARGS}
+	fi
+}
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/Revert-build-add-prefix-to-SYSTEMD_UNIT_DIR.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/Revert-build-add-prefix-to-SYSTEMD_UNIT_DIR.patch
new file mode 100644
index 0000000..16c3a16
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/Revert-build-add-prefix-to-SYSTEMD_UNIT_DIR.patch
@@ -0,0 +1,64 @@
+From dd915e7f70e676aea93f750c75d16ce646e71e4b Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <mark.asselstine@windriver.com>
+Date: Wed, 9 Sep 2015 11:52:44 -0400
+Subject: [PATCH] Revert "build: add $(prefix) to SYSTEMD_UNIT_DIR"
+
+This reverts upstream commit 00e9d6071b2450659ce01bc984f64ecb5d7ba62d
+with minor context changes to allow it to apply.
+
+Yocto based builds use /lib/systemd/system for systemd unit files and
+since upstream has chosen to use a mechanism for setting
+SYSTEMD_UNIT_DIR which is not flexible we have to resort to reverting
+this upstream commit to avoid having ${prefix} added to the path.
+
+Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
+[ywei: rebased to libvirt-1.3.2]
+Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com>
+---
+ daemon/Makefile.am | 2 +-
+ src/Makefile.am    | 2 +-
+ tools/Makefile.am  | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/daemon/Makefile.am b/daemon/Makefile.am
+index 2dbe81b..41ea2db 100644
+--- a/daemon/Makefile.am
++++ b/daemon/Makefile.am
+@@ -445,7 +445,7 @@ endif ! LIBVIRT_INIT_SCRIPT_UPSTART
+ 
+ if LIBVIRT_INIT_SCRIPT_SYSTEMD
+ 
+-SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
++SYSTEMD_UNIT_DIR = /lib/systemd/system
+ BUILT_SOURCES += libvirtd.service libvirtd.socket
+ 
+ install-init-systemd: install-sysconfig libvirtd.service libvirtd.socket
+diff --git a/src/Makefile.am b/src/Makefile.am
+index a316b4d..d271291 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -2594,7 +2594,7 @@ EXTRA_DIST += \
+ if WITH_LIBVIRTD
+ if LIBVIRT_INIT_SCRIPT_SYSTEMD
+ 
+-SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
++SYSTEMD_UNIT_DIR = /lib/systemd/system
+ 
+ BUILT_SOURCES += virtlockd.service virtlockd.socket \
+ 		 virtlogd.service virtlogd.socket
+diff --git a/tools/Makefile.am b/tools/Makefile.am
+index b3227a7..0e58f73 100644
+--- a/tools/Makefile.am
++++ b/tools/Makefile.am
+@@ -356,7 +356,7 @@ libvirt-guests.init: libvirt-guests.init.in libvirt-guests.sh
+ 
+ 
+ EXTRA_DIST += libvirt-guests.service.in
+-SYSTEMD_UNIT_DIR = $(prefix)/lib/systemd/system
++SYSTEMD_UNIT_DIR = /lib/systemd/system
+ 
+ if LIBVIRT_INIT_SCRIPT_SYSTEMD
+ install-systemd: libvirt-guests.service install-sysconfig libvirt-guests.sh
+-- 
+1.9.1
+
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch
new file mode 100644
index 0000000..558d5ef
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-1.0.3-fix-thread-safety-in-lxc-callback-handling.patch
@@ -0,0 +1,63 @@
+From ad5d9cee87357f9f38f62583119606ef95ba10df Mon Sep 17 00:00:00 2001
+From: Bogdan Purcareata <bogdan.purcareata@freescale.com>
+Date: Fri, 24 May 2013 16:46:00 +0300
+Subject: [PATCH] Fix thread safety in LXC callback handling
+
+Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
+---
+ src/lxc/lxc_process.c | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
+index aaa81a7..0eadc67 100644
+--- a/src/lxc/lxc_process.c
++++ b/src/lxc/lxc_process.c
+@@ -609,8 +609,13 @@ static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
+                                            virLXCProtocolExitStatus status,
+                                            virDomainObjPtr vm)
+ {
++    virLXCDriverPtr driver = lxc_driver;
+     virLXCDomainObjPrivatePtr priv = vm->privateData;
+ 
++    lxcDriverLock(driver);
++    virObjectLock(vm);
++    lxcDriverUnlock(driver);
++
+     switch (status) {
+     case VIR_LXC_PROTOCOL_EXIT_STATUS_SHUTDOWN:
+         priv->stopReason = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN;
+@@ -628,6 +633,8 @@ static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
+     }
+     VIR_DEBUG("Domain shutoff reason %d (from status %d)",
+               priv->stopReason, status);
++
++    virObjectUnlock(vm);
+ }
+ 
+ /* XXX a little evil */
+@@ -636,12 +643,21 @@ static void virLXCProcessMonitorInitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED
+                                            pid_t initpid,
+                                            virDomainObjPtr vm)
+ {
+-    virLXCDomainObjPrivatePtr priv = vm->privateData;
++    virLXCDriverPtr driver = lxc_driver;
++    virLXCDomainObjPrivatePtr priv;
++
++    lxcDriverLock(driver);
++    virObjectLock(vm);
++    lxcDriverUnlock(driver);
++
++    priv = vm->privateData;
+     priv->initpid = initpid;
+     virDomainAuditInit(vm, initpid);
+ 
+     if (virDomainSaveStatus(lxc_driver->caps, lxc_driver->stateDir, vm) < 0)
+         VIR_WARN("Cannot update XML with PID for LXC %s", vm->def->name);
++
++    virObjectUnlock(vm);
+ }
+ 
+ static virLXCMonitorCallbacks monitorCallbacks = {
+-- 
+1.7.11.7
+
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-use-pkg-config-to-locate-libcap.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-use-pkg-config-to-locate-libcap.patch
new file mode 100644
index 0000000..65b046e
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt-use-pkg-config-to-locate-libcap.patch
@@ -0,0 +1,45 @@
+From 3e271f6db12ffe34843428ec2f0bca7a8fe3aa65 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@windriver.com>
+Date: Wed, 8 Apr 2015 13:03:03 -0400
+Subject: [PATCH] libvirt: use pkg-config to locate libcap
+
+libvirt wants to use pcap-config to locate the exisence and location
+of libpcap. oe-core stubs this script and replaces it with pkg-config,
+which can lead to the host pcap-config triggering and either breaking
+the build or introducing host contamination.
+
+To fix this issue, we patch configure to use 'pkg-config libcap' to
+locate the correct libraries.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
+---
+ configure.ac | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f37047599b76..5f9b84363b96 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1553,7 +1553,7 @@ fi
+ AM_CONDITIONAL([HAVE_NUMAD], [test "$with_numad" != "no"])
+ 
+ dnl pcap lib
+-LIBPCAP_CONFIG="pcap-config"
++LIBPCAP_CONFIG="pkg-config libpcap"
+ LIBPCAP_CFLAGS=""
+ LIBPCAP_LIBS=""
+ LIBPCAP_FOUND="no"
+@@ -1563,8 +1563,8 @@ AC_ARG_WITH([libpcap], [AS_HELP_STRING([--with-libpcap=@<:@PFX@:>@],
+ if test "$with_qemu" = "yes"; then
+   case $with_libpcap in
+     no)     LIBPCAP_CONFIG= ;;
+-    ''|yes) LIBPCAP_CONFIG="pcap-config" ;;
+-    *)      LIBPCAP_CONFIG="$with_libpcap/bin/pcap-config" ;;
++    ''|yes) LIBPCAP_CONFIG="pkg-config libpcap" ;;
++    *)      LIBPCAP_CONFIG="$with_libpcap/bin/pkg-config libpcap" ;;
+   esac
+   AS_IF([test "x$LIBPCAP_CONFIG" != "x"], [
+     AC_MSG_CHECKING(libpcap $LIBPCAP_CONFIG >= $LIBPCAP_REQUIRED )
+-- 
+2.1.0
+
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch
new file mode 100644
index 0000000..3c2622c
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirt_api_xml_path.patch
@@ -0,0 +1,85 @@
+Adding support for LIBVIRT_CFLAGS and LIBVIRT_LIBS
+
+Signed-off-by: Amy Fong <amy.fong@windriver.com>
+
+
+Adding a support for LIBVIRT_API_PATH evironment variable, which can
+control where the script should look for the 'libvirt-api.xml' file.
+This allows building libvirt-python against different libvirt than the
+one installed in the system.  This may be used for example in autotest
+or by packagers without the need to install libvirt into the system.
+
+Signed-off-by: Martin Kletzander <mkletzan redhat com>
+[ywei: rebased to 1.3.2]
+Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com>
+---
+ setup.py |   25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+Index: libvirt-python-1.2.4/setup.py
+===================================================================
+--- libvirt-python-1.2.4.orig/setup.py
++++ libvirt-python-1.2.4/setup.py
+@@ -40,13 +40,7 @@
+            "libvirt"])
+ 
+ def have_libvirt_lxc():
+-    try:
+-        spawn([get_pkgcfg(),
+-               "--atleast-version=%s" % MIN_LIBVIRT_LXC,
+-             "libvirt"])
+-        return True
+-    except DistutilsExecError:
+-        return False
++    return True
+ 
+ def get_pkgconfig_data(args, mod, required=True):
+     """Run pkg-config to and return content associated with it"""
+@@ -68,7 +62,17 @@
+     """Check with pkg-config that libvirt is present and extract
+     the API XML file paths we need from it"""
+ 
+-    libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"], "libvirt")
++    libvirt_api = os.getenv("LIBVIRT_API_PATH")
++
++    if libvirt_api:
++        if not libvirt_api.endswith("-api.xml"):
++            raise ValueError("Invalid path '%s' for API XML" % libvirt_api)
++        if not os.path.exists(libvirt_api):
++            raise ValueError("API XML '%s' does not exist, "
++                             "have you built libvirt?" % libvirt_api)
++    else:
++        libvirt_api = get_pkgconfig_data(["--variable", "libvirt_api"],
++                                         "libvirt")
+ 
+     offset = libvirt_api.index("-api.xml")
+     libvirt_qemu_api = libvirt_api[0:offset] + "-qemu-api.xml"
+@@ -88,8 +92,17 @@
+ 
+     c_modules = []
+     py_modules = []
+-    ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split()
+-    cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split()
++    libvirt_cflags = os.getenv("LIBVIRT_CFLAGS")
++    if libvirt_cflags:
++        cflags = libvirt_cflags.split()
++    else:
++        cflags = get_pkgconfig_data(["--cflags"], "libvirt", False).split()
++
++    libvirt_libs = os.getenv("LIBVIRT_LIBS")
++    if libvirt_libs:
++        ldflags = libvirt_libs.split()
++    else:
++        ldflags = get_pkgconfig_data(["--libs-only-L"], "libvirt", False).split()
+ 
+     module = Extension('libvirtmod',
+                        sources = ['libvirt-override.c', 'build/libvirt.c', 'typewrappers.c', 'libvirt-utils.c'],
+@@ -138,7 +151,7 @@
+ class my_build(build):
+ 
+     def run(self):
+-        check_minimum_libvirt_version()
++#       check_minimum_libvirt_version()
+         apis = get_api_xml_files()
+ 
+         self.spawn([sys.executable, "generator.py", "libvirt", apis[0]])
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.conf b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.conf
new file mode 100644
index 0000000..c0462b4
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.conf
@@ -0,0 +1,393 @@
+# Master libvirt daemon configuration file
+#
+# For further information consult http://libvirt.org/format.html
+#
+# NOTE: the tests/daemon-conf regression test script requires
+# that each "PARAMETER = VALUE" line in this file have the parameter
+# name just after a leading "#".
+
+#################################################################
+#
+# Network connectivity controls
+#
+
+# Flag listening for secure TLS connections on the public TCP/IP port.
+# NB, must pass the --listen flag to the libvirtd process for this to
+# have any effect.
+#
+# It is necessary to setup a CA and issue server certificates before
+# using this capability.
+#
+# This is enabled by default, uncomment this to disable it
+listen_tls = 0
+
+# Listen for unencrypted TCP connections on the public TCP/IP port.
+# NB, must pass the --listen flag to the libvirtd process for this to
+# have any effect.
+#
+# Using the TCP socket requires SASL authentication by default. Only
+# SASL mechanisms which support data encryption are allowed. This is
+# DIGEST_MD5 and GSSAPI (Kerberos5)
+#
+# This is disabled by default, uncomment this to enable it.
+listen_tcp = 1
+
+
+
+# Override the port for accepting secure TLS connections
+# This can be a port number, or service name
+#
+#tls_port = "16514"
+
+# Override the port for accepting insecure TCP connections
+# This can be a port number, or service name
+#
+#tcp_port = "16509"
+
+
+# Override the default configuration which binds to all network
+# interfaces. This can be a numeric IPv4/6 address, or hostname
+#
+#listen_addr = "192.168.0.1"
+
+
+# Flag toggling mDNS advertizement of the libvirt service.
+#
+# Alternatively can disable for all services on a host by
+# stopping the Avahi daemon
+#
+# This is enabled by default, uncomment this to disable it
+#mdns_adv = 0
+
+# Override the default mDNS advertizement name. This must be
+# unique on the immediate broadcast network.
+#
+# The default is "Virtualization Host HOSTNAME", where HOSTNAME
+# is subsituted for the short hostname of the machine (without domain)
+#
+#mdns_name = "Virtualization Host Joe Demo"
+
+
+#################################################################
+#
+# UNIX socket access controls
+#
+
+# Set the UNIX domain socket group ownership. This can be used to
+# allow a 'trusted' set of users access to management capabilities
+# without becoming root.
+#
+# This is restricted to 'root' by default.
+#unix_sock_group = "libvirt"
+
+# Set the UNIX socket permissions for the R/O socket. This is used
+# for monitoring VM status only
+#
+# Default allows any user. If setting group ownership may want to
+# restrict this to:
+#unix_sock_ro_perms = "0777"
+
+# Set the UNIX socket permissions for the R/W socket. This is used
+# for full management of VMs
+#
+# Default allows only root. If PolicyKit is enabled on the socket,
+# the default will change to allow everyone (eg, 0777)
+#
+# If not using PolicyKit and setting group ownership for access
+# control then you may want to relax this to:
+#unix_sock_rw_perms = "0770"
+
+# Set the name of the directory in which sockets will be found/created.
+#unix_sock_dir = "/var/run/libvirt"
+
+#################################################################
+#
+# Authentication.
+#
+#  - none: do not perform auth checks. If you can connect to the
+#          socket you are allowed. This is suitable if there are
+#          restrictions on connecting to the socket (eg, UNIX
+#          socket permissions), or if there is a lower layer in
+#          the network providing auth (eg, TLS/x509 certificates)
+#
+#  - sasl: use SASL infrastructure. The actual auth scheme is then
+#          controlled from /etc/sasl2/libvirt.conf. For the TCP
+#          socket only GSSAPI & DIGEST-MD5 mechanisms will be used.
+#          For non-TCP or TLS sockets,  any scheme is allowed.
+#
+#  - polkit: use PolicyKit to authenticate. This is only suitable
+#            for use on the UNIX sockets. The default policy will
+#            require a user to supply their own password to gain
+#            full read/write access (aka sudo like), while anyone
+#            is allowed read/only access.
+#
+# Set an authentication scheme for UNIX read-only sockets
+# By default socket permissions allow anyone to connect
+#
+# To restrict monitoring of domains you may wish to enable
+# an authentication mechanism here
+#auth_unix_ro = "none"
+
+# Set an authentication scheme for UNIX read-write sockets
+# By default socket permissions only allow root. If PolicyKit
+# support was compiled into libvirt, the default will be to
+# use 'polkit' auth.
+#
+# If the unix_sock_rw_perms are changed you may wish to enable
+# an authentication mechanism here
+#auth_unix_rw = "none"
+
+# Change the authentication scheme for TCP sockets.
+#
+# If you don't enable SASL, then all TCP traffic is cleartext.
+# Don't do this outside of a dev/test scenario. For real world
+# use, always enable SASL and use the GSSAPI or DIGEST-MD5
+# mechanism in /etc/sasl2/libvirt.conf
+#auth_tcp = "sasl"
+
+# Change the authentication scheme for TLS sockets.
+#
+# TLS sockets already have encryption provided by the TLS
+# layer, and limited authentication is done by certificates
+#
+# It is possible to make use of any SASL authentication
+# mechanism as well, by using 'sasl' for this option
+#auth_tls = "none"
+
+
+
+#################################################################
+#
+# TLS x509 certificate configuration
+#
+
+
+# Override the default server key file path
+#
+#key_file = "/etc/pki/libvirt/private/serverkey.pem"
+
+# Override the default server certificate file path
+#
+#cert_file = "/etc/pki/libvirt/servercert.pem"
+
+# Override the default CA certificate path
+#
+#ca_file = "/etc/pki/CA/cacert.pem"
+
+# Specify a certificate revocation list.
+#
+# Defaults to not using a CRL, uncomment to enable it
+#crl_file = "/etc/pki/CA/crl.pem"
+
+
+
+#################################################################
+#
+# Authorization controls
+#
+
+
+# Flag to disable verification of our own server certificates
+#
+# When libvirtd starts it performs some sanity checks against
+# its own certificates.
+#
+# Default is to always run sanity checks. Uncommenting this
+# will disable sanity checks which is not a good idea
+#tls_no_sanity_certificate = 1
+
+# Flag to disable verification of client certificates
+#
+# Client certificate verification is the primary authentication mechanism.
+# Any client which does not present a certificate signed by the CA
+# will be rejected.
+#
+# Default is to always verify. Uncommenting this will disable
+# verification - make sure an IP whitelist is set
+#tls_no_verify_certificate = 1
+
+
+# A whitelist of allowed x509  Distinguished Names
+# This list may contain wildcards such as
+#
+#    "C=GB,ST=London,L=London,O=Red Hat,CN=*"
+#
+# See the POSIX fnmatch function for the format of the wildcards.
+#
+# NB If this is an empty list, no client can connect, so comment out
+# entirely rather than using empty list to disable these checks
+#
+# By default, no DN's are checked
+#tls_allowed_dn_list = ["DN1", "DN2"]
+
+
+# A whitelist of allowed SASL usernames. The format for usernames
+# depends on the SASL authentication mechanism. Kerberos usernames
+# look like username@REALM
+#
+# This list may contain wildcards such as
+#
+#    "*@EXAMPLE.COM"
+#
+# See the POSIX fnmatch function for the format of the wildcards.
+#
+# NB If this is an empty list, no client can connect, so comment out
+# entirely rather than using empty list to disable these checks
+#
+# By default, no Username's are checked
+#sasl_allowed_username_list = ["joe@EXAMPLE.COM", "fred@EXAMPLE.COM" ]
+
+
+
+#################################################################
+#
+# Processing controls
+#
+
+# The maximum number of concurrent client connections to allow
+# over all sockets combined.
+#max_clients = 20
+
+
+# The minimum limit sets the number of workers to start up
+# initially. If the number of active clients exceeds this,
+# then more threads are spawned, upto max_workers limit.
+# Typically you'd want max_workers to equal maximum number
+# of clients allowed
+#min_workers = 5
+#max_workers = 20
+
+
+# The number of priority workers. If all workers from above
+# pool will stuck, some calls marked as high priority
+# (notably domainDestroy) can be executed in this pool.
+#prio_workers = 5
+
+# Total global limit on concurrent RPC calls. Should be
+# at least as large as max_workers. Beyond this, RPC requests
+# will be read into memory and queued. This directly impact
+# memory usage, currently each request requires 256 KB of
+# memory. So by default upto 5 MB of memory is used
+#
+# XXX this isn't actually enforced yet, only the per-client
+# limit is used so far
+#max_requests = 20
+
+# Limit on concurrent requests from a single client
+# connection. To avoid one client monopolizing the server
+# this should be a small fraction of the global max_requests
+# and max_workers parameter
+#max_client_requests = 5
+
+#################################################################
+#
+# Logging controls
+#
+
+# Logging level: 4 errors, 3 warnings, 2 information, 1 debug
+# basically 1 will log everything possible
+#log_level = 3
+
+# Logging filters:
+# A filter allows to select a different logging level for a given category
+# of logs
+# The format for a filter is:
+#    x:name
+#      where name is a match string e.g. remote or qemu
+# the x prefix is the minimal level where matching messages should be logged
+#    1: DEBUG
+#    2: INFO
+#    3: WARNING
+#    4: ERROR
+#
+# Multiple filter can be defined in a single @filters, they just need to be
+# separated by spaces.
+#
+# e.g:
+# log_filters="3:remote 4:event"
+# to only get warning or errors from the remote layer and only errors from
+# the event layer.
+
+# Logging outputs:
+# An output is one of the places to save logging information
+# The format for an output can be:
+#    x:stderr
+#      output goes to stderr
+#    x:syslog:name
+#      use syslog for the output and use the given name as the ident
+#    x:file:file_path
+#      output to a file, with the given filepath
+# In all case the x prefix is the minimal level, acting as a filter
+#    1: DEBUG
+#    2: INFO
+#    3: WARNING
+#    4: ERROR
+#
+# Multiple output can be defined, they just need to be separated by spaces.
+# e.g.:
+# log_outputs="3:syslog:libvirtd"
+# to log all warnings and errors to syslog under the libvirtd ident
+
+# Log debug buffer size: default 64
+# The daemon keeps an internal debug log buffer which will be dumped in case
+# of crash or upon receiving a SIGUSR2 signal. This setting allows to override
+# the default buffer size in kilobytes.
+# If value is 0 or less the debug log buffer is deactivated
+#log_buffer_size = 64
+
+
+##################################################################
+#
+# Auditing
+#
+# This setting allows usage of the auditing subsystem to be altered:
+#
+#   audit_level == 0  -> disable all auditing
+#   audit_level == 1  -> enable auditing, only if enabled on host (default)
+#   audit_level == 2  -> enable auditing, and exit if disabled on host
+#
+#audit_level = 2
+#
+# If set to 1, then audit messages will also be sent
+# via libvirt logging infrastructure. Defaults to 0
+#
+#audit_logging = 1
+
+###################################################################
+# UUID of the host:
+# Provide the UUID of the host here in case the command
+# 'dmidecode -s system-uuid' does not provide a valid uuid. In case
+# 'dmidecode' does not provide a valid UUID and none is provided here, a
+# temporary UUID will be generated.
+# Keep the format of the example UUID below. UUID must not have all digits
+# be the same.
+
+# NB This default all-zeros UUID will not work. Replace
+# it with the output of the 'uuidgen' command and then
+# uncomment this entry
+#host_uuid = "00000000-0000-0000-0000-000000000000"
+
+###################################################################
+# Keepalive protocol:
+# This allows libvirtd to detect broken client connections or even
+# dead client.  A keepalive message is sent to a client after
+# keepalive_interval seconds of inactivity to check if the client is
+# still responding; keepalive_count is a maximum number of keepalive
+# messages that are allowed to be sent to the client without getting
+# any response before the connection is considered broken.  In other
+# words, the connection is automatically closed approximately after
+# keepalive_interval * (keepalive_count + 1) seconds since the last
+# message received from the client.  If keepalive_interval is set to
+# -1, libvirtd will never send keepalive requests; however clients
+# can still send them and the deamon will send responses.  When
+# keepalive_count is set to 0, connections will be automatically
+# closed after keepalive_interval seconds of inactivity without
+# sending any keepalive messages.
+#
+#keepalive_interval = 5
+#keepalive_count = 5
+#
+# If set to 1, libvirtd will refuse to talk to clients that do not
+# support keepalive protocol.  Defaults to 0.
+#
+#keepalive_required = 1
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.sh b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.sh
new file mode 100755
index 0000000..29dbf39
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/libvirtd.sh
@@ -0,0 +1,103 @@
+#!/bin/sh
+### BEGIN INIT INFO
+# Provides: libvirtd
+# Required-Start: $local_fs $network dbus
+# Required-Stop: $local_fs $network dbus
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+### END INIT INFO
+
+if [ -f /lib/lsb/init-functions ]
+then
+    . /lib/lsb/init-functions
+else
+    # int log_begin_message (char *message)
+    log_begin_msg () {
+        if [ -z "$1" ]; then
+	    return 1
+        fi
+        echo " * $@"
+    }
+
+    # int log_end_message (int exitstatus)
+    log_end_msg () {
+	
+    # If no arguments were passed, return
+	[ -z "$1" ] && return 1
+	
+    # Only do the fancy stuff if we have an appropriate terminal
+    # and if /usr is already mounted
+	TPUT=/usr/bin/tput
+	EXPR=/usr/bin/expr
+	if [ -x $TPUT ] && [ -x $EXPR ] && $TPUT hpa 60 >/dev/null 2>&1; then
+	    COLS=`$TPUT cols`
+	    if [ -n "$COLS" ]; then
+		COL=`$EXPR $COLS - 7`
+	    else
+		COL=73
+	    fi
+	    UP=`$TPUT cuu1`
+	    END=`$TPUT hpa $COL`
+	    START=`$TPUT hpa 0`
+	    RED=`$TPUT setaf 1`
+	    NORMAL=`$TPUT op`
+	    if [ $1 -eq 0 ]; then
+		echo "$UP$END[ ok ]"
+	    else
+		echo -e "$UP$START $RED*$NORMAL$END[${RED}fail${NORMAL}]"
+	    fi
+	else
+	    if [ $1 -eq 0 ]; then
+		echo "   ...done."
+	    else
+		echo "   ...fail!"
+	    fi
+	fi
+	return $1
+    }
+    
+    log_warning_msg () {
+	if log_use_fancy_output; then
+	    YELLOW=`$TPUT setaf 3`
+	    NORMAL=`$TPUT op`
+	    echo "$YELLOW*$NORMAL $@"
+	else
+	    echo "$@"
+	fi
+    }
+
+fi
+
+case "$1" in
+        start)
+                if [ -e /var/run/libvirtd.pid ]; then
+                        if [ -d /proc/$(cat /var/run/libvirtd.pid) ]; then
+                                echo "virtualization library already started; not starting."
+                        else
+                                echo "Removing stale PID file /var/run/libvirtd.pid."
+                                rm -f /var/run/libvirtd.pid
+                        fi
+                fi
+                log_begin_msg "Starting virtualization library daemon: libvirtd"
+                if [ ! -e /var/run/libvirtd.pid ]; then
+                    start-stop-daemon -K -x /usr/bin/dnsmasq --pidfile /var/run/libvirt/network/default.pid
+                fi
+		start-stop-daemon --start --quiet --pidfile /var/run/libvirtd.pid --exec /usr/sbin/libvirtd -- --daemon --listen
+                log_end_msg $?
+                ;;
+        stop)
+                log_begin_msg "Stopping virtualization library daemon: libvirtd"
+		start-stop-daemon --stop --quiet --retry 3 --exec /usr/sbin/libvirtd --pidfile /var/run/libvirtd.pid
+                log_end_msg $?
+                rm -f /var/run/libvirtd.pid
+                ;;
+        restart)
+                $0 stop
+                sleep 1
+                $0 start
+                ;;
+        *)
+                echo "Usage: $0 {start|stop|restart}"
+                exit 1
+                ;;
+esac
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch
new file mode 100644
index 0000000..3cf9e83
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/qemu-fix-crash-in-qemuOpen.patch
@@ -0,0 +1,39 @@
+From 74bff2509080912ea8abf1de8fd95fa2412b659a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
+Date: Thu, 11 Apr 2013 11:37:25 +0200
+Subject: [PATCH] qemu: fix crash in qemuOpen
+
+commit 74bff2509080912ea8abf1de8fd95fa2412b659a from upsteam
+git://libvirt.org/libvirt.git
+
+If the path part of connection URI is not present, cfg is used
+unitialized.
+
+https://bugzilla.redhat.com/show_bug.cgi?id=950855
+---
+ src/qemu/qemu_driver.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
+index 2c0d7d1..0d41e39 100644
+--- a/src/qemu/qemu_driver.c
++++ b/src/qemu/qemu_driver.c
+@@ -1026,6 +1026,7 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn,
+             goto cleanup;
+         }
+ 
++        cfg = virQEMUDriverGetConfig(qemu_driver);
+         if (conn->uri->path == NULL) {
+             virReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("no QEMU URI path given, try %s"),
+@@ -1033,7 +1034,6 @@ static virDrvOpenStatus qemuOpen(virConnectPtr conn,
+             goto cleanup;
+         }
+ 
+-        cfg = virQEMUDriverGetConfig(qemu_driver);
+         if (cfg->privileged) {
+             if (STRNEQ(conn->uri->path, "/system") &&
+                 STRNEQ(conn->uri->path, "/session")) {
+-- 
+1.7.1
+
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/run-ptest b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/run-ptest
new file mode 100644
index 0000000..a434b18
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/run-ptest
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+make -C tests -k check-TESTS
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/runptest.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/runptest.patch
new file mode 100644
index 0000000..a33f569
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/runptest.patch
@@ -0,0 +1,113 @@
+Add 'install-ptest' rule.
+Change TESTS_ENVIRONMENT to allow running outside build dir.
+
+Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
+Upstream-status: Pending
+
+Index: libvirt-1.2.4/tests/Makefile.am
+===================================================================
+--- libvirt-1.2.4.orig/tests/Makefile.am
++++ libvirt-1.2.4/tests/Makefile.am
+@@ -31,9 +31,11 @@
+ 	-I$(top_srcdir)/src/conf \
+ 	$(GETTEXT_CPPFLAGS)
+ 
++PTEST_DIR ?= $(libdir)/libvirt/ptest
++
+ AM_CFLAGS = \
+-	-Dabs_builddir="\"$(abs_builddir)\"" \
+-	-Dabs_srcdir="\"$(abs_srcdir)\"" \
++	-Dabs_builddir="\"$(PTEST_DIR)/tests\"" \
++	-Dabs_srcdir="\"$(PTEST_DIR)/tests\"" \
+ 	$(LIBXML_CFLAGS) \
+	$(LIBNL_CFLAGS) \
+ 	$(GNUTLS_CFLAGS) \
+@@ -48,7 +50,7 @@
+ 
+ if WITH_DRIVER_MODULES
+ INCLUDES += \
+-	-DTEST_DRIVER_DIR=\"$(top_builddir)/src/.libs\"
++	-DTEST_DRIVER_DIR=\"$(PTEST_DIR)/src/.libs\"
+ endif WITH_DRIVER_MODULES
+ 
+ PROBES_O =
+@@ -409,20 +411,19 @@
+ # Also, BSD sh doesn't like 'a=b b=$$a', so we can't use an
+ # intermediate shell variable, but must do all the expansion in make
+ 
+-lv_abs_top_builddir=$(shell cd '$(top_builddir)' && pwd)
+ path_add = $(subst :,$(PATH_SEPARATOR),\
+-	$(subst !,$(lv_abs_top_builddir)/,!daemon:!tools:!tests))
++	$(subst !,$(PTEST_DIR)/,!daemon:!tools:!tests))
+ 
+ VIR_TEST_EXPENSIVE ?= $(VIR_TEST_EXPENSIVE_DEFAULT)
+ TESTS_ENVIRONMENT =				\
+-  abs_top_builddir=$(lv_abs_top_builddir)	\
+-  abs_top_srcdir=`cd '$(top_srcdir)'; pwd`	\
+-  abs_builddir=$(abs_builddir)			\
+-  abs_srcdir=$(abs_srcdir)			\
+-  CONFIG_HEADER="$(lv_abs_top_builddir)/config.h"	\
++  abs_top_builddir="$(PTEST_DIR)"             \
++  abs_top_srcdir="$(PTEST_DIR)"               \
++  abs_builddir="$(PTEST_DIR)/tests"           \
++  abs_srcdir="$(PTEST_DIR)/tests"             \
++  CONFIG_HEADER="$(PTEST_DIR)/config.h"       \
+   PATH="$(path_add)$(PATH_SEPARATOR)$$PATH"	\
+   SHELL="$(SHELL)"				\
+-  LIBVIRT_DRIVER_DIR="$(lv_abs_top_builddir)/src/.libs" \
++  LIBVIRT_DRIVER_DIR="$(PTEST_DIR)/src/.libs" \
+   LIBVIRT_AUTOSTART=0				\
+   LC_ALL=C					\
+   VIR_TEST_EXPENSIVE=$(VIR_TEST_EXPENSIVE)	\
+@@ -1137,5 +1138,51 @@
+ EXTRA_DIST += objectlocking.ml
+ endif ! WITH_CIL
+ 
++buildtest-TESTS: $(TESTS) $(test_libraries) $(test_helpers)
++
++PTESTS = $(TESTS) $(test_helpers) test-lib.sh schematestutils.sh
++
++install-ptest:
++	list='$(TESTS) $(test_helpers) test-lib.sh schematestutils.sh'
++	install -d $(DEST_DIR)/tools
++	@(if [ -d ../tools/.libs ] ; then cd ../tools/.libs; fi; \
++	install * $(DEST_DIR)/tools)
++	install -d $(DEST_DIR)/src/network
++	cp ../src/network/*.xml $(DEST_DIR)/src/network
++	install -d $(DEST_DIR)/src/cpu
++	cp ../src/cpu/*.xml $(DEST_DIR)/src/cpu
++	install ../src/libvirt_iohelper $(DEST_DIR)/src
++	install -D ../daemon/libvirtd $(DEST_DIR)/daemon/libvirtd
++	install -D ../daemon/libvirtd.conf $(DEST_DIR)/daemon/libvirtd.conf
++	@(if [ -d ../daemon/.libs ] ; then cd ../daemon/.libs; fi; \
++	install * $(DEST_DIR)/daemon)
++	install -d $(DEST_DIR)/src/.libs
++	@(if [ -d ../src/.libs ] ; then cd ../src/.libs; fi; \
++	install * $(DEST_DIR)/src/.libs)
++	install -d $(DEST_DIR)/docs/schemas
++	cp ../docs/schemas/*.rng $(DEST_DIR)/docs/schemas
++	cp -r ../build-aux $(DEST_DIR)
++	install -d $(DEST_DIR)/examples/xml
++	cp -r ../examples/xml/test $(DEST_DIR)/examples/xml
++	install -d $(DEST_DIR)/tests/.libs
++	find . -type d -name "*xml2xml*" -exec cp -r {} $(DEST_DIR)/tests \;
++	find . -type d -name "*data" -exec cp -r {} $(DEST_DIR)/tests \;
++	@(for file in $(PTESTS); do \
++		if [ -f .libs/$$file ]; then \
++			install .libs/$$file $(DEST_DIR)/tests; \
++		else \
++			install $$file $(DEST_DIR)/tests; \
++		fi; \
++	done;)
++	@(if [ -d .libs ]; then install .libs/*.so $(DEST_DIR)/tests/.libs; fi;)
++	cp ../config.h $(DEST_DIR)
++	cp Makefile $(DEST_DIR)/tests
++	sed -i -e 's/^Makefile:/_Makefile:/' $(DEST_DIR)/tests/Makefile
++	cp ../Makefile $(DEST_DIR)
++	sed -i -e 's|^Makefile:|_Makefile:|' $(DEST_DIR)/Makefile
++	sed -i -e 's|$(BUILD_DIR)|$(PTEST_DIR)|g' $(DEST_DIR)/tests/Makefile
++	sed -i -e 's|$(BUILD_DIR)|$(PTEST_DIR)|g' $(DEST_DIR)/Makefile
++	sed -i -e 's|^\(.*\.log:\) \(.*EXEEXT.*\)|\1|g' $(DEST_DIR)/tests/Makefile
++
+ CLEANFILES = *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.cmi *.cmx \
+ 	objectlocking-files.txt
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/tests-allow-separated-src-and-build-dirs.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/tests-allow-separated-src-and-build-dirs.patch
new file mode 100644
index 0000000..3964865
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/tests-allow-separated-src-and-build-dirs.patch
@@ -0,0 +1,57 @@
+From 884b6e3724b75cd92766d5386455983e3557a286 Mon Sep 17 00:00:00 2001
+From: Mark Asselstine <mark.asselstine@windriver.com>
+Date: Fri, 2 May 2014 13:45:05 -0400
+Subject: [PATCH] tests: allow separated src and build dirs
+
+Fixup Makefile.am to search for static files back in srcdir.
+
+Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
+---
+ tests/Makefile.am | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 0da514b..b8d7c19 100644
+--- a/tests/Makefile.am
++++ b/tests/Makefile.am
+@@ -1006,22 +1006,22 @@ install-ptest:
+ 	@(if [ -d ../tools/.libs ] ; then cd ../tools/.libs; fi; \
+ 	install * $(DEST_DIR)/tools)
+ 	install -d $(DEST_DIR)/src/network
+-	cp ../src/network/*.xml $(DEST_DIR)/src/network
++	cp $(top_srcdir)/src/network/*.xml $(DEST_DIR)/src/network
+ 	install -d $(DEST_DIR)/src/cpu
+-	cp ../src/cpu/*.xml $(DEST_DIR)/src/cpu
++	cp $(top_srcdir)/src/cpu/*.xml $(DEST_DIR)/src/cpu
+ 	install ../src/libvirt_iohelper $(DEST_DIR)/src
+ 	install -D ../daemon/libvirtd $(DEST_DIR)/daemon/libvirtd
+-	install -D ../daemon/libvirtd.conf $(DEST_DIR)/daemon/libvirtd.conf
++	install -D $(top_srcdir)/daemon/libvirtd.conf $(DEST_DIR)/daemon/libvirtd.conf
+ 	@(if [ -d ../daemon/.libs ] ; then cd ../daemon/.libs; fi; \
+ 	install * $(DEST_DIR)/daemon)
+ 	install -d $(DEST_DIR)/src/.libs
+ 	@(if [ -d ../src/.libs ] ; then cd ../src/.libs; fi; \
+ 	install * $(DEST_DIR)/src/.libs)
+ 	install -d $(DEST_DIR)/docs/schemas
+-	cp ../docs/schemas/*.rng $(DEST_DIR)/docs/schemas
+-	cp -r ../build-aux $(DEST_DIR)
++	cp $(top_srcdir)/docs/schemas/*.rng $(DEST_DIR)/docs/schemas
++	cp -r $(top_srcdir)/build-aux $(DEST_DIR)
+ 	install -d $(DEST_DIR)/examples/xml
+-	cp -r ../examples/xml/test $(DEST_DIR)/examples/xml
++	cp -r $(top_srcdir)/examples/xml/test $(DEST_DIR)/examples/xml
+ 	install -d $(DEST_DIR)/tests/.libs
+ 	find . -type d -name "*xml2xml*" -exec cp -r {} $(DEST_DIR)/tests \;
+ 	find . -type d -name "*data" -exec cp -r {} $(DEST_DIR)/tests \;
+@@ -1029,7 +1029,7 @@ install-ptest:
+ 		if [ -f .libs/$$file ]; then \
+ 			install .libs/$$file $(DEST_DIR)/tests; \
+ 		else \
+-			install $$file $(DEST_DIR)/tests; \
++			install $(srcdir)/$$file $(DEST_DIR)/tests; \
+ 		fi; \
+ 	done;)
+ 	@(if [ -d .libs ]; then install .libs/*.so $(DEST_DIR)/tests/.libs; fi;)
+-- 
+1.8.3.2
+
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch
new file mode 100644
index 0000000..a7fc727
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt/tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch
@@ -0,0 +1,89 @@
+From a790bfe8fa7b24b68cb6f9a1b7205fda2c6d558e Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@windriver.com>
+Date: Fri, 2 Aug 2013 11:38:43 -0400
+Subject: [PATCH] tools: add libvirt-net-rpc to virt-host-validate when TLS is
+ enabled
+
+When gnu-tls is enabled for libvirt references to virNetTLSInit are
+generated in libvirt. Any binaries linking against libvirt, must also
+link against libvirt-net-rpc which provides the implementation.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
+[ywei: rebased to libvirt-1.3.2]
+Signed-off-by: Yunguo Wei <yunguo.wei@windriver.com>
+---
+ examples/Makefile.am | 19 +++++++++++++++++++
+ tools/Makefile.am    | 13 +++++++++++++
+ 2 files changed, 32 insertions(+)
+
+diff --git a/examples/Makefile.am b/examples/Makefile.am
+index 2adcefb..fff49d4 100644
+--- a/examples/Makefile.am
++++ b/examples/Makefile.am
+@@ -39,6 +39,10 @@ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include -I$(top_srcdir) \
+ LDADD = $(STATIC_BINARIES) $(WARN_CFLAGS) $(COVERAGE_LDFLAGS) \
+ 	$(top_builddir)/src/libvirt.la $(top_builddir)/gnulib/lib/libgnu.la
+ 
++if WITH_GNUTLS
++LDADD += $(top_builddir)/src/libvirt-net-rpc.la
++endif
++
+ noinst_PROGRAMS=dominfo/info1 dommigrate/dommigrate domsuspend/suspend \
+ 	domtop/domtop hellolibvirt/hellolibvirt object-events/event-test \
+ 	openauth/openauth rename/rename
+@@ -52,6 +56,21 @@ object_events_event_test_SOURCES = object-events/event-test.c
+ openauth_openauth_SOURCES = openauth/openauth.c
+ rename_rename_SOURCES = rename/rename.c
+ 
++if WITH_GNUTLS
++dominfo_info1_LDADD = $(top_builddir)/src/libvirt-net-rpc.la  \
++               $(LDADD)    \
++               $(NULL)
++domsuspend_suspend_LDADD = $(top_builddir)/src/libvirt-net-rpc.la  \
++               $(LDADD)    \
++               $(NULL)
++hellolibvirt_hellolibvirt_LDADD = $(top_builddir)/src/libvirt-net-rpc.la  \
++               $(LDADD)    \
++               $(NULL)
++openauth_openauth_LDADD = $(top_builddir)/src/libvirt-net-rpc.la  \
++               $(LDADD)   \
++               $(NULL)
++endif
++
+ if WITH_APPARMOR_PROFILES
+ apparmordir = $(sysconfdir)/apparmor.d/
+ apparmor_DATA = \
+diff --git a/tools/Makefile.am b/tools/Makefile.am
+index 0be3567..b3227a7 100644
+--- a/tools/Makefile.am
++++ b/tools/Makefile.am
+@@ -169,6 +169,13 @@ virt_host_validate_LDADD = \
+ 		../gnulib/lib/libgnu.la				\
+ 		$(NULL)
+ 
++if WITH_GNUTLS
++virt_host_validate_LDADD += ../src/libvirt-net-rpc.la \
++                            ../gnulib/lib/libgnu.la   \
++                            $(NULL)
++endif
++
++
+ virt_host_validate_CFLAGS = \
+ 		$(LIBXML_CFLAGS)				\
+ 		$(WARN_CFLAGS)					\
+@@ -256,6 +263,12 @@ virt_admin_CFLAGS =						\
+ 		$(READLINE_CFLAGS)
+ BUILT_SOURCES =
+ 
++if WITH_GNUTLS
++virsh_LDADD += ../src/libvirt-net-rpc.la \
++               ../gnulib/lib/libgnu.la   \
++               $(NULL)
++endif
++
+ if WITH_WIN_ICON
+ virsh_LDADD += virsh_win_icon.$(OBJEXT)
+ 
+-- 
+1.9.1
+
diff --git a/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt_1.3.2.bb b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt_1.3.2.bb
new file mode 100644
index 0000000..42066c1
--- /dev/null
+++ b/import-layers/meta-virtualization/recipes-extended/libvirt/libvirt_1.3.2.bb
@@ -0,0 +1,287 @@
+DESCRIPTION = "A toolkit to interact with the virtualization capabilities of recent versions of Linux." 
+HOMEPAGE = "http://libvirt.org"
+LICENSE = "LGPLv2.1+"
+LICENSE_${PN}-ptest = "GPLv2+ & LGPLv2.1"
+LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
+                    file://COPYING.LESSER;md5=4b54a1fd55a448865a0b32d41598759d"
+SECTION = "console/tools"
+PR = "r1"
+
+DEPENDS = "bridge-utils gnutls libxml2 lvm2 avahi parted curl libpcap util-linux e2fsprogs pm-utils \
+	   iptables dnsmasq readline libtasn1 libxslt-native"
+
+# libvirt-guests.sh needs gettext.sh
+#
+RDEPENDS_${PN} = "gettext-runtime"
+
+RDEPENDS_${PN}-ptest += "make gawk"
+
+RDEPENDS_libvirt-libvirtd += "bridge-utils iptables pm-utils dnsmasq netcat-openbsd"
+RDEPENDS_libvirt-libvirtd_append_x86-64 = " dmidecode"
+RDEPENDS_libvirt-libvirtd_append_x86 = " dmidecode"
+
+#connman blocks the 53 port and libvirtd can't start its DNS service
+RCONFLICTS_${PN}_libvirtd = "connman"
+
+SRC_URI = "http://libvirt.org/sources/libvirt-${PV}.tar.gz;name=libvirt \
+           file://tools-add-libvirt-net-rpc-to-virt-host-validate-when.patch \
+           file://libvirtd.sh \
+           file://libvirtd.conf \
+           file://runptest.patch \
+           file://run-ptest \
+           file://tests-allow-separated-src-and-build-dirs.patch \
+           file://libvirt-use-pkg-config-to-locate-libcap.patch \
+           file://0001-to-fix-build-error.patch \
+           file://Revert-build-add-prefix-to-SYSTEMD_UNIT_DIR.patch \
+          "
+
+SRC_URI[libvirt.md5sum] = "b48b06bbc7efbe9973ed0f3f223d6da2"
+SRC_URI[libvirt.sha256sum] = "e3c6fc2683178660b371efb3ac7a1103a3f4b78efac7ffe560bc5917974ccf05"
+
+inherit autotools gettext update-rc.d pkgconfig ptest systemd
+
+CACHED_CONFIGUREVARS += "\
+ac_cv_path_XMLLINT=/usr/bin/xmllint \
+ac_cv_path_XMLCATLOG=/usr/bin/xmlcatalog \
+ac_cv_path_AUGPARSE=/usr/bin/augparse \
+ac_cv_path_DNSMASQ=/usr/bin/dnsmasq \
+ac_cv_path_BRCTL=/usr/sbin/brctl \
+ac_cv_path_TC=/sbin/tc \
+ac_cv_path_UDEVADM=/sbin/udevadm \
+ac_cv_path_MODPROBE=/sbin/modprobe \
+ac_cv_path_IP_PATH=/bin/ip \
+ac_cv_path_IPTABLES_PATH=/usr/sbin/iptables \
+ac_cv_path_IP6TABLES_PATH=/usr/sbin/ip6tables \
+ac_cv_path_MOUNT=/bin/mount \
+ac_cv_path_UMOUNT=/bin/umount \
+ac_cv_path_MKFS=/usr/sbin/mkfs \
+ac_cv_path_SHOWMOUNT=/usr/sbin/showmount \
+ac_cv_path_PVCREATE=/usr/sbin/pvcreate \
+ac_cv_path_VGCREATE=/usr/sbin/vgcreate \
+ac_cv_path_LVCREATE=/usr/sbin/lvcreate \
+ac_cv_path_PVREMOVE=/usr/sbin/pvremove \
+ac_cv_path_VGREMOVE=/usr/sbin/vgremove \
+ac_cv_path_LVREMOVE=/usr/sbin/lvremove \
+ac_cv_path_LVCHANGE=/usr/sbin/lvchange \
+ac_cv_path_VGCHANGE=/usr/sbin/vgchange \
+ac_cv_path_VGSCAN=/usr/sbin/vgscan \
+ac_cv_path_PVS=/usr/sbin/pvs \
+ac_cv_path_VGS=/usr/sbin/vgs \
+ac_cv_path_LVS=/usr/sbin/lvs \
+ac_cv_path_PARTED=/usr/sbin/parted \
+ac_cv_path_DMSETUP=/usr/sbin/dmsetup"
+
+# Ensure that libvirt uses polkit rather than policykit, whether the host has
+# pkcheck installed or not, and ensure the path is correct per our config.
+CACHED_CONFIGUREVARS += "ac_cv_path_PKCHECK_PATH=${bindir}/pkcheck"
+
+# Some other possible paths we are not yet setting
+#ac_cv_path_RPCGEN=
+#ac_cv_path_XSLTPROC=
+#ac_cv_path_RADVD=
+#ac_cv_path_UDEVSETTLE=
+#ac_cv_path_EBTABLES_PATH=
+#ac_cv_path_PKG_CONFIG=
+#ac_cv_path_ac_pt_PKG_CONFIG
+#ac_cv_path_POLKIT_AUTH=
+#ac_cv_path_DTRACE=
+#ac_cv_path_ISCSIADM=
+#ac_cv_path_MSGFMT=
+#ac_cv_path_GMSGFMT=
+#ac_cv_path_XGETTEXT=
+#ac_cv_path_MSGMERGE=
+#ac_cv_path_SCRUB=
+#ac_cv_path_PYTHON=
+
+ALLOW_EMPTY_${PN} = "1"
+
+PACKAGES =+ "${PN}-libvirtd ${PN}-virsh"
+
+ALLOW_EMPTY_${PN}-libvirtd = "1"
+
+FILES_${PN}-libvirtd = " \
+	${sysconfdir}/init.d \
+	${sysconfdir}/sysctl.d \
+	${sysconfdir}/logrotate.d \
+	${sysconfdir}/libvirt/libvirtd.conf \
+        /usr/lib/sysctl.d/60-libvirtd.conf \
+	${sbindir}/libvirtd \
+	${systemd_unitdir}/system/* \
+	${@base_contains('DISTRO_FEATURES', 'sysvinit', '', '${libexecdir}/libvirt-guests.sh', d)} \
+        "
+
+FILES_${PN}-virsh = "${bindir}/virsh"
+FILES_${PN} += "${libdir}/libvirt/connection-driver \
+	    ${datadir}/augeas \
+	    ${datadir}/polkit-1"
+
+FILES_${PN}-dbg += "${libdir}/libvirt/connection-driver/.debug ${libdir}/libvirt/lock-driver/.debug"
+FILES_${PN}-staticdev += "${libdir}/*.a ${libdir}/libvirt/connection-driver/*.a ${libdir}/libvirt/lock-driver/*.a"
+
+CONFFILES_${PN} += "${sysconfdir}/libvirt/libvirt.conf \
+                    ${sysconfdir}/libvirt/lxc.conf \
+                    ${sysconfdir}/libvirt/qemu-lockd.conf \
+                    ${sysconfdir}/libvirt/qemu.conf \
+                    ${sysconfdir}/libvirt/virt-login-shell.conf \
+                    ${sysconfdir}/libvirt/virtlockd.conf"
+
+CONFFILES_${PN}-libvirtd = "${sysconfdir}/logrotate.d/libvirt ${sysconfdir}/logrotate.d/libvirt.lxc \
+                            ${sysconfdir}/logrotate.d/libvirt.qemu ${sysconfdir}/logrotate.d/libvirt.uml \
+                            ${sysconfdir}/libvirt/libvirtd.conf \
+                            /usr/lib/sysctl.d/libvirtd.conf"
+
+INITSCRIPT_PACKAGES = "${PN}-libvirtd"
+INITSCRIPT_NAME_${PN}-libvirtd = "libvirtd"
+INITSCRIPT_PARAMS_${PN}-libvirtd = "defaults 72"
+
+SYSTEMD_PACKAGES = "${PN}-libvirtd"
+SYSTEMD_SERVICE_${PN}-libvirtd = " \
+    libvirtd.socket \
+    libvirtd.service \
+    virtlockd.service \
+    libvirt-guests.service \
+    virtlockd.socket \
+    "
+
+
+PRIVATE_LIBS_${PN}-ptest = " \
+	libvirt-lxc.so.0 \
+	libvirt.so.0 \
+	libvirt-qemu.so.0 \
+	lockd.so \
+	libvirt_driver_secret.so \
+	libvirt_driver_nodedev.so \
+	libvirt_driver_vbox.so \
+	libvirt_driver_interface.so \
+	libvirt_driver_uml.so \
+	libvirt_driver_network.so \
+	libvirt_driver_nwfilter.so \
+	libvirt_driver_qemu.so \
+	libvirt_driver_storage.so \
+	libvirt_driver_lxc.so \
+    "
+
+# xen-minimal config
+#PACKAGECONFIG ??= "xen libxl xen-inotify test remote libvirtd"
+
+# full config
+PACKAGECONFIG ??= "qemu yajl uml openvz vmware vbox esx iproute2 lxc test \
+                   remote macvtap libvirtd netcf udev python ebtables \
+                   ${@base_contains('DISTRO_FEATURES', 'selinux', 'selinux audit libcap-ng', '', d)} \
+                   ${@base_contains('DISTRO_FEATURES', 'xen', 'xen libxl xen-inotify', '', d)} \
+                   ${@base_contains('DISTRO_FEATURES', 'x11', 'polkit', '', d)} \
+                  "
+
+# enable,disable,depends,rdepends
+#
+PACKAGECONFIG[qemu] = "--with-qemu,--without-qemu,qemu,"
+PACKAGECONFIG[yajl] = "--with-yajl,--without-yajl,yajl,yajl"
+PACKAGECONFIG[xen] = "--with-xen,--without-xen,xen,"
+PACKAGECONFIG[xenapi] = "--with-xenapi,--without-xenapi,,"
+PACKAGECONFIG[libxl] = "--with-libxl=${STAGING_DIR_TARGET}/lib,--without-libxl,libxl,"
+PACKAGECONFIG[xen-inotify] = "--with-xen-inotify,--without-xen-inotify,xen,"
+PACKAGECONFIG[uml] = "--with-uml, --without-uml,,"
+PACKAGECONFIG[openvz] = "--with-openvz,--without-openvz,,"
+PACKAGECONFIG[vmware] = "--with-vmware,--without-vmware,,"
+PACKAGECONFIG[phyp] = "--with-phyp,--without-phyp,,"
+PACKAGECONFIG[vbox] = "--with-vbox,--without-vbox,,"
+PACKAGECONFIG[esx] = "--with-esx,--without-esx,,"
+PACKAGECONFIG[hyperv] = "--with-hyperv,--without-hyperv,,"
+PACKAGECONFIG[polkit] = "--with-polkit,--without-polkit,polkit,polkit"
+PACKAGECONFIG[lxc] = "--with-lxc,--without-lxc, lxc,"
+PACKAGECONFIG[test] = "--with-test=yes,--with-test=no,,"
+PACKAGECONFIG[remote] = "--with-remote,--without-remote,,"
+PACKAGECONFIG[macvtap] = "--with-macvtap=yes,--with-macvtap=no,libnl,libnl"
+PACKAGECONFIG[libvirtd] = "--with-libvirtd,--without-libvirtd,,"
+PACKAGECONFIG[netcf] = "--with-netcf,--without-netcf,netcf,netcf"
+PACKAGECONFIG[dtrace] = "--with-dtrace,--without-dtrace,,"
+PACKAGECONFIG[udev] = "--with-udev --with-pciaccess,--without-udev,udev libpciaccess,"
+PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux,"
+PACKAGECONFIG[ebtables] = "ac_cv_path_EBTABLES_PATH=/sbin/ebtables,ac_cv_path_EBTABLES_PATH=,ebtables,ebtables"
+PACKAGECONFIG[python] = ",,python,"
+PACKAGECONFIG[sasl] = "--with-sasl,--without-sasl,cyrus-sasl,cyrus-sasl"
+PACKAGECONFIG[iproute2] = "ac_cv_path_IP_PATH=/sbin/ip,ac_cv_path_IP_PATH=,iproute2,iproute2"
+PACKAGECONFIG[numactl] = "--with-numactl,--without-numactl,numactl,"
+PACKAGECONFIG[fuse] = "--with-fuse,--without-fuse,fuse,"
+PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit,"
+PACKAGECONFIG[libcap-ng] = "--with-capng,--without-capng,libcap-ng,"
+
+# Enable the Python tool support
+require libvirt-python.inc
+
+do_install_append() {
+	install -d ${D}/etc/init.d
+	install -d ${D}/etc/libvirt
+
+	install -m 0755 ${WORKDIR}/libvirtd.sh ${D}/etc/init.d/libvirtd
+	install -m 0644 ${WORKDIR}/libvirtd.conf ${D}/etc/libvirt/libvirtd.conf
+
+	if ${@bb.utils.contains('DISTRO_FEATURES','sysvinit','true','false',d)}; then
+	    # This will wind up in the libvirtd package, but will NOT be invoked by default.
+	    #
+	    mv ${D}/${libexecdir}/libvirt-guests.sh ${D}/${sysconfdir}/init.d
+	fi
+
+	if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
+	    # This variable is used by libvirtd.service to start libvirtd in the right mode
+	    sed -i '/#LIBVIRTD_ARGS="--listen"/a LIBVIRTD_ARGS="--listen --daemon"' ${D}/${sysconfdir}/sysconfig/libvirtd
+
+	    # We can't use 'notify' when we don't support 'sd_notify' dbus capabilities.
+	    sed -i -e 's/Type=notify/Type=forking/' \
+	           -e '/Type=forking/a PIDFile=${localstatedir}/run/libvirtd.pid' \
+		   ${D}/${systemd_unitdir}/system/libvirtd.service
+	fi
+
+	# The /var/run/libvirt directories created by the Makefile
+	# are wiped out in volatile, we need to create these at boot.
+	rm -rf ${D}${localstatedir}/run
+	install -d ${D}${sysconfdir}/default/volatiles
+	echo "d root root 0755 ${localstatedir}/run/libvirt none" \
+	     > ${D}${sysconfdir}/default/volatiles/99_libvirt
+	echo "d root root 0755 ${localstatedir}/run/libvirt/lockd none" \
+	     >> ${D}${sysconfdir}/default/volatiles/99_libvirt
+	echo "d root root 0755 ${localstatedir}/run/libvirt/lxc none" \
+	     >> ${D}${sysconfdir}/default/volatiles/99_libvirt
+	echo "d root root 0755 ${localstatedir}/run/libvirt/network none" \
+	     >> ${D}${sysconfdir}/default/volatiles/99_libvirt
+	echo "d root root 0755 ${localstatedir}/run/libvirt/qemu none" \
+	     >> ${D}${sysconfdir}/default/volatiles/99_libvirt
+
+	# Add hook support for libvirt
+	mkdir -p ${D}/etc/libvirt/hooks 
+
+	# remove .la references to our working diretory
+	for i in `find ${D}${libdir} -type f -name *.la`; do
+	    sed -i -e 's#-L${B}/src/.libs##g' $i
+	done
+}
+
+EXTRA_OECONF += " \
+    --with-init-script=systemd \
+    "
+
+EXTRA_OEMAKE = "BUILD_DIR=${B} DEST_DIR=${D}${PTEST_PATH} PTEST_DIR=${PTEST_PATH}"
+
+do_compile_ptest() {
+	oe_runmake -C tests buildtest-TESTS
+}
+
+do_install_ptest() {
+	oe_runmake -C tests install-ptest
+
+	# remove .la files for ptest, they aren't required and can trigger QA errors
+	for i in `find ${D}${PTEST_PATH} -type f -name *.la`; do
+                rm -f $i
+	done
+}
+
+pkg_postinst_libvirt() {
+        if [ -z "$D" ] && [ -e /etc/init.d/populate-volatile.sh ] ; then
+                /etc/init.d/populate-volatile.sh update
+        fi
+}
+
+python () {
+    if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d):
+        d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1")
+}