From nobody Sun Feb 8 15:25:27 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1487343230013207.10211027695232; Fri, 17 Feb 2017 06:53:50 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1HEnd2t006078; Fri, 17 Feb 2017 09:49:40 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v1HEnSbu003760 for ; Fri, 17 Feb 2017 09:49:28 -0500 Received: from antique-work.brq.redhat.com (dhcp129-175.brq.redhat.com [10.34.129.175]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1HEnIn8022242 for ; Fri, 17 Feb 2017 09:49:28 -0500 From: Pavel Hrdina To: libvir-list@redhat.com Date: Fri, 17 Feb 2017 15:49:15 +0100 Message-Id: <585fe52bac5fbd5bce6e8c466ca482a0ae351140.1487341782.git.phrdina@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/13] qemu_driver: move iothread existence check into one place X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Pavel Hrdina --- src/qemu/qemu_driver.c | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 1a7cc12874..03fea2713d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -5675,21 +5675,6 @@ qemuDomainHotplugDelIOThread(virQEMUDriverPtr driver, int new_niothreads =3D 0; qemuMonitorIOThreadInfoPtr *new_iothreads =3D NULL; =20 - /* Normally would use virDomainIOThreadIDFind, but we need the index - * from whence to delete for later... - */ - for (idx =3D 0; idx < vm->def->niothreadids; idx++) { - if (iothread_id =3D=3D vm->def->iothreadids[idx]->iothread_id) - break; - } - - if (idx =3D=3D vm->def->niothreadids) { - virReportError(VIR_ERR_INVALID_ARG, - _("cannot find IOThread '%u' in iothreadids list"), - iothread_id); - return -1; - } - if (virAsprintf(&alias, "iothread%u", iothread_id) < 0) return -1; =20 @@ -5745,6 +5730,13 @@ qemuDomainDelIOThreadCheck(virDomainDefPtr def, { size_t i; =20 + if (!virDomainIOThreadIDFind(def, iothread_id)) { + virReportError(VIR_ERR_INVALID_ARG, + _("cannot find IOThread '%u' in iothreadids list"), + iothread_id); + return -1; + } + for (i =3D 0; i < def->ndisks; i++) { if (def->disks[i]->iothread =3D=3D iothread_id) { virReportError(VIR_ERR_INVALID_ARG, @@ -5809,16 +5801,6 @@ qemuDomainChgIOThread(virQEMUDriverPtr driver, goto endjob; =20 } else { - virDomainIOThreadIDDefPtr iothrid; - if (!(iothrid =3D virDomainIOThreadIDFind(persistentDef, - iothread_id))) { - virReportError(VIR_ERR_INVALID_ARG, - _("cannot find IOThread '%u' in persistent " - "iothreadids"), - iothread_id); - goto endjob; - } - if (qemuDomainDelIOThreadCheck(persistentDef, iothread_id) < 0) goto endjob; =20 --=20 2.11.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list