We're about to allow IOThreads to be deleted, but an iothreadid may be included in some domain thread sched, so add a new API to allow removing an iothread from some entry. Then during the writing of the threadsched data and an additional check to determine whether the bitmap is all clear before writing it out. Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx> --- src/conf/domain_conf.c | 20 ++++++++++++++++++++ src/conf/domain_conf.h | 1 + src/libvirt_private.syms | 1 + 3 files changed, 22 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 846a744..bc975f3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -17434,6 +17434,24 @@ virDomainIOThreadIDDel(virDomainDefPtr def, } } +void +virDomainIOThreadSchedDelId(virDomainDefPtr def, + unsigned int iothreadid) +{ + size_t i; + + if (!def->cputune.iothreadsched || !def->cputune.niothreadsched) + return; + + for (i = 0; i < def->cputune.niothreadsched; i++) { + if (virBitmapIsBitSet(def->cputune.iothreadsched[i].ids, iothreadid)) { + ignore_value(virBitmapClearBit(def->cputune.iothreadsched[i].ids, + iothreadid)); + return; + } + } +} + virDomainPinDefPtr virDomainPinFind(virDomainPinDefPtr *def, int npin, @@ -20876,6 +20894,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, virDomainThreadSchedParamPtr sp = &def->cputune.iothreadsched[i]; char *ids = NULL; + if (virBitmapIsAllClear(sp->ids)) + continue; if (!(ids = virBitmapFormat(sp->ids))) goto error; virBufferAsprintf(buf, "<iothreadsched iothreads='%s' scheduler='%s'", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 7daaeed..4ae89fd 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2615,6 +2615,7 @@ virDomainIOThreadIDDefPtr virDomainIOThreadIDFind(virDomainDefPtr def, virDomainIOThreadIDDefPtr virDomainIOThreadIDAdd(virDomainDefPtr def, unsigned int iothread_id); void virDomainIOThreadIDDel(virDomainDefPtr def, unsigned int iothread_id); +void virDomainIOThreadSchedDelId(virDomainDefPtr def, unsigned int iothread_id); unsigned int virDomainDefFormatConvertXMLFlags(unsigned int flags); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a0f4152..0877907 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -328,6 +328,7 @@ virDomainIOThreadIDAdd; virDomainIOThreadIDDefFree; virDomainIOThreadIDDel; virDomainIOThreadIDFind; +virDomainIOThreadSchedDelId; virDomainLeaseDefFree; virDomainLeaseIndex; virDomainLeaseInsert; -- 2.1.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list