]> xenbits.xensource.com Git - libvirt.git/commitdiff
domain_conf: Add support for iothreads in disk definition
authorJohn Ferlan <jferlan@redhat.com>
Mon, 25 Aug 2014 12:43:17 +0000 (08:43 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Thu, 28 Aug 2014 20:27:54 +0000 (16:27 -0400)
Add a new disk "driver" attribute "iothread" to be parsed as the thread
number for the disk to use. In order to more easily facilitate the usage
and configuration of the iothread, a "zero" for the attribute indicates
iothreads are not supported for the device and a positive value indicates
the specific thread to try and use.

docs/formatdomain.html.in
docs/schemas/domaincommon.rng
src/conf/domain_conf.c
src/conf/domain_conf.h

index 35f48b273b4fb8eb2a3ec8dded4f25903e85965c..94236dd4baa9a92eeabd8e8f4af3811091df630b 100644 (file)
             (ignore the discard request).
             <span class='since'>Since 1.0.6 (QEMU and KVM only)</span>
           </li>
+          <li>
+            The optional <code>iothread</code> attribute assigns the
+            disk to an IOThread as defined by the range for the domain
+            <a href="#elementsIOThreadsAllocation"><code>iothreads</code></a>
+            value. Multiple devices may be assigned to the same IOThread and
+            are numbered from 1 to the domain iothreads value.
+            <span class='since'>Since 1.2.8 (QEMU only)</span>
+          </li>
         </ul>
       </dd>
       <dt><code>boot</code></dt>
index 5f1c22658d76d77d008cba1ea241952ed2d5e408..cedceae1f6c147ab572ce29c88a93b94ba259d22 100644 (file)
       <optional>
         <ref name="discard"/>
       </optional>
+      <optional>
+        <ref name="driverIOThread"/>
+      </optional>
       <empty/>
     </element>
   </define>
       </choice>
     </attribute>
   </define>
+  <define name="driverIOThread">
+    <attribute name='iothread'>
+      <ref name="unsignedInt"/>
+    </attribute>
+  </define>
   <define name="controller">
     <element name="controller">
       <attribute name="index">
index adf197b80bfdb2eef2717e7d158f08217a941a42..53ef6947b91b75469bac65122c4fc1d593bf3707 100644 (file)
@@ -5422,6 +5422,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     char *ioeventfd = NULL;
     char *event_idx = NULL;
     char *copy_on_read = NULL;
+    char *driverIOThread = NULL;
     char *devaddr = NULL;
     virStorageEncryptionPtr encryption = NULL;
     char *serial = NULL;
@@ -5570,6 +5571,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
                 event_idx = virXMLPropString(cur, "event_idx");
                 copy_on_read = virXMLPropString(cur, "copy_on_read");
                 discard = virXMLPropString(cur, "discard");
+                driverIOThread = virXMLPropString(cur, "iothread");
             } else if (!def->mirror &&
                        xmlStrEqual(cur->name, BAD_CAST "mirror") &&
                        !(flags & VIR_DOMAIN_XML_INACTIVE)) {
@@ -6104,6 +6106,15 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
         }
     }
 
+    if (driverIOThread) {
+        if (virStrToLong_uip(driverIOThread, NULL, 10, &def->iothread) < 0) {
+            virReportError(VIR_ERR_XML_ERROR,
+                           _("Invalid iothread attribute in disk driver "
+                             "element: %s"), driverIOThread);
+            goto error;
+        }
+    }
+
     if (devaddr) {
         if (virDomainParseLegacyDeviceAddress(devaddr,
                                               &def->info.addr.pci) < 0) {
@@ -6204,6 +6215,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
     VIR_FREE(event_idx);
     VIR_FREE(copy_on_read);
     VIR_FREE(discard);
+    VIR_FREE(driverIOThread);
     VIR_FREE(devaddr);
     VIR_FREE(serial);
     virStorageEncryptionFree(encryption);
@@ -15637,7 +15649,7 @@ virDomainDiskDefFormat(virBufferPtr buf,
     if (def->src->driverName || def->src->format > 0 || def->cachemode ||
         def->error_policy || def->rerror_policy || def->iomode ||
         def->ioeventfd || def->event_idx || def->copy_on_read ||
-        def->discard) {
+        def->discard || def->iothread) {
         virBufferAddLit(buf, "<driver");
         if (def->src->driverName)
             virBufferAsprintf(buf, " name='%s'", def->src->driverName);
@@ -15660,6 +15672,8 @@ virDomainDiskDefFormat(virBufferPtr buf,
             virBufferAsprintf(buf, " copy_on_read='%s'", copy_on_read);
         if (def->discard)
             virBufferAsprintf(buf, " discard='%s'", discard);
+        if (def->iothread)
+            virBufferAsprintf(buf, " iothread='%u'", def->iothread);
         virBufferAddLit(buf, "/>\n");
     }
 
index f8ae0e768934eef2ec130b710394ebdeec23636a..9586c3be165f961bcd6b05393669d91fd0dc74b6 100644 (file)
@@ -667,6 +667,7 @@ struct _virDomainDiskDef {
     int rawio; /* no = 0, yes = 1 */
     int sgio; /* enum virDomainDeviceSGIO */
     int discard; /* enum virDomainDiskDiscard */
+    unsigned int iothread; /* unused = 0, > 0 specific thread # */
 };