From nobody Fri Dec 19 04:17:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571415111; cv=none; d=zoho.com; s=zohoarc; b=h/wBKONUR+THz+RT/cZlUy4NG3ymhPNAhiYv1Q9WhOIm4qPQIlA6Np5qOJkqK96o+xhQWKvqDD4jgpJY3ZIP1mAP9VjZ00GrFBpzlaIylJdzmB4U3+s2bCG0+Mrlhjr69ExKP23tCZQcKukePYB01Lkom3EU8UFOTR8S8+SGNyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571415111; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ujz4+k25Z1DeRVuWdLGbt7Ff+pWlOej8eIaCh0ugw6g=; b=Iq0CFfdrajZ7ehAyMjXA/bpoJ+9BHNXoJnOS7DcOtStTP/KRDmH10hZJTVBYqhdzi09yOjgYZ7ztQb7+SmZVw3+Gefzwijlzliqv/PyECS0SIDHrbXMzDU8AttI/4E4YAB+IkdSgdjdQmoN/1ypgodHFiczorws2mz6Zl0YJ+A0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571415111794565.3870087681424; Fri, 18 Oct 2019 09:11:51 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 341757BDA9; Fri, 18 Oct 2019 16:11:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0442960A9D; Fri, 18 Oct 2019 16:11:50 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id AA5BD180BAA2; Fri, 18 Oct 2019 16:11:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9IGBdc0004618 for ; Fri, 18 Oct 2019 12:11:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 257AF60161; Fri, 18 Oct 2019 16:11:39 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AB09600C8; Fri, 18 Oct 2019 16:11:38 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 18 Oct 2019 18:10:55 +0200 Message-Id: <33c21c4be8cc68018d7426db8280e84e3e351224.1571414890.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH RFC 10/40] qemu: Replace use of virDomainDiskFindByBusAndDst with virDomainDiskByTarget 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 18 Oct 2019 16:11:50 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In both replaced cases we have other code that verifies that the bus can't be changed or that the target is unique, so limiting the search to disks with same bus makes no sense. Signed-off-by: Peter Krempa Reviewed-by: Daniel Henrique Barboza --- src/qemu/qemu_driver.c | 7 ++----- src/qemu/qemu_hotplug.c | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index bf436f7dc3..ac5f108537 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7981,12 +7981,9 @@ qemuDomainChangeDiskLive(virDomainObjPtr vm, virDomainDeviceDef oldDev =3D { .type =3D dev->type }; int ret =3D -1; - if (!(orig_disk =3D virDomainDiskFindByBusAndDst(vm->def, - disk->bus, disk->dst)))= { + if (!(orig_disk =3D virDomainDiskByTarget(vm->def, disk->dst))) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("No device with bus '%s' and target '%s'"), - virDomainDiskBusTypeToString(disk->bus), - disk->dst); + _("disk '%s' not found"), disk->dst); goto cleanup; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index bf301919cc..3cb7f4cddd 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1092,7 +1092,7 @@ qemuDomainAttachDeviceDiskLive(virQEMUDriverPtr drive= r, * for devices supporting media changes */ if ((disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_CDROM || disk->device =3D=3D VIR_DOMAIN_DISK_DEVICE_FLOPPY) && - (orig_disk =3D virDomainDiskFindByBusAndDst(vm->def, disk->bus, di= sk->dst))) { + (orig_disk =3D virDomainDiskByTarget(vm->def, disk->dst))) { if (qemuDomainChangeEjectableMedia(driver, vm, orig_disk, disk->src, false) < 0) return -1; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list