]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Fix USB by product with security enabled
authorCole Robinson <crobinso@redhat.com>
Fri, 12 Mar 2010 17:37:52 +0000 (12:37 -0500)
committerCole Robinson <crobinso@redhat.com>
Mon, 15 Mar 2010 16:36:47 +0000 (12:36 -0400)
We need to call PrepareHostdevs to determine the USB device path before
any security calls. PrepareHostUSBDevices was also incorrectly skipping
all USB devices.

src/qemu/qemu_driver.c

index 040d64566c12228fb194f47710fb5a80dcbd91b9..b17d26dd9d076c92bdadaa5cf0577e947c89ce9b 100644 (file)
@@ -2360,7 +2360,7 @@ qemuPrepareHostUSBDevices(struct qemud_driver *driver ATTRIBUTE_UNUSED,
 
         if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS)
             continue;
-        if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
+        if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB)
             continue;
 
         /* Resolve a vendor/product to bus/device */
@@ -2703,6 +2703,11 @@ static int qemudStartVMDaemon(virConnectPtr conn,
         return -1;
     }
 
+    /* Must be run before security labelling */
+    DEBUG0("Preparing host devices");
+    if (qemuPrepareHostDevices(driver, vm->def) < 0)
+        goto cleanup;
+
     /* If you are using a SecurityDriver with dynamic labelling,
        then generate a security label for isolation */
     DEBUG0("Generating domain security label (if required)");
@@ -2769,10 +2774,6 @@ static int qemudStartVMDaemon(virConnectPtr conn,
     if (qemuSetupCgroup(driver, vm) < 0)
         goto cleanup;
 
-    DEBUG0("Preparing host devices");
-    if (qemuPrepareHostDevices(driver, vm->def) < 0)
-        goto cleanup;
-
     if (VIR_ALLOC(priv->monConfig) < 0) {
         virReportOOMError();
         goto cleanup;