[PATCH 05/13] conf: always display iothread ids in the XML

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There was at first only iothreads element in the XML.  Because
iothreads are used by theirs ids we should always print them in
the XML even if they are auto-generated.

Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/conf/domain_conf.c                             | 32 +++++-----------------
 src/conf/domain_conf.h                             |  1 -
 src/qemu/qemu_driver.c                             |  2 --
 src/qemu/qemu_process.c                            |  5 ++--
 .../qemuxml2xmlout-cputune-iothreads.xml           |  4 +++
 ...l2xmlout-cputune-iothreadsched-zeropriority.xml |  6 ++++
 .../qemuxml2xmlout-cputune-iothreadsched.xml       |  6 ++++
 .../qemuxml2xmlout-cputune-numatune.xml            |  4 +++
 .../qemuxml2xmlout-iothreads-disk-virtio-ccw.xml   |  4 +++
 .../qemuxml2xmlout-iothreads-disk.xml              |  4 +++
 .../qemuxml2xmlout-iothreads-ids-partial.xml       |  2 ++
 .../qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml   |  4 +++
 .../qemuxml2xmlout-iothreads-virtio-scsi-pci.xml   |  4 +++
 .../qemuxml2xmlout-iothreads.xml                   |  4 +++
 .../qemuxml2xmlout-vcpu-placement-static.xml       |  4 +++
 15 files changed, 55 insertions(+), 31 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 69db692217..ab0e19ef16 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2623,7 +2623,6 @@ virDomainIOThreadIDDefArrayInit(virDomainDefPtr def,
         if (VIR_ALLOC(iothrid) < 0)
             goto error;
         iothrid->iothread_id = nxt;
-        iothrid->autofill = true;
 
         pos = virDomainIOThreadInsertGetPos(def, iothrid);
 
@@ -20216,18 +20215,10 @@ void
 virDomainIOThreadIDDel(virDomainDefPtr def,
                        unsigned int iothread_id)
 {
-    size_t i, j;
+    size_t i;
 
     for (i = 0; i < def->niothreadids; i++) {
         if (def->iothreadids[i]->iothread_id == iothread_id) {
-            /* If we were sequential and removed a threadid in the
-             * beginning or middle of the list, then unconditionally
-             * clear the autofill flag so we don't lose these
-             * definitions for XML formatting.
-             */
-            for (j = i + 1; j < def->niothreadids; j++)
-                def->iothreadids[j]->autofill = false;
-
             virDomainIOThreadIDDefFree(def->iothreadids[i]);
             VIR_DELETE_ELEMENT(def->iothreadids, i, def->niothreadids);
 
@@ -23873,23 +23864,14 @@ virDomainDefFormatInternal(virDomainDefPtr def,
     if (def->niothreadids > 0) {
         virBufferAsprintf(buf, "<iothreads>%lu</iothreads>\n",
                           def->niothreadids);
-        /* Only print out iothreadids if we read at least one */
+        virBufferAddLit(buf, "<iothreadids>\n");
+        virBufferAdjustIndent(buf, 2);
         for (i = 0; i < def->niothreadids; i++) {
-            if (!def->iothreadids[i]->autofill)
-                break;
-        }
-        if (i < def->niothreadids) {
-            virBufferAddLit(buf, "<iothreadids>\n");
-            virBufferAdjustIndent(buf, 2);
-            for (i = 0; i < def->niothreadids; i++) {
-                if (def->iothreadids[i]->autofill)
-                    continue;
-                virBufferAsprintf(buf, "<iothread id='%u'/>\n",
-                                  def->iothreadids[i]->iothread_id);
-            }
-            virBufferAdjustIndent(buf, -2);
-            virBufferAddLit(buf, "</iothreadids>\n");
+            virBufferAsprintf(buf, "<iothread id='%u'/>\n",
+                              def->iothreadids[i]->iothread_id);
         }
+        virBufferAdjustIndent(buf, -2);
+        virBufferAddLit(buf, "</iothreadids>\n");
     }
 
     if (virDomainCputuneDefFormat(buf, def) < 0)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 8ff2de8c25..63faec499a 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2068,7 +2068,6 @@ typedef struct _virDomainIOThreadIDDef virDomainIOThreadIDDef;
 typedef virDomainIOThreadIDDef *virDomainIOThreadIDDefPtr;
 
 struct _virDomainIOThreadIDDef {
-    bool autofill;
     unsigned int iothread_id;
     int thread_id;
     virBitmapPtr cpumask;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 661f6f5d34..3f0237da48 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5496,7 +5496,6 @@ qemuDomainPinIOThread(virDomainPtr dom,
 
         virBitmapFree(iothrid->cpumask);
         iothrid->cpumask = cpumask;
-        iothrid->autofill = false;
 
         /* Configure the corresponding cpuset cgroup before set affinity. */
         if (virCgroupHasController(priv->cgroup,
@@ -5546,7 +5545,6 @@ qemuDomainPinIOThread(virDomainPtr dom,
 
         virBitmapFree(iothrid->cpumask);
         iothrid->cpumask = cpumask;
-        iothrid->autofill = false;
 
         ret = virDomainSaveConfig(cfg->configDir, driver->caps, persistentDef);
         goto endjob;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 62f0b9b630..2a65e9043c 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -2115,9 +2115,8 @@ qemuProcessDetectIOThreadPIDs(virQEMUDriverPtr driver,
                 /* Check if the domain had defined any iothreadid elements
                  * and supply a VIR_INFO indicating that it's being removed.
                  */
-                if (!vm->def->iothreadids[i]->autofill)
-                    VIR_INFO("IOThreads not supported, remove iothread id '%u'",
-                             vm->def->iothreadids[i]->iothread_id);
+                VIR_INFO("IOThreads not supported, remove iothread id '%u'",
+                         vm->def->iothreadids[i]->iothread_id);
                 virDomainIOThreadIDDefFree(vm->def->iothreadids[i]);
             }
             /* Remove any trace */
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreads.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreads.xml
index 6c95e05131..bf8fa0b1de 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreads.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreads.xml
@@ -5,6 +5,10 @@
   <currentMemory unit='KiB'>219136</currentMemory>
   <vcpu placement='static'>2</vcpu>
   <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+  </iothreadids>
   <cputune>
     <shares>2048</shares>
     <period>1000000</period>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
index 794a52d571..6547f96835 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched-zeropriority.xml
@@ -5,6 +5,12 @@
   <currentMemory unit='KiB'>219136</currentMemory>
   <vcpu placement='static'>2</vcpu>
   <iothreads>4</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+    <iothread id='3'/>
+    <iothread id='4'/>
+  </iothreadids>
   <cputune>
     <shares>2048</shares>
     <period>1000000</period>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched.xml
index cd1dc87b52..0c1479f199 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-iothreadsched.xml
@@ -5,6 +5,12 @@
   <currentMemory unit='KiB'>219136</currentMemory>
   <vcpu placement='static'>2</vcpu>
   <iothreads>4</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+    <iothread id='3'/>
+    <iothread id='4'/>
+  </iothreadids>
   <cputune>
     <shares>2048</shares>
     <period>1000000</period>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
index ff987e7d59..a77eeab934 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-cputune-numatune.xml
@@ -5,6 +5,10 @@
   <currentMemory unit='KiB'>65536</currentMemory>
   <vcpu placement='auto' current='2'>6</vcpu>
   <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+  </iothreadids>
   <cputune>
     <emulatorpin cpuset='1-3'/>
     <iothreadpin iothread='1' cpuset='2'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml
index f6d103978d..de5d276ecb 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk-virtio-ccw.xml
@@ -5,6 +5,10 @@
   <currentMemory unit='KiB'>219136</currentMemory>
   <vcpu placement='static'>1</vcpu>
   <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+  </iothreadids>
   <os>
     <type arch='s390x' machine='s390-ccw'>hvm</type>
     <boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
index 0eb45b7d15..0b001b9fd3 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-disk.xml
@@ -5,6 +5,10 @@
   <currentMemory unit='KiB'>219136</currentMemory>
   <vcpu placement='static'>2</vcpu>
   <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+  </iothreadids>
   <os>
     <type arch='i686' machine='pc'>hvm</type>
     <boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
index d6deced96a..57f3be96fc 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-ids-partial.xml
@@ -6,6 +6,8 @@
   <vcpu placement='static'>2</vcpu>
   <iothreads>4</iothreads>
   <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
     <iothread id='5'/>
     <iothread id='6'/>
   </iothreadids>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml
index 5e91f1c4aa..161dec9bce 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-ccw.xml
@@ -5,6 +5,10 @@
   <currentMemory unit='KiB'>219136</currentMemory>
   <vcpu placement='static'>1</vcpu>
   <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+  </iothreadids>
   <os>
     <type arch='s390x' machine='s390-ccw'>hvm</type>
     <boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-pci.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-pci.xml
index d8306d4304..c3051599b2 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-pci.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads-virtio-scsi-pci.xml
@@ -5,6 +5,10 @@
   <currentMemory unit='KiB'>219136</currentMemory>
   <vcpu placement='static'>2</vcpu>
   <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+  </iothreadids>
   <os>
     <type arch='i686' machine='pc'>hvm</type>
     <boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
index 5c5d9dbdb1..ff4ae53366 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-iothreads.xml
@@ -5,6 +5,10 @@
   <currentMemory unit='KiB'>219136</currentMemory>
   <vcpu placement='static'>2</vcpu>
   <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+  </iothreadids>
   <os>
     <type arch='i686' machine='pc'>hvm</type>
     <boot dev='hd'/>
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
index c6471e3a07..9949b17eb6 100644
--- a/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-vcpu-placement-static.xml
@@ -5,6 +5,10 @@
   <currentMemory unit='KiB'>65536</currentMemory>
   <vcpu placement='static' current='2'>6</vcpu>
   <iothreads>2</iothreads>
+  <iothreadids>
+    <iothread id='1'/>
+    <iothread id='2'/>
+  </iothreadids>
   <cputune>
     <emulatorpin cpuset='1-3'/>
     <iothreadpin iothread='1' cpuset='2'/>
-- 
2.11.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux