diff --git a/Makefile b/Makefile
index 8d6a753..5843bf8 100644
--- a/Makefile
+++ b/Makefile
@@ -19,3 +19,7 @@ MAKEFILE_COMMON := $(shell $(checkout-makefile-common))
 endif
 
 include $(MAKEFILE_COMMON)
+
+ifeq ($(BRANCH),devel)
+include Makefile.preview
+endif
diff --git a/libvirt-0.6.3-hostdev-managed.patch b/libvirt-0.6.3-hostdev-managed.patch
new file mode 100644
index 0000000..4d62aaa
--- /dev/null
+++ b/libvirt-0.6.3-hostdev-managed.patch
@@ -0,0 +1,45 @@
+From 3d7771e0570e09096ad9391a857dad48b150bc0c Mon Sep 17 00:00:00 2001
+From: Mark McLoughlin <markmc@redhat.com>
+Date: Wed, 6 May 2009 16:33:28 +0100
+Subject: [PATCH] Fix qemu driver's interpretation of <hostdev managed='yes'/>
+
+This change:
+
+  Tue Mar  3 08:55:13 GMT 2009 Daniel P. Berrange <berrange@redhat.com>
+
+       Don't try to detach & reset PCI devices while running test
+       suite for XML-> ARGV conversion.
+       * src/qemu_driver.c: Add qemuPrepareHostDevices() helper to
+       detach and reset PCI devices.
+       * src/qemu_conf.c: Don't detach & reset PCI devices while
+       building the command line argv
+
+accidentally did this:
+
+-            if (hostdev->managed) {
++        if (!hostdev->managed) {
+
+Which results in managed='yes' not causing the device to be
+detached when the guest is starting.
+
+Signed-off-by: Mark McLoughlin <markmc@redhat.com>
+---
+ src/qemu_driver.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/qemu_driver.c b/src/qemu_driver.c
+index 5898026..59312c0 100644
+--- a/src/qemu_driver.c
++++ b/src/qemu_driver.c
+@@ -1215,7 +1215,7 @@ static int qemuPrepareHostDevices(virConnectPtr conn,
+         if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
+             continue;
+ 
+-        if (!hostdev->managed) {
++        if (hostdev->managed) {
+             pciDevice *dev = pciGetDevice(conn,
+                                           hostdev->source.subsys.u.pci.domain,
+                                           hostdev->source.subsys.u.pci.bus,
+-- 
+1.6.0.6
+
diff --git a/libvirt.spec b/libvirt.spec
index bdf3cf2..320218f 100644
--- a/libvirt.spec
+++ b/libvirt.spec
@@ -55,14 +55,14 @@
 Summary: Library providing a simple API virtualization
 Name: libvirt
 Version: 0.6.3
-Release: 4%{?dist}%{?extra_release}
+Release: 5%{?dist}%{?extra_release}
 License: LGPLv2+
 Group: Development/Libraries
 Source: libvirt-%{version}.tar.gz
 
 # Patches cherry-picked from upstream
-# N/A
 Patch1: libvirt-0.6.3-shared-readonly-label.patch
+Patch2: libvirt-0.6.3-hostdev-managed.patch
 
 # Not for upstream. Temporary hack till PulseAudio autostart
 # problems are sorted out when SELinux enforcing
@@ -217,6 +217,7 @@ of recent versions of Linux (and other OSes).
 %prep
 %setup -q
 %patch1 -p1
+%patch2 -p1
 
 %patch200 -p0
 
@@ -547,6 +548,9 @@ fi
 %endif
 
 %changelog
+* Wed May  6 2009 Mark McLoughlin <markmc@redhat.com> - 0.6.3-5.fc12
+- Fix handling of <hostdev managed='yes'> (bug #499386)
+
 * Tue May  5 2009 Daniel Berrange <berrange@redhat.com> - 0.6.3-4.fc12
 - Fix readonly/shared disk image labelling (rhbz #493692)