[libvirt] [PATCH 0/2] Clear iothreadid autofill flag for two instances

https://bugzilla.redhat.com/show_bug.cgi?id=1218577 The first patch considers the philosophy of the bug report with respect to thread deletion, but doesn't resolve it completely since the ordering of when iothreadpin is done is important. For this patch, when an iothreadid is removed from the "beginning" or "middle" of the iothreadid list, then clear the autofill flag unconditionally for all subsequent iothreadid's. The second patch specifically clears the autofill flag when iothreadpin is used treating it as if someone added an IOThread via iothreadadd John Ferlan (2): conf: Expose iothreadids when delete non sequential iothreadids qemu: Clear autofil fill flag when pinning iothread src/conf/domain_conf.c | 19 ++++++++++++++----- src/qemu/qemu_driver.c | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) -- 2.1.0

Since 'autofill'd iothreadid entries are not written during XML format processing, it is possible that if an iothreadid in the middle of an autofilled list would then change it's id on a subsequent restart. Thus during the iothreadid deletion, if we determine the delete is not the "last" thread, then clear the autofill bit for all iothreadid's following the one being deleted (either the first or one in the middle). This way, iothreadid's will be printed/saved. Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/conf/domain_conf.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4cd36a1..b75291b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17485,12 +17485,21 @@ void virDomainIOThreadIDDel(virDomainDefPtr def, unsigned int iothread_id) { - int n; + size_t i, j; + + 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); - for (n = 0; n < def->niothreadids; n++) { - if (def->iothreadids[n]->iothread_id == iothread_id) { - virDomainIOThreadIDDefFree(def->iothreadids[n]); - VIR_DELETE_ELEMENT(def->iothreadids, n, def->niothreadids); return; } } -- 2.1.0

https://bugzilla.redhat.com/show_bug.cgi?id=1218577 Treat pinning an IOThread via API as if someone added an IOThread to ensure the iothreadid doesn't cause the guest to disappear Signed-off-by: John Ferlan <jferlan@redhat.com> --- src/qemu/qemu_driver.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index d173aa1..469e09c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6008,6 +6008,7 @@ qemuDomainPinIOThread(virDomainPtr dom, virBitmapFree(iothrid->cpumask); iothrid->cpumask = cpumask; + iothrid->autofill = false; /* Configure the corresponding cpuset cgroup before set affinity. */ if (virCgroupHasController(priv->cgroup, @@ -6064,6 +6065,7 @@ qemuDomainPinIOThread(virDomainPtr dom, virBitmapFree(iothrid->cpumask); iothrid->cpumask = cpumask; + iothrid->autofill = false; ret = virDomainSaveConfig(cfg->configDir, persistentDef); goto endjob; -- 2.1.0

On Wed, May 06, 2015 at 10:50:44AM -0400, John Ferlan wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1218577
The first patch considers the philosophy of the bug report with respect to thread deletion, but doesn't resolve it completely since the ordering of when iothreadpin is done is important. For this patch, when an iothreadid is removed from the "beginning" or "middle" of the iothreadid list, then clear the autofill flag unconditionally for all subsequent iothreadid's.
The second patch specifically clears the autofill flag when iothreadpin is used treating it as if someone added an IOThread via iothreadadd
John Ferlan (2): conf: Expose iothreadids when delete non sequential iothreadids qemu: Clear autofil fill flag when pinning iothread
src/conf/domain_conf.c | 19 ++++++++++++++----- src/qemu/qemu_driver.c | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-)
Makes sense, ACK series.
-- 2.1.0
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
participants (2)
-
John Ferlan
-
Martin Kletzander