--- libvirt-0.7.5.orig/src/conf/domain_conf.h.orig	2010-08-19 12:33:21.601262066 +0200
+++ libvirt-0.7.5/src/conf/domain_conf.h	2010-08-19 12:39:41.231262056 +0200
@@ -105,6 +105,14 @@
     VIR_DOMAIN_DISK_CACHE_LAST
 };
 
+enum  virDomainDiskAIO {
+    VIR_DOMAIN_DISK_AIO_DEFAULT,
+    VIR_DOMAIN_DISK_AIO_NATIVE,
+    VIR_DOMAIN_DISK_AIO_THREADS,
+
+    VIR_DOMAIN_DISK_AIO_LAST
+};
+
 /* Stores the virtual disk configuration */
 typedef struct _virDomainDiskDef virDomainDiskDef;
 typedef virDomainDiskDef *virDomainDiskDefPtr;
@@ -118,6 +126,7 @@
     char *driverType;
     char *serial;
     int cachemode;
+    int aiomode;
     unsigned int readonly : 1;
     unsigned int shared : 1;
     struct {
@@ -837,6 +846,7 @@
 VIR_ENUM_DECL(virDomainDiskDevice)
 VIR_ENUM_DECL(virDomainDiskBus)
 VIR_ENUM_DECL(virDomainDiskCache)
+VIR_ENUM_DECL(virDomainDiskAIO)
 VIR_ENUM_DECL(virDomainFS)
 VIR_ENUM_DECL(virDomainNet)
 VIR_ENUM_DECL(virDomainChrTarget)
--- libvirt-0.7.5.orig/src/conf/domain_conf.c.orig	2010-08-19 12:33:18.131262003 +0200
+++ libvirt-0.7.5/src/conf/domain_conf.c	2010-08-19 12:38:47.111262042 +0200
@@ -115,6 +115,11 @@
               "writethrough",
               "writeback")
 
+VIR_ENUM_IMPL(virDomainDiskAIO, VIR_DOMAIN_DISK_AIO_LAST,
+              "default",
+              "native",
+              "threads")
+
 VIR_ENUM_IMPL(virDomainFS, VIR_DOMAIN_FS_TYPE_LAST,
               "mount",
               "block",
@@ -749,6 +754,7 @@
     char *target = NULL;
     char *bus = NULL;
     char *cachetag = NULL;
+    char *aiotag = NULL;
     char *devaddr = NULL;
     virStorageEncryptionPtr encryption = NULL;
     char *serial = NULL;
@@ -817,6 +823,7 @@
                 driverName = virXMLPropString(cur, "name");
                 driverType = virXMLPropString(cur, "type");
                 cachetag = virXMLPropString(cur, "cache");
+                aiotag = virXMLPropString(cur, "aio"); 
             } else if (xmlStrEqual(cur->name, BAD_CAST "readonly")) {
                 def->readonly = 1;
             } else if (xmlStrEqual(cur->name, BAD_CAST "shareable")) {
@@ -932,6 +939,13 @@
         goto error;
     }
 
+    if (aiotag &&
+        (def->aiomode = virDomainDiskAIOTypeFromString(aiotag)) < 0) {
+        virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("unknown disk aio mode '%s'"), aiotag);
+        goto error;
+    }
+
     if (devaddr &&
         sscanf(devaddr, "%x:%x:%x",
                &def->pci_addr.domain,
@@ -965,6 +979,7 @@
     VIR_FREE(driverType);
     VIR_FREE(driverName);
     VIR_FREE(cachetag);
+    VIR_FREE(aiotag);
     VIR_FREE(devaddr);
     VIR_FREE(serial);
     virStorageEncryptionFree(encryption);
@@ -3880,6 +3895,7 @@
     const char *device = virDomainDiskDeviceTypeToString(def->device);
     const char *bus = virDomainDiskBusTypeToString(def->bus);
     const char *cachemode = virDomainDiskCacheTypeToString(def->cachemode);
+    const char *aiomode = virDomainDiskAIOTypeToString(def->aiomode);
 
     if (!type) {
         virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
@@ -3902,6 +3918,12 @@
         return -1;
     }
 
+    if (!aiomode) {
+        virDomainReportError(conn, VIR_ERR_INTERNAL_ERROR,
+                             _("unexpected disk aio mode %d"), def->aiomode);
+        return -1;
+    }
+
     virBufferVSprintf(buf,
                       "    <disk type='%s' device='%s'>\n",
                       type, device);
@@ -3914,6 +3936,8 @@
             virBufferVSprintf(buf, " type='%s'", def->driverType);
         if (def->cachemode)
             virBufferVSprintf(buf, " cache='%s'", cachemode);
+        if (def->aiomode)
+            virBufferVSprintf(buf, " aio='%s'", aiomode);
         virBufferVSprintf(buf, "/>\n");
     }
 
--- libvirt-0.7.5.orig/src/qemu/qemu_conf.h.orig	2010-08-19 12:40:20.451262050 +0200
+++ libvirt-0.7.5/src/qemu/qemu_conf.h	2010-08-19 12:43:37.921262056 +0200
@@ -60,6 +60,7 @@
     QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP  = (1 << 10), /* New migration syntax after merge to QEMU with TCP transport */
     QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC = (1 << 11), /* New migration syntax after merge to QEMU with EXEC transport */
     QEMUD_CMD_FLAG_DRIVE_CACHE_V2    = (1 << 12), /* Is the cache= flag wanting new v2 values */
+    QEMUD_CMD_FLAG_DRIVE_AIO         = (1 << 30), /* Is -drive aio= avail */
     QEMUD_CMD_FLAG_KVM               = (1 << 13), /* Whether KVM is compiled in */
     QEMUD_CMD_FLAG_DRIVE_FORMAT      = (1 << 14), /* Is -drive format= avail */
     QEMUD_CMD_FLAG_VGA               = (1 << 15), /* Is -vga avail */
--- libvirt-0.7.5.orig/src/qemu/qemu_conf.c.orig	2010-08-19 12:40:12.261262041 +0200
+++ libvirt-0.7.5/src/qemu/qemu_conf.c	2010-08-19 12:43:08.681262078 +0200
@@ -83,6 +83,12 @@
               "writethrough",
               "writeback");
 
+VIR_ENUM_DECL(qemuDiskAIO)
+VIR_ENUM_IMPL(qemuDiskAIO, VIR_DOMAIN_DISK_AIO_LAST,
+              "default",
+              "native",
+              "threads");
+
 VIR_ENUM_DECL(qemuVideo)
 
 VIR_ENUM_IMPL(qemuVideo, VIR_DOMAIN_VIDEO_TYPE_LAST,
@@ -1101,6 +1107,8 @@
             flags |= QEMUD_CMD_FLAG_DRIVE_CACHE_V2;
         if (strstr(help, "format="))
             flags |= QEMUD_CMD_FLAG_DRIVE_FORMAT;
+        if (strstr(help, "aio=threads|native"))
+            flags |= QEMUD_CMD_FLAG_DRIVE_AIO;
     }
     if (strstr(help, "-vga") && !strstr(help, "-std-vga"))
         flags |= QEMUD_CMD_FLAG_VGA;
@@ -2365,6 +2373,11 @@
                 virBufferAddLit(&opt, ",cache=off");
             }
 
+            if (disk->aiomode && (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_AIO)) {
+                 const char * mode = qemuDiskAIOTypeToString(disk->aiomode);
+                 virBufferVSprintf(&opt, ",aio=%s", mode);
+            }
+
             if (virBufferError(&opt)) {
                 virBufferFreeAndReset(&opt);
                 goto no_memory;
